<a.manners <at> sib.uq.edu.au> writes: > To whom it may concern, > > I'm trying to get an ANOVA table within survreg but it always > produces NA's in > the p-value, regardless of the data set.
[snip] The problem is fairly clear, but not knowing the larger context I don't know the best way to fix it. survival:::anova.survreg passes the following table to stat.anova(): Df Deviance Resid. Df -2*LL NULL 28 311.363 x -1 22.773 27 288.590 stat.anova figures out where to look for the deviance (dev.col is 2 here) and pulls out the difference in degrees of freedom (dfs = c(NA,-1)) It then uses vals <- table[, dev.col]/scale * sign(dfs) which comes out negative because sign(dfs) is negative but the deviance is calculated as positive therefore pchisq(vals, abs(dfs), lower.tail = FALSE)) comes out as NA since vals is < 0. In the short term you could do: a1 = anova(mot.sreg) pchisq(abs(diff(a1$"-2*LL")),df=abs(a1$Df[2]),lower.tail=FALSE) [1] 1.822632e-06 In the longer term it looks like someone (??) should figure out why anova.survreg and stat.anova are disagreeing about the appropriate signs of df and deviance, and how to fix it ... Ben Bolker ______________________________________________ R-devel@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-devel