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?
 
Many thanks for your help.
My best.

 
sex     x1      x2      y
m       54      3       2446.2
m       50.5    2.25    1928.4
m       51      2.5     2094.5
m       56.5    3.5     2506.7
m       52      3       2121
m       76      9.5     3845.9
m       80      9       4380.8
m       74      9.5     4314.2
m       80      9       4078.4
m       76      8       4134.5
m       96      13.5    5830.2
m       97      14      6013.6
m       99      16      6410.6
m       92      11      5283.3
m       94      15      6101.6
f       54      3       2117.3
f       53      2.25    2200.2
f       51.5    2.5     1906.2
f       51      3       1850.3
f       51      3       1632.5
f       77      7.5     3934
f       77      10      4180.4
f       77      9.5     4246.1
f       74      9       3358.8
f       73      7.5     3809.7
f       91      12      5358.4
f       91      13      5601.7
f       94      15      6074.9
f       92      12      5299.4
f       91      12.5    5291.5
______________________________________________
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