# [R] a little statistics help

Thomas Lumley tlumley at u.washington.edu
Mon Jul 1 17:36:11 CEST 2002

```On Mon, 1 Jul 2002 VBMorozov at lbl.gov wrote:

> Dear R-guRus:
> I am stuck with the following problem in R:
> Let's say i have a data.frame with columns X,Y & Z.
> X is a column of numbers, Y is a column of N
> factors "A", "B", "C", "D", etc and Z is a column of n
> factors "a", "b", "c", etc
>
> if i do MyLm<-lm(X~Y*Z - 1) i get all N coefficients for Y-factors, but
> only n-1 coefficients for Z-factors, and only N*(n-1) coefficients for
> YZ interaction. Is that how it's supposed to be?

Yes.

>	I would like to get N
> coefficients for all factors Y and n coefficients for all factors Z -
> how can i do that?

I really don't think you want to do that. Suppose for illustration that
N=n=2.

There are then only four groups defined by the values of Y and Z, and your
model gives four coefficients, which completely specify the means of each
group.  You are asking for n+N+nN=8 coefficients to describe the means of
4 groups.

-thomas

Thomas Lumley			Asst. Professor, Biostatistics
tlumley at u.washington.edu	University of Washington, Seattle

-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-
r-help mailing list -- Read http://www.ci.tuwien.ac.at/~hornik/R/R-FAQ.html
Send "info", "help", or "[un]subscribe"
(in the "body", not the subject !)  To: r-help-request at stat.math.ethz.ch
_._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._

```