The Cox model in RGardar Sveinbjörnsson, Jongkil Kim, Yongsheng WangOUTLINERecid

The Cox model in RGardar Sveinbjörnsson, Jongkil Kim, Yongsheng WangOUTLINERecid www.phwiki.com

The Cox model in RGardar Sveinbjörnsson, Jongkil Kim, Yongsheng WangOUTLINERecid

Fuhrman, Kurt, Contributing Editor has reference to this Academic Journal, PHwiki organized this Journal The Cox model in RGardar Sveinbjörnsson, Jongkil Kim, Yongsheng WangOUTLINERecidivism dataCox PH Model as long as Time-Independent Variables in RModel SelectionModel DiagnosticsCox PH Model as long as Time-Dependent Variables in RSummary 218,April 2011Department of Mathematics, ETHZRecidivism dataThe data is from an experimental study of recidivism of 432 male prisoners, who were observed as long as a year after being released from prison.Half of the prisoners were r in addition to omly given financial aid when they were released.318,April 2011Department of Mathematics, ETHZThe data is from an experimental study of recidivism of 432 male prisoners, who were observed as long as a year after being released from prison.Half of the prisoners were r in addition to omly given financial aid when they were released.Recidivism data

Academy of Vocal Arts PA www.phwiki.com

This Particular University is Related to this Particular Journal

Variables in Recidivism Dataweek: week of first arrest after release, or censoring time. arrest: the event indicator, 1 = arrested , 0 = not fin: 1=received financial aid, 0= notage: in years at the time of releaserace: 1= black, 0= otherswexp: 1= had full-time work experience, 0= notmar: 1= married, 0= notparo: 1= released on parole, 0= notprio: number of prior convictionseduc: codes 2 (grade 6 or less), 3 (grades 6 through 9), 4 (grades 10 in addition to 11), 5 (grade 12), or 6 (some post-secondary).emp1— emp52: 1= employed in the corresponding week, 0 = not418,April 2011Department of Mathematics, ETHZRecidivism Data > Rossi <- read.table(’Rossi.txt’, header=T) > Rossi[1:5, 1:10] omitting the variables emp1 — emp52518,April 2011Department of Mathematics, ETHZ week arrest fin age race wexp mar paro prio educ 1 20 1 0 27 1 0 0 1 3 3 2 17 1 0 18 1 0 0 1 8 4 3 25 1 0 19 0 1 0 1 13 3 4 52 0 1 23 1 1 1 1 1 5 5 52 0 0 19 0 1 0 1 3 3Cox PH Model as long as Time-Independent Variables in R

7Cox PH Model as long as Time-Independent Variables in R Surv in addition to coxph function in RCox Regression Adjusted survival curve18,April 2011Department of Mathematics, ETHZ8Surv function in RSurv(time, event)time: survival or censoring timeevent: the status indicator0=censored1=observed Left-truncated in addition to right-censored dataSurv(time, time2, event)time: left-truncation timetime2: survival or censoring timeevent: the status indicator0= censored1= observed18,April 2011Department of Mathematics, ETHZ> Surv(time, time2, event, type=c(‘right’, ‘left’, ‘interval’, ‘counting’), origin=0)Right-censored data9Coxph function in R > coxph( as long as mula, data=, weights, subset, na.action, init, control, method=c(“efron”,”breslow”,”exact”), singular.ok=TRUE, robust=FALSE, model=FALSE, x=FALSE, y=TRUE, ) Most of the arguments are similar to lm18,April 2011Department of Mathematics, ETHZ

