# Different factor levels in R

I am running a model using lm in R to look at the effects of two independent factors. These independent factors are breeding group (bgrp: 2 levels with bgrp1=maternal lines; bgrp2=terminal lines) and sex (psex: 2 levels with psex1=males; psex2=females); and using number of total born (tb) as a linear covariate. I have around 600 records altogether.

The model is:

mybgrp <- lm(formula = prtemp ~ bgrp+psex+tb-1, data = apirt)  #removing the intercept
mybgrp

Call:
lm(formula = prtemp ~ bgrp + psex + tb - 1, data = apirt)

Coefficients:
bgrp1     bgrp2     psex2        tb
37.72592  37.98272   0.14467   0.01982

> summary(mybgrp)

Call:
lm(formula = prtemp ~ 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


Now, up to this stage I could see the values of the two levels of the bgrp (bgrp2=37.7; bgrp2=38), but not too certain how to use the value of psex2 (0.144669) or any other values in the table of coefficients to calculate the values of psex1 and psex2.

After asking around, I changed the order of the independent from the first model to this the one below, hoping that it would give me the values of psex1 and psex2:

mypsex <- lm(formula = prtemp ~ psex+bgrp+tb-1, data = apirt)
mypsex
Call:
lm(formula = prtemp ~ psex + bgrp + tb - 1, data = apirt)

Coefficients:
psex1     psex2     bgrp2        tb
37.72592  37.87059   0.25679   0.01982

> summary(mypsex)

Call:
lm(formula = prtemp ~ psex + bgrp + 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|)
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


As at now, I realise that psex1 has the same coefficient value as bgrp1.

My questions are:

1. Am I doing the right thing (in terms of the package and models used)?
2. Am I interpreting the output correctly?
3. Is there a correct way of obtaining the values of these factor levels in R?