therneau / survival

Survival package for R
381 stars 104 forks source link

vcov(..., complete=F) fails with survreg fit on a nested model #245

Closed p-schaefer closed 5 months ago

p-schaefer commented 5 months ago

For example:

 library(survival)
 dt <- read.table("https://web.archive.org/web/20171010101537if_/http://bayes.acs.unt.edu:8083/BayesContent/class/Jon/R_SC/Module9/lmm.data.txt",header=TRUE, sep=",", na.strings="NA", dec=".", strip.white=TRUE)

dt$extro[dt$extro<50]<-50
dt$cen<-dt$extro<=50

fit2 <- survreg(Surv(extro, !cen,type="left") ~ school/class, dt)
vcov(fit2,F)

results in:

Error in dimnames(vv) <- list(vname, vname) : 
ength of 'dimnames' [1] not equal to array extent

This effects the yates() function and possibly others.

This is using R.4.3.3 and survival 3.5.8.

Thanks.

EDIT: This seemed to be specifically when there were missing factor combinations due to nesting.

therneau commented 5 months ago

I've fixed it in my local copy, a a simple error and fix. What is surprising is that absolutely no one has ever encounter this before. I'm in the midst of a major change to survfit, and will try to get this whole bundle pushed soon