Hi,

I run the following commands. 'A' has 3 levels and 'B' has 4 levels.
Should there be totally 3+4 = 7 coefficients (A1, A2, A3, B1, B2, B3,
B4)?

> a=3
> b=4
> n=1000
> A = rep(sapply(1:a,function(x){rep(x,n)}),b)
> B = as.vector(sapply(sapply(1:b, function(x){rep(x,n)}), 
> function(x){rep(x,a)}))
> Y = A + B + rnorm(a*b*n)
>
> fr = data.frame(Y=Y,A=as.factor(A),B=as.factor(B))
> afit=aov(Y ~ A + B - 1,fr)
> afit$coefficients
      A1       A2       A3       B2       B3       B4
1.993067 2.969252 3.965888 1.005445 2.020717 3.023940

Regards,
Peng

______________________________________________
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.

Reply via email to