[R-sig-ME] Multiple random slopes in coxme
Patrick (Malone Quantitative)
m@|one @end|ng |rom m@|onequ@nt|t@t|ve@com
Thu Dec 3 22:50:53 CET 2020
Greetings. I was referred here from Cross-Validated and would
appreciate any help.
I'm using coxme v.2.2-16 in R v.4.0.3. The goal is a multilevel Cox
survival model with random slopes associated with level-1 predictors
"x1" and "x2," nested in level-2 units "cluster." I'm getting an error
I'm stuck on.
I found a related question on Stack Exchange at
https://stackoverflow.com/questions/51246155/random-slopes-cox-proportional-hazards
, in which a respondent quoted Terry Thernau saying multiple random
slopes (Terry's example fit4) should be possible, though estimation is
challenging--my error is different, I'm just citing Terry's "should."
The data look like:
FailTime Event x1 x2 cluster
1 1778 1 1 1 516
2 2192 0 1 1 618
3 1108 1 0 1 516
4 903 1 1 1 516
5 2031 1 1 0 558
6 836 1 1 1 619
A minimal reprex is:
library(coxme)
library(readr)
testdata <- read.csv(file="coxme_test.csv",row.names=1)
resultx1 <- coxme(Surv(FailTime,Event) ~ x1 + x2 + (1 + x1 | cluster),
data=testdata)
resultx1x2 <- coxme(Surv(FailTime,Event) ~ x1 + x2 + (1 + x1 + x2 |
cluster), data=testdata)
resultx1 runs fine (as does the same model with a single random slope
for x2 instead of x1).
resultx1x2 returns
Error in `[<-`(`*tmp*`, 1:n1 + irow, 1:n1 + icol, value =
as.matrix(addup(zcov))) :
subscript out of bounds
In addition: Warning message:
In sqrt(xvar * zvar) : NaNs produced
For now, I'm not worried about the warning--I can improve my starting
values. But I've had no luck tracking down any information about the
error. I'd appreciate any help.
I have placed a masked sample of my data as a .csv at
https://github.com/psmalone/reprex/blob/main/coxme_test.csv .
Thanks,
Pat
--
Patrick S. Malone, Ph.D., Malone Quantitative
NEW Service Models: http://malonequantitative.com
He/Him/His
More information about the R-sig-mixed-models
mailing list