Remind myself of these conversations of learning statistics through using R these days.
Thanks Tim, your comments are very helpful.
1) The reason I excluded the intercept (i.e., -1) is only for the
convenience of extracting the coefficients (i.e. return the intercept,
which refers to the Estimate column, respectively for each group). I
indeed included the intercept (i.e., no -1) when running
the actual analyses. The difference of taking in/out of the intercept is
just the table outputs, not affecting any result of the analyses.
2) Dieter - Tim was correct. These two commands in fact did the same
thing in R, meaning main effects are given by both commands in addition
to the interaction term.
>lm(FA_308_27 ~ gp*smoker + Age - 1, data = dat3.2)
Estimate Std. Error t value Pr(>|t|)
gp1mALC 0.610268207 0.0425865499 14.330069 4.398040e-22
gp1wkALC 0.603016628 0.0469235498 12.851045 9.528076e-20
smokers 0.028498249 0.0194763982 1.463220 1.480830e-01
Age -0.001429693 0.0007651574 -1.868495 6.606585e-02
gp1wkALC:smokers -0.040359689 0.0368267023 -1.095935 2.770308e-01
>lm(FA_308_27 ~ gp + smoker + gp*smoker + Age - 1, data = dat3.2)
Estimate Std. Error t value Pr(>|t|)
gp1mALC 0.610268207 0.0425865499 14.330069 4.398040e-22
gp1wkALC 0.603016628 0.0469235498 12.851045 9.528076e-20
smokers 0.028498249 0.0194763982 1.463220 1.480830e-01
Age -0.001429693 0.0007651574 -1.868495 6.606585e-02
gp1wkALC:smokers -0.040359689 0.0368267023 -1.095935 2.770308e-01
3) I have read in pairwise comparisons in R (http://www.r-bloggers.com/r-tutorial-series-two-way-anova-with-pairwise-comparisons/)
and Two-way ANOVA with Interactions and Simple Main Effects (http://rtutorialseries.blogspot.com/2011/02/r-tutorial-series-two-way-anova-with.html).
I will change my statistical procedure accordingly.
Sincerely,
Yukai
===
Hi Yukai,
1) I'm wondering why you do not include the intercept in the model. In
your equation, you have -1. I strongly suggest you include the intercept
(i.e., +1). Depending on the statistical procedure you run, it can make
a huge difference. I don't remember if matters
in the standard lm model, but I always include it for form.
2) It is fine to do gp*smoking. In lm, if you use * e.g.,
variable1*variable2, the main effects for each variable in the
interaction term will automatically be included.
3) The reason you do not see means for the 4 groups (ns1mALC, s1mALC,
ns1wkALC, and s1wkALC), is because the model you built only includes the
main effects and interactions. To get the adjusted means and standard
errors for each individual group, you need to
do pairwise comparisons among those groups. Just google pairwise
comparisons in R, pairwise t-tests in R or try
http://www.r-statistics.com/. There should be some sample code that you can adapt, and it is relatively straight-forward to execute.
Tim
沒有留言:
張貼留言