2
$\begingroup$

I am having trouble understanding this simple example form the book Applied Survival Analysis in R.

The example is as follows,

Consider three cox models

Model A only contains ageGroup

Model B only contains employment

Model C contains employment and ageGroup.

The book writes that

for anova(A,C) we get p=0.1. "and we would conclude that the effect of “ageGroup4” is not statistically significant when “employment” is included in the model."

How I understood it, to me it seemed like this was testing weather ageGroup4 was significant in the presence of employment, since BOTH A and C contain ageGroup4 but only model C contains employment.

Similar for anova(B,C), p=0.002 the book writes "We thus conclude that “employment” belongs in the model if “ageGroup4” is also included, since the p-value for the former is extremely small."

Again to me it seems that since p is small, we can reject the null, the null being that AgeGroup4 is not significant, ie ageGroup 4 is significant.

It seems I have the opposite understanding. Can anyone help me see where I go wrong, and how the correct way to understand this really is?

$\endgroup$
4
  • $\begingroup$ Interesting.... At this point I don't agree with the book, the OP in the first example, or the answer by @Mads... $\endgroup$ Nov 8 '18 at 12:54
  • $\begingroup$ @SalMangiafico How do you interpret it? $\endgroup$
    – Learning
    Nov 8 '18 at 22:43
  • $\begingroup$ I would think that anova(A, C) tests the effect of Employment since that's what different between these models. $\endgroup$ Nov 9 '18 at 1:09
  • $\begingroup$ I agree with that . I must have worded it wrong in original post. Yes it seem it would be testing wether employment was significant $\endgroup$
    – Learning
    Nov 9 '18 at 7:50
1
$\begingroup$

For nested models, anova will test for the effect of the variable(s) that vary between the two models. There is some general discussion on Cross Validated here and here.

So, for the first example in the OP, anova (A, B) examines the difference in models by including Employment (given the other variables are already included in the model). This effectively tests the effect of adding Employment.

In R, the anova function can use different tests depending on the type of model and the options chosen. For example, the function might look at the change in sum of squares and evaluate it with an F test. Or it might look at the change in likelihood with a likelihood ratio test.

A simple example in R follows. It is clear that the change in df, sum of squares, F, and p-value are consistent between the Anova output and the anova output.

Things can get a little trickier when the models are more complex, and you may need to consider e.g. Type I vs. Type II sums of squares.

if(!require(car)){install.packages("car")}

set.seed(sum(utf8ToInt("TheresSometimesABuggy")))

X = gl(3, 4, labels=LETTERS[1:3])

Z = factor(rep(c("M","N"), length(X)/2))

Y = as.numeric(X) + as.numeric(Z) + rnorm(length(X), 0, 1)

model     = lm(Y ~ X + Z)

model.nox = lm(Y ~     Z)

model.noz = lm(Y ~ X)

library(car)

Anova(model)

   # Anova Table (Type II tests)
   # 
   # Response: Y
   #            Sum Sq Df F value Pr(>F)
   # X          9.3674  2  2.9896 0.1073
   # Z          2.5625  1  1.6357 0.2368
   # Residuals 12.5334  8 

anova(model, model.nox)

   # Analysis of Variance Table
   # 
   # Model 1: Y ~ X + Z
   # Model 2: Y ~ Z
   #   Res.Df    RSS Df Sum of Sq      F Pr(>F)
   # 1      8 12.533                           
   # 2     10 21.901 -2   -9.3674 2.9896 0.1073

anova(model, model.noz)

   # Analysis of Variance Table
   # 
   # Model 1: Y ~ X + Z
   # Model 2: Y ~ X
   #   Res.Df    RSS Df Sum of Sq      F Pr(>F)
   # 1      8 12.533                           
   # 2      9 15.096 -1   -2.5625 1.6357 0.2368
$\endgroup$
0
$\begingroup$

anova(A,C) concludes that ageGroup4 is not significant once you account for the inclusion of employment

anova(B,C) concludes that employment is still significant once you account for the inclusion of ageGroup4. (it does NOT conclude that ageGroup4 is significant).

Basically they say the same thing. employment is significant and makes ageGroup4 insignificant.

$\endgroup$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.