[R] Score test for a subset of parameters estimated with coxph

Denise b den|@e@je@ne@b @end|ng |rom gm@||@com
Fri Aug 16 16:18:38 CEST 2019


>
> Dear R help list,
>
> I would like to perform a score test for a subset of the parameters
> estimated with coxph using the frailty() option.
> As illustrated in the following reproducible example, I am able to perform
> the score test with the standard coxph() but not in presence of frailty()
> argument. See Examples 1 and 2
>
> library(survival)
>
> # Example 1: score test using standard coxph()
> # score test for ph.karno & pat.karno coefficients
> fit1<-coxph(Surv(time,status)~sex+ ph.karno + pat.karno , data=lung)
> fit0<-coxph(Surv(time,status)~pat.karno , data=lung) # fit under null
> scorestat <- coxph(Surv(time,status)~sex+ ph.karno + pat.karno,
> init=c(0,0,coefficients(fit0)) ,iter=0, data=lung)
> scorestat$score
> [1] 10.50409
>
> # Example 2: coxph with frailty term
> # score test for ph.karno & pat.karno coefficients
> frailtyfit1<-coxph(Surv(time,status)~sex+ ph.karno + pat.karno
> +frailty(inst), data=lung)
> frailtyfit0<-coxph(Surv(time,status)~sex+ frailty(inst), data=lung)
> scorefrailtyfit1<-coxph(Surv(time,status)~sex+ ph.karno + pat.karno
> +frailty(inst), data=lung,
> init=c(0,0,coefficients(frailtyfit0)) ,iter=0)
>
> I get the following error message:
> Error in coxph(Surv(time, status) ~ sex + ph.karno + pat.karno +
> frailty(inst),  :
>   wrong length for init argument
>
>
> When I checked in the code I found
> if (length(init) != ncol(X))
>             stop("wrong length for init argument")
> Which seems that the length of the init argument doesnt match the number of
> predictors in the model.
>
> It seems that the code is expecting that I specify another parameter for
> frailty term.
> So, I tried to specify 2 as an inital value for frailty but got another
> error message later:
>
> scorefrailtyfit1<-coxph(Surv(time,status)~sex+ ph.karno + pat.karno
> +frailty(inst), data=lung,
> + init=c(0,0,coefficients(frailtyfit0),4.5),iter=0)
> Error in coxpenal.fit(X, Y, strats, offset, init = init, control, weights =
> weights,  :
>   Wrong length for inital values
>
> I have also checked coxme() but it seems that there is no option
> implemented
> for the score test.
> Do you have an idea of what could be the problem?
>
> Thanks,
> Denise
>
>
>

	[[alternative HTML version deleted]]



More information about the R-help mailing list