
phmm(formula, random, data, subset, na.action, Sigma, varcov, NINIT,
VARSTART, MAXSTEP, CONVERG, emstep, Gbs, Gbsvar, verbose)
survreg
for further details. Intercept is implicitely
included in the model by estimation random=~1
.NA
s in the
data. The user is discouraged to change a default value
na.fail
.Sigma
. Currently only "diagonal"
is supported.TRUE
to print EM steps.nreff
< 3);Gilks, W. R. and Wild, P. (1992) Adaptive rejection sampling for Gibbs sampling. Applied Statistics 41, pp 337-348.
Vaida, F. and Xu, R. 2000. "Proportional hazards model with random effects", Statistics in Medicine, 19:3309-3324.
Xu, R, Gamst, A, Donohue, M, Vaida, F, & Harrington, DP. 2006. Using Profile Likelihood for Semiparametric Model Selection with Application to Proportional Hazards Mixed Models. Harvard University Biostatistics Working Paper Series, Working Paper 43.
survfit
, Surv
.N <- 100
B <- 100
n <- 50
nclust <- 5
clusters <- rep(1:nclust,each=n/nclust)
beta0 <- c(1,2)
set.seed(13)
#generate phmm data set
Z <- cbind(Z1=sample(0:1,n,replace=TRUE),
Z2=sample(0:1,n,replace=TRUE),
Z3=sample(0:1,n,replace=TRUE))
b <- cbind(rep(rnorm(nclust),each=n/nclust),rep(rnorm(nclust),each=n/nclust))
Wb <- matrix(0,n,2)
for( j in 1:2) Wb[,j] <- Z[,j]*b[,j]
Wb <- apply(Wb,1,sum)
T <- -log(runif(n,0,1))*exp(-Z[,c('Z1','Z2')]%*%beta0-Wb)
C <- runif(n,0,1)
time <- ifelse(T<C,T,C)
event <- ifelse(T<=C,1,0)
mean(event)
phmmdata <- data.frame(Z)
phmmdata$cluster <- clusters
phmmdata$time <- time
phmmdata$event <- event
fit.phmm <- phmm(Surv(time, event)~Z1+Z2+cluster(cluster),
~-1+Z1+Z2, phmmdata, Gbs = 100, Gbsvar = 1000, VARSTART = 1,
NINIT = 10, MAXSTEP = 100, CONVERG=90)
summary(fit.phmm)
Run the code above in your browser using DataLab