Consider the below ANCOVA example in which I am trying to predict a continuous varibale
y by two variables
x (continuous) and
a (nominal) and their interaction. As I am also interested in the intercept I am using
summary.lm() instead of
summary.aov(). My question is: does the significant intercept in the below example represent an overall intercept (across factor levels of
a) or does this indicate that there is only a significant intercept in the first factor level (this is suggested here)?
If yes, is there a way to test for an overall intercept within the ANCOVA model?
set.seed(123) sd1 <- 1 sd2 <- 3.5 n <- 100 x1 <- 2+rnorm(n,0,sd1) x2 <- 2+rnorm(n,0,sd1) y1 <- x1+2+rnorm(n,0,sd2) y2 <- -x2-2+rnorm(n,0,sd2) a <- as.factor(c(rep("a1", n), rep("a2", n))) x <- c(x1,x2) y <- c(y1,y2) m1 <- lm(y1~x1); m2 <- lm(y2~x2) summary(m1); summary(m2) model <- lm(y~x*a) summary.lm(model)