r - How to get p_values of features in survreg? -
i working on survival analysis , each time use different test set , @ end have avg of coefficients, p each feature , p value of model. can coefficients using srfit$coefficients. don't know how p values, although can see them using summary(srfit).
summary(srfit) call: survreg(formula = surv(time) ~ f1 + f2 + f3 + f4 + f5 + f6 + f7 + f8 + f9 + f10, data = train, dist = dist_pred[i_dist]) value std. error z p (intercept) 1.59e+03 632.0632 2.5092 1.21e-02 f1 -2.07e+00 1.2283 -1.6881 9.14e-02 f2 1.03e+00 1.8070 0.5677 5.70e-01 f3 -7.61e-02 1.3764 -0.0553 9.56e-01 f4 -3.24e+00 1.4836 -2.1843 2.89e-02 f5 4.37e-01 0.0961 4.5474 5.43e-06 f6 -1.36e+00 0.7555 -1.8011 7.17e-02 f7 -6.26e-03 0.0081 -0.7719 4.40e-01 f8 3.92e-03 0.0186 0.2111 8.33e-01 f9 -4.82e-01 0.4291 -1.1235 2.61e-01 f10 -7.79e-01 0.3139 -2.4809 1.31e-02 log(scale) 2.73e+00 0.0314 86.9447 0.00e+00 scale= 15.4 student-t distribution: parmameters= 4 loglik(model)= -4542.1 loglik(intercept only)= -4570.1 chisq= 56 on 10 degrees of freedom, p= 2.1e-08 number of newton-raphson iterations: 5 n= 1008
if @ survival:::summary.survreg
, can see how p-values computed, i.e.
table <- matrix(rep(coef, 4), ncol = 4) dimnames(table) <- list(cname, c("value", "std. error", "z", "p")) stds <- sqrt(diag(object$var)) table[, 2] <- stds table[, 3] <- table[, 1]/stds table[, 4] <- 2 * pnorm(-abs(table[, 3]))
is table printed. in other words, p-values can obtained survreg
object with
with(srfit, 2*pnorm(-abs(coefficients / sqrt(diag(var)))) )
Comments
Post a Comment