[R] how to assign fixed factor in lm
genomenet at gmail.com
genomenet at gmail.com
Thu Mar 8 21:28:27 CET 2007
Hi there,
> Value=c(709,679,699,657,594,677,592,538,476,508,505,539)
> Lard=rep(c("Fresh","Rancid"),each=6)
> Gender=rep(c("Male","Male","Male","Female","Female","Female"),2)
> Food=data.frame(Value,Lard,Gender)
> Food
Value Lard Gender
1 709 Fresh Male
2 679 Fresh Male
3 699 Fresh Male
4 657 Fresh Female
5 594 Fresh Female
6 677 Fresh Female
7 592 Rancid Male
8 538 Rancid Male
9 476 Rancid Male
10 508 Rancid Female
11 505 Rancid Female
12 539 Rancid Female
> lm(fixed=Value~Gender,data=Food)
Call:
lm(data = Food, fixed = Value ~ Gender)
Coefficients:
(Intercept) LardRancid GenderMale
651.4 -142.8 35.5
Warning message:
extra arguments fixed are just disregarded. in: lm.fit(x, y, offset = offset, singular.ok = singular.ok, ...)
> lm(fixed=Value~Lard+Gender,data=Food)
Call:
lm(data = Food, fixed = Value ~ Lard + Gender)
Coefficients:
(Intercept) LardRancid GenderMale
651.4 -142.8 35.5
Warning message:
extra arguments fixed are just disregarded. in: lm.fit(x, y, offset = offset, singular.ok = singular.ok, ...)
I wanted to consider only one factor. But why lm(fixed=Value~Gender,data=Food)
return me two estimates of Gender and Lard. And I found the returning
results are the same as lm(fixed=Value~Lard+Gender,data=Food). Why lm
cannot do analysis of variance according to assigned formula?
Thank you very much.
Fan
More information about the R-help
mailing list