[R-sig-eco] Changing the reference level of a factor

Manuel Spínola mspinola10 at gmail.com
Tue May 18 14:11:04 CEST 2010


Dear list members,

I am trying to change the reference level of a factor but when I run a 
model with the lm function the new order it does not taking place (I 
still have the old order of the levels).

 > relevel(nidprop$treatment, ref="c", data=nidprop)
 [1] a a a a b b b b c c c c
Levels: c a b

 > modelo1 = lm(hight ~ treatment, data = nidprop)

 > summary(modelo1)

Call:
lm(formula = hight ~ treatment, data = nidprop)

Residuals:
    Min      1Q  Median      3Q     Max
-1.6052 -1.0626 -0.0950  0.9228  3.0768

Coefficients:
               Estimate Std. Error t value Pr(>|t|)  
(Intercept)     37.9140     0.7368  51.461 1.98e-12 ***
treatment[T.b]  -0.2298     1.0419  -0.221   0.8304  
treatment[T.c]  -3.1133     1.0419  -2.988   0.0153 *
---
Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1

Residual standard error: 1.474 on 9 degrees of freedom
Multiple R-squared: 0.552,      Adjusted R-squared: 0.4525
F-statistic: 5.545 on 2 and 9 DF,  p-value: 0.02696


Any idea why?

Best,

Manuel Spínola

-- 
Manuel Spínola, Ph.D.
Instituto Internacional en Conservación y Manejo de Vida Silvestre
Universidad Nacional
Apartado 1350-3000
Heredia
COSTA RICA
mspinola at una.ac.cr
mspinola10 at gmail.com
Teléfono: (506) 2277-3598
Fax: (506) 2237-7036



More information about the R-sig-ecology mailing list