Dear Xavier
You problem comes from using attach(). Do not do that, it usually ends
in tears. Either use the data parameter to the functions which support
it or look at with() and within().
On 28/10/2017 21:11, CHIRIBOGA Xavier wrote:> Dear colleagues,
>
>
> How can I do to "relevel" the intercept?
>
> I need that the treatment "Db" be the intercept, and have
p-values for the comparisons with the others treatments.
>
> I used the function "relevel" but it did not work out to have
what I want.
>
> Thanks for your help,
>
>
> Xavier
>
>
> T1 <- read.table(file.choose(), h=T)
>> head(T1)
> treatment replicate Time Ebcg
> 1 CHA0+Db 1 1 9681172
> 2 CHA0+Db 2 1 5599000
> 3 CHA0+Db 3 1 10280480
> 4 CHA0+Db 4 1 1004526
> 5 CHA0+Db 5 1 12942018
> 6 CHA0+Db 6 1 7478773
>> attach(T1)
>> summary(T1)
> treatment replicate Time Ebcg
> CHA0 :6 Min. :1.000 Min. :1 Min. : 0
> CHA0+Db:9 1st Qu.:2.750 1st Qu.:1 1st Qu.: 1000922
> Db :9 Median :4.500 Median :1 Median : 4044094
> Healthy:9 Mean :4.625 Mean :1 Mean : 5699717
> PCL :6 3rd Qu.:6.250 3rd Qu.:1 3rd Qu.: 7785782
> PCL+Db :9 Max. :9.000 Max. :1 Max. :24736254
>> hist(Ebcg)
>> treatment<-relevel(treatment,ref="Db")
>> mT1<-lm(sqrt(Ebcg)~treatment,data=T1)
>> summary(mT1)
>
> Call:
> lm(formula = sqrt(Ebcg) ~ treatment, data = T1)
>
> Residuals:
> Min 1Q Median 3Q Max
> -1748.12 -540.19 0.97 545.14 1949.22
>
> Coefficients:
> Estimate Std. Error t value
Pr(>|t|)
> (Intercept) 532.5 384.4 1.385
0.173296
> treatmentCHA0+Db 2048.5 496.3 4.128 0.000170 ***
> treatmentDb 2491.9 496.3 5.021
9.93e-06 ***
> treatmentHealthy 1215.6 496.3 2.450 0.018552 *
> treatmentPCL 120.4 543.6 0.221
0.825816
> treatmentPCL+Db 2098.9 496.3 4.229 0.000124
***
> ---
> Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05
'.' 0.1 ' ' 1
>
> Residual standard error: 941.6 on 42 degrees of freedom
> Multiple R-squared: 0.5206, Adjusted R-squared: 0.4635
> F-statistic: 9.121 on 5 and 42 DF, p-value: 6.227e-06
>
>
>
> Xavier Chiriboga M.
> PhD Candidate
> Fundamental and Applied Research in Chemical Ecology Lab.
> Institute of Biology
> University of Neuchatel
>
> Website: https://www.unine.ch/farce/home/membres/xavier-chiriboga.html
>
> [[alternative HTML version deleted]]
>
> ______________________________________________
> R-help at r-project.org mailing list -- To UNSUBSCRIBE and more, see
> 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.
>
--
Michael
http://www.dewey.myzen.co.uk/home.html