-
Notifications
You must be signed in to change notification settings - Fork 5
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
visreg clash with riskRegression for hazard plots #153
Comments
Here is what I was able to find. First, if I use the debugger and look at the content of Browse[1]> Data
function (n, outcome = "competing.risks", formula = ~f(X1, 2) +
f(X2, -0.033) + f(X3, 0.4) + f(X6, 0.1) + f(X7, -0.1) + f(X8,
0.5) + f(X9, -1))
{
# Some code that's irrelevant
}
<bytecode: 0x7f84a6322f10>
<environment: namespace:riskRegression> As we can see at the end, the argument https://github.com/pbreheny/visreg/blob/13254c9553960c3885f2c12c7a7f7332bc582fb2/R/setupF.R#L37 A little bit more sleuthing reveals that Browse[1]> identical(Data, riskRegression::sampleData)
[1] TRUE One key observation is that > cfit$call
fitSmoothHazard(formula = death ~ futime + sex * pspline(age,
df = 4), data = mgus, time = "futime")
> cfit$lower_call
glm(formula = formula, family = binomial, data = sampleData) Given all this, and given how The only problem with this guess is that it doesn't explain why the code works when |
As a proof of concept, you can see that if we define an object library(survival)
library(casebase)
#> See example usage at http://sahirbhatnagar.com/casebase/
sampleData <- 10
class(sampleData) <- "foo"
names.foo <- function(x) message("I feel triggered")
cfit <- fitSmoothHazard(death ~ futime + sex*pspline(age, df=4), data=mgus, time = "futime")
#> Warning: glm.fit: fitted probabilities numerically 0 or 1 occurred
plot(cfit,
hazard.params = list(xvar = "age",
by = "sex",
alpha = 1))
#> I feel triggered
#> Error in as.data.frame.default(data): cannot coerce class '"foo"' to a data.frame Created on 2021-10-14 by the reprex package (v2.0.0) |
I have no idea where to even begin with this error. It seems there's a clash somewhere with the visreg and riskRegression packages. It occurs when I use the
plot.singleEventCB
function:Created on 2021-10-14 by the reprex package (v0.3.0)
Session info
This works if I don't load riskRegression:
Created on 2021-10-14 by the reprex package (v0.3.0)
Session info
The text was updated successfully, but these errors were encountered: