2
Please try to perform a parametric modeling of survival analysis and function predict()
is returning an error that does not recognize a variable, but it is there.
Following example:
base=NULL
base$DIAS= c(7,6,8,6,5,5,5,6,6,11,6,4,5,5,5,5,6,4,5,6)
base$DELTA= c(0,1,0,1,0,1,1,0,1,1,0,0,0,1,1,1,1,0,0,0)
base$Protocolo= c(1,0,1,1,0,1,0,1,0,1,0,1,1,1,1,1,1,1,1,1)
base$TIPAC= c(1,0,1,0,0,0,0,1,1,1,0,1,1,1,1,1,0,0,0,0)
base=data.frame(base)
modelo <- survreg(Surv(DIAS,DELTA) ~ Protocolo+TIPAC,data= base, dist = "exponential")
ptempo <- predict(modelo , type = "quantile", newdata= data.frame(1), p=1:99/100,se=TRUE)
Error in Eval(expr, envir, Enclos) : 'Protocol' object not found
Good evening Molx, thanks for the help, I created a base to use example (which I erroneously called a template) and copied the log of the R execution, whose data frame name was base. Your command worked perfectly, thank you very much.
– Henrique Pizarro
When you remove the argument "newdata= data.frame(1)" the ptempo$fit gets a disproportionate size (from 99 to 14530 in the original program) and I can’t plot a graph. Please, what would that argument be? and why does its presence prevent the program from recognizing the variable Procolo?
– Henrique Pizarro
@Henriquepizarro The argument
p
is, according to the help of the function, "a percentile vector. Used only for quantis prediction". The result is a multi-column matrix because it makes a prediction for each quantile, in your case, it’s 99 quantiles. If you do not intend to use the quantis, you can remove the argument, and then the result will return two columns, both in thefit
how much in these
.– Molx