On Sat, Mar 9, 2013 at 10:35 AM, meng <laomeng_3@163.com> wrote:

> Hi all:
> My data is in the attachment.
> I want to analysis the mean difference of y between 2 sex.
>
> My code:
> result_lm<-lm(y~factor(sex) + x1 + x2)
> summary(result_lm)
>
> The result of "factor(sex)m" 136.83, is the mean difference of y between 2
> sex,and the corresponding p value is 0.07618.
>
> My question is: how to get the mean y of sex(m) and sex(f) respectively
> via lm function?
>

lm() would be overkill no? I'd just use tapply(), by(), ave(), or the like:
e.g.,

tapply(dat$y, dat$sex, mean)

Cheers,

MW

	[[alternative HTML version deleted]]