10Coxph function in RFormula The right-h in addition to side: the same as a linear modelThe left-h in addition to side: a survival objectMethod : The method as long as tie h in addition to ling. If there are no tied survival times all the methods are equivalent. Breslow: the default as long as most Cox PH modelsEfron: used as the default in addition to much more accurate than Breslow when dealing with tied survival timesExact: computes the exact partial likelihood18,April 2011Department of Mathematics, ETHZ11Cox regression > mod.allison <- coxph(Surv(week, arrest) ~ fin + age + race + wexp + mar + paro + prio + as.factor(educ), data=Rossi) > mod.allison18,April 2011Department of Mathematics, ETHZ12Cox regression18,April 2011Department of Mathematics, ETHZCall:coxph( as long as mula = Surv(week, arrest) ~ fin + age + race + wexp + mar + paro + prio + as.factor(educ), data = Rossi) coef exp(coef) se(coef) z pfin -0.4027 0.669 0.1930 -2.087 0.0370age -0.0514 0.950 0.0222 -2.316 0.0210race 0.3615 1.435 0.3122 1.158 0.2500wexp -0.1200 0.887 0.2135 -0.562 0.5700mar -0.4236 0.655 0.3822 -1.108 0.2700paro -0.0982 0.906 0.1959 -0.501 0.6200prio 0.0794 1.083 0.0293 2.707 0.0068as.factor(educ)3 0.5934 1.810 0.5196 1.142 0.2500as.factor(educ)4 0.3284 1.389 0.5437 0.604 0.5500as.factor(educ)5 -0.1210 0.886 0.6752 -0.179 0.8600as.factor(educ)6 -0.4070 0.666 1.1233 -0.362 0.7200Likelihood ratio test=38.7 on 11 df, p=6.01e-05 n= 432, number of events= 114

13Adjusted survival curve> plot(survfit(mod.allison), ylim=c(.7, 1), xlab=’Weeks’, ylab=’Proportion Not Rearrested’)18,April 2011Department of Mathematics, ETHZ14Adjusted survival curveWe may wish to display how estimated survival depends upon the value of a covariate. Because the principal purpose of the recidivism study was to assess the impact of financial aid on rearrest, let us focus on this covariate. We construct a new data frame with two rows, one as long as each value of fin; the other covariates are fixed to their median. 18,April 2011Department of Mathematics, ETHZ15Adjusted survival curve18,April 2011Department of Mathematics, ETHZ> Rossi.fin <- data.frame(fin=c(0,1), age=rep(median(age),2), race=rep(median(race),2),wexp=rep(median(wexp),2), mar=rep(median(mar),2), paro=rep(median(paro),2), prio=rep(median(prio),2), educ=as.factor(rep(median(educ),2))> plot(survfit(mod.allison, newdata=Rossi.fin), conf.int=T, lty=c(1,2), col=c(‘red’, ‘blue’), ylim=c(.5, 1), xlab=’Weeks’, ylab=’Proportion Not Rearrested’)

Model Selection16Model SelectionWhy variable selectionPurposeful selectionStepwise selectionBest Subset Selection of Covariates18,April 201117Departement of Mathematics, ETHZWhy variable selectionWe generally want to explain the data in the simplest way.Unnecessary predictors in a model will effect the estimation of other quantities. That is to say, degrees of freedom will be wastedIf model is to be used as long as prediction, we will save ef as long as t, time in addition to /or money if we do not have to collect data as long as predictors that are redundant.1818,April 2011Department of Mathematics, ETHZ

Why variable selectionWe must decide on a method to select a subset of variables.Purposeful selectionStepwise selection – using P-values – using AICBest subset selection1918,April 2011Department of Mathematics, ETHZPurposeful selectionWe fit a multivariable model containing all variables that were significant in a univariable analysis at the 20-25% level. We use the p-values from the Wald statistic to remove variables from our model. We also confirm the non-significance by a likelihood ratio test.We check whether the removal has produced an “important” change in coefficients of other variables.We check again all the variables that we removed.We check as long as nonlinearity.We look as long as interactions.We check assumptions. 2018,April 2011Department of Mathematics, ETHZStepwise selectionStepwise selection is a mix between as long as ward in addition to backward selection.We can either start with an empty model or a full model in addition to add/remove predictors according some criteria.At each step we reconsider terms that were added or removed earlier. Often applied in practice Done argument in the step() function in R In practice often based on AIC/BIC 2118,April 2011Department of Mathematics, ETHZ

Stepwise selectionThe AIC is a measure of the relative goodness of fit of a statistical model.It does not only reward goodness of fit, but also includes a penalty that is an increasing function of the number of parameters.AIC = 2k – 2max(loglikelihood), where k is the number of parameters in the model.This means the smaller the better2218,April 2011Department of Mathematics, ETHZStepwise selection using our dataStep: AIC=1327.35Surv(week, arrest) ~ fin + age + mar + prio Df AIC 1327.3- mar 1 1327.7- fin 1 1329.0- age 1 1335.4- prio 1 1336.22318,April 2011Department of Mathematics, ETHZ24Best Subset SelectionStepwise only considers a small number of all the possible modelsBest subset provides a way to check all the possible modelsThe same as in linear regression: need a criterion to judge the modelsIdea: not only based on goodness-of- fit, but also penalizes as long as the model size.18,April 2011Department of Mathematics, ETHZ

Fuhrman, Kurt LA Car - The Cars and Culture of Southern California Contributing Editor www.phwiki.com

25Best Subset Selection Mallow’s C: C=W+(p-2q) smaller C is betterp: number of variables under considerationq: number of variables not included in the subset modelW=W(p)-W(p-q), where W(p) is the Wald statistics as long as the model containing all p variables in addition to W(p-q) denotes the Wald statistics as long as the subset model 18,April 2011Department of Mathematics, ETHZBest Subset Selection of CovariatesCheck the model 2618,April 2011Department of Mathematics, ETHZModel Diagnostics 27

Model Diagnostics Analyze PH assumption with residualsInfluential observationsChecking nonlinearity18,April 201128Departement of Mathematics, ETHZ18,April 2011Department of Mathematics, ETHZAnalyze PH assumption with residualsWe have a strong evidence of non-PH assumption as long as ageplot with cox.zph shows us plots of scaled Schoenfeld residuals.> cox.zph(mod.allison.4) rho chisq pfin -0.000159 2.99e-06 0.99862age -0.221020 7.38e+00 0.00659prio -0.077930 7.32e-01 0.39237mar 0.131485 2.08e+00 0.14937GLOBAL NA 8.88e+00 0.0640618,April 2011Department of Mathematics, ETHZAnalyze PH assumption with residuals> plot(cox.zph(mod.allison.4))

58Final modelEmployment coef exp(coef) se(coef) z Pr(>z) employed -0.82758 0.43710 0.21583 -3.834 0.000126 The estimated hazard ratio is 0.43710.This means that the hazard of rearrest is smaller by a decline of 56 percent during a week in which the as long as mer inmate was employed.18,April 2011Department of Mathematics, ETHZ59SummaryCox PH Model as long as Time-Independent Variables in RSurv in addition to coxph function in RCox Regression Adjusted survival curveModel SelectionWhy variable selectionPurposeful selectionStepwise selectionBest Subset Selection 18,April 2011Department of Mathematics, ETHZ60SummaryModel DiagnosticsAnalyze PH assumption with residualsInfluential observationsChecking nonlinearityCox PH Model as long as Time-Dependent Variables in RModel descriptionAnalysis as long as the resultLagged variablesFinal model18,April 2011Department of Mathematics, ETHZ

Fuhrman, Kurt Contributing Editor

Fuhrman, Kurt is from United States and they belong to LA Car – The Cars and Culture of Southern California and they are from  Monrovia, United States got related to this Particular Journal. and Fuhrman, Kurt deal with the subjects like Automobiles; Automotive Industry; Automotive Safety and Performance Testing; Shipping and Freighting; Transportation

Journal Ratings by Academy of Vocal Arts

This Particular Journal got reviewed and rated by Academy of Vocal Arts and short form of this particular Institution is PA and gave this Journal an Excellent Rating.