Here is an exemple of fitting an ANCOVA model without intercept in R:
> k <- 40
> x <- 1:k
> sigma <- 30
> y1 <- rnorm(k, 1*x, sigma)
> y2 <- rnorm(k, 2*x, sigma)
> y3 <- rnorm(k, 3*x, sigma)
> x <- rep(x, 3)
> y <- c(y1,y2,y3)
> group <- gl(3,k)
> summary(lm(y~0+x+group:x))
Call:
lm(formula = y ~ 0 + x + group:x)
Residuals:
Min 1Q Median 3Q Max
-71.110 -20.389 -2.496 15.913 76.937
Coefficients: (1 not defined because of singularities)
Estimate Std. Error t value Pr(>|t|)
x 3.1933 0.1989 16.054 < 2e-16 ***
x:group1 -2.0444 0.2813 -7.268 4.44e-11 ***
x:group2 -1.2994 0.2813 -4.619 9.97e-06 ***
x:group3 NA NA NA NA
---
Signif. codes: 0 ‘***’ 0.001 ‘**’ 0.01 ‘*’ 0.05 ‘.’ 0.1 ‘ ’ 1
Residual standard error: 29.6 on 117 degrees of freedom
Multiple R-squared: 0.7654, Adjusted R-squared: 0.7594
F-statistic: 127.3 on 3 and 117 DF, p-value: < 2.2e-16
The parameter "x:group3" is not estimated. Of course this parameter actually is the parameter "x". The estimates seem to be correct, but are the p-values correct ? And is there another to fit this model without obtaining this problem ?