# NOT RUN {
id <- letters[1:10]
group <- c(1,1,3,2,3,3,2,3,2,4)
bdsBlock(id, group)
# }
# NOT RUN {
a b d g i c e f h j
a 1 1 0 0 0 0 0 0 0 0
b 1 1 0 0 0 0 0 0 0 0
d 0 0 1 1 1 0 0 0 0 0
g 0 0 1 1 1 0 0 0 0 0
i 0 0 1 1 1 0 0 0 0 0
c 0 0 0 0 0 1 1 1 1 0
e 0 0 0 0 0 1 1 1 1 0
f 0 0 0 0 0 1 1 1 1 0
h 0 0 0 0 0 1 1 1 1 0
j 0 0 0 0 0 0 0 0 0 1
# Create the matrices for a sparse nested fit of family within city
group <- paste(mydata$city, mydata$family, sep='/')
mat1 <- bdsI(group)
mat2 <- bdsBlock(group, mydata$city)
fit <- coxme(Surv(time, status) ~ age + sex + (1|group), data=mydata,
varlist=list(mat1, mat2))
# }
Run the code above in your browser using DataLab