SharkCaller
SharkCaller

Reputation: 113

Why is R not displaying the f-values for two way anova?

I have three variables:

and I want to create a two way anova with interaction for the variables:

month <- c("1","1","1","1","2","2","2","2","3","3","3","3","4","4","4","4","5","5","5","5","6","6","6","6")
region <-c("1","2","3","4","1","2","3","4","1","2","3","4","1","2","3","4","1","2","3","4","1","2","3","4")
sales <-c(85, 107,61, 22, 40, 65, 58,51,60,41,45,27,15,30,68,63,28,3,57,12,36,21,10,16)

data <- cbind(sales, month, region)
data <- as.data.frame(data)

mod.aov <- aov(sales ~ month*region, data = data)
summary(mod.aov)

and as you can see:

> summary(mod.aov)
             Df Sum Sq Mean Sq
month         5   6369  1273.7
region        3   1043   347.6
month:region 15   7854   523.6

R is not displaying the f-values for this model. Why is that?

And just related to this example, is it possible (or meaningful) to perform a linear regression model for two categorical variables as predictors with interaction between them? Any insight would be appreciated. Thx!

Upvotes: 0

Views: 1320

Answers (2)

StupidWolf
StupidWolf

Reputation: 46908

You have only 1 observation per combination of month and data, you cannot estimate the effect of month:region with n=1.

data = data.frame(sales,month,region)
table(data$month,data$region)
   
    1 2 3 4
  1 1 1 1 1
  2 1 1 1 1
  3 1 1 1 1
  4 1 1 1 1
  5 1 1 1 1
  6 1 1 1 1

You can loosely interpret as , Anova is analysis of variance, and n=1 means no variance. Hence the summary is not displaying f values.

And to answer this question:

And just related to this example, is it possible (or meaningful) to perform a linear regression model for two categorical variables as predictors with interaction between them? Any insight would be appreciated

Yes you can do that, for example in this case, if you would have more than 1 replicate for each month and region combination, you are basically modeling the effect of region to be different for every month.

Upvotes: 1

SharkCaller
SharkCaller

Reputation: 113

I read in another post that the model is saturated, as there are not enough data points for all the degrees of freedom needed for the model.

https://stats.stackexchange.com/questions/94078/why-do-i-not-get-a-p-value-from-this-anova-in-r

Upvotes: 0

Related Questions