Displaying 1 result from an estimated 1 matches for "elsegrp".
Did you mean:
dosegrp
2001 Sep 18
1
case weights-coxph (solved)
Hi,
The following function does work
optimize.W<-function(W,k,G,Groups,cph.call,z){
n<-length(Groups)
grp.wt<-rep(0,n)
for(i in 1:(length(G))){
ind<-Groups == G[i]
if(G[i]!=k){
grp.wt[ind]<-W[i]
}
elsegrp.wt[ind]<-1
}
z<-data.frame(cbind(z,grp.wt=grp.wt)) #needed to make the case weights
#part of the data frame
mod<-coxph(cph.call,z,grp.wt,na.action=na.omit,singular.ok=T)
sum(mod$residuals^2)
}
I wouldn't call this a bug, but shouldn'...