I am running linear models to look at the significance of independent factors involved. The example model is: `
mymod1 <- lm(temp ~ bgrp+psex+tb,data=mydat)
summary(mymod1)`
I look at the summary to check out the significance of each factor:
lm(formula = temp ~ bgrp + psex + tb, data = mydat)
Residuals:
Min 1Q Median 3Q Max
-5.6877 -0.2454 0.0768 0.3916 1.6561
Coefficients:
Estimate Std. Error t value Pr(>|t|)
(Intercept) 37.324459 0.186081 200.581 < 2e-16 ***
bgrp 0.256794 0.066167 3.881 0.000115 ***
psex 0.144669 0.055140 2.624 0.008913 **
tb 0.019818 0.009342 2.121 0.034287 *
---
Signif. codes: 0 ‘***’ 0.001 ‘**’ 0.01 ‘*’ 0.05 ‘.’ 0.1 ‘ ’ 1
Residual standard error: 0.6888 on 621 degrees of freedom
(5 observations deleted due to missingness)
Multiple R-squared: 0.03675, Adjusted R-squared: 0.03209
F-statistic: 7.897 on 3 and 621 DF, p-value: 3.551e-05
Now, I would like to look at the solutions of the two levels of bgrp (1 and 2) and psex (1 and 2).
I would appreciate if you could help me with this.
Thanking you in advance,
Baz
EDIT:
I ran the first model you suggested and got the following:
mydat$bgrp <- as.factor(mydat$bgrp)
> summary(lm(temp ~ bgrp+psex+tb-1,data=mydat))
Call:
lm(formula = temp ~ bgrp + psex + tb - 1, data = apirt)
Residuals:
Min 1Q Median 3Q Max
-5.6877 -0.2454 0.0768 0.3916 1.6561
Coefficients:
Estimate Std. Error t value Pr(>|t|)
bgrp1 37.725922 0.135486 278.449 < 2e-16 ***
bgrp2 37.982716 0.129558 293.171 < 2e-16 ***
psex2 0.144669 0.055140 2.624 0.00891 **
tb 0.019818 0.009342 2.121 0.03429 *
---
Signif. codes: 0 ‘***’ 0.001 ‘**’ 0.01 ‘*’ 0.05 ‘.’ 0.1 ‘ ’ 1
Residual standard error: 0.6888 on 621 degrees of freedom
(5 observations deleted due to missingness)
Multiple R-squared: 0.9997, Adjusted R-squared: 0.9997
F-statistic: 4.788e+05 on 4 and 621 DF, p-value: < 2.2e-16
From the above coefficient table, bgrp1 and bgrp2 seem to make sense: bgrp1 represents the maternal lines with larger litter sizes, lighter offsprings, which results in lower rectal temperature (37.70 degrees C) of the offspring. On the other hand, bgrp2 represents the terminal lines with smaller litter size, heavier offsprings, which results in higher a rectal temperature (37.98 degrees C). I am just wondering, if the same could be done for psex1 and psex2, but what is presented in the table of coefficients could be due to what you said earlier.
EDIT: Hi Mark,
I tried the two options you suggested and I could see that bgrp1 and psex1 are taking on the same values:
> mybgrp <- lm(formula = temp ~ bgrp+psex+tb-1, data = mydat)
> mybgrp
Call:
lm(formula = temp ~ bgrp + psex + tb - 1, data = mydat)
Coefficients:
bgrp1 bgrp2 psex2 tb
37.72592 37.98272 0.14467 0.01982
> summary(mybgrp)
Call:
lm(formula = temp ~ bgrp + psex + tb - 1, data = mydat)
Residuals:
Min 1Q Median 3Q Max
-5.6877 -0.2454 0.0768 0.3916 1.6561
Coefficients:
Estimate Std. Error t value Pr(>|t|)
bgrp1 37.725922 0.135486 278.449 < 2e-16 ***
bgrp2 37.982716 0.129558 293.171 < 2e-16 ***
psex2 0.144669 0.055140 2.624 0.00891 **
tb 0.019818 0.009342 2.121 0.03429 *
---
Signif. codes: 0 ‘***’ 0.001 ‘**’ 0.01 ‘*’ 0.05 ‘.’ 0.1 ‘ ’ 1
Residual standard error: 0.6888 on 621 degrees of freedom
(5 observations deleted due to missingness)
Multiple R-squared: 0.9997, Adjusted R-squared: 0.9997
F-statistic: 4.788e+05 on 4 and 621 DF, p-value: < 2.2e-16
> mypsex <- lm(formula = temp ~ psex+bgrp+tb-1, data = mydat)
> mypsex
Call:
lm(formula = temp ~ psex + bgrp + tb - 1, data = mydat)
Coefficients:
psex1 psex2 bgrp2 tb
37.72592 37.87059 0.25679 0.01982
> summary(mypsex)
Call:
lm(formula = temp ~ psex + bgrp + tb - 1, data = mydat)
Residuals:
Min 1Q Median 3Q Max
-5.6877 -0.2454 0.0768 0.3916 1.6561
Coefficients:
Estimate Std. Error t value Pr(>|t|)
psex1 37.725922 0.135486 278.449 < 2e-16 ***
psex2 37.870591 0.135908 278.649 < 2e-16 ***
bgrp2 0.256794 0.066167 3.881 0.000115 ***
tb 0.019818 0.009342 2.121 0.034287 *
---
Signif. codes: 0 ‘***’ 0.001 ‘**’ 0.01 ‘*’ 0.05 ‘.’ 0.1 ‘ ’ 1
Residual standard error: 0.6888 on 621 degrees of freedom
(5 observations deleted due to missingness)
Multiple R-squared: 0.9997, Adjusted R-squared: 0.9997
F-statistic: 4.788e+05 on 4 and 621 DF, p-value: < 2.2e-16
Thanks!