[R] Extracting the full coefficient matrix from a gls summary?

Renaud Lancelot renaud.lancelot at gmail.com
Fri Nov 10 04:51:27 CET 2006


> library(nlme)
> ctl <- c(4.17,5.58,5.18,6.11,4.50,4.61,5.17,4.53,5.33,5.14)
> trt <- c(4.81,4.17,4.41,3.59,5.87,3.83,6.03,4.89,4.32,4.69)
> group <- gl(2,10,20, labels = c("Ctl", "Trt"))
> weight <- c(ctl, trt)
> fitgls <- gls(weight ~ group)
> summary(fitgls)$tTable
             Value Std.Error   t-value      p-value
(Intercept)  5.032 0.2202177 22.850117 9.547128e-15
groupTrt    -0.371 0.3114349 -1.191260 2.490232e-01

Best,

Renaud

2006/11/10, Tiphaine Jeanniard Du Dot <dudot at zoology.ubc.ca>:
> Hi,
> I am trying to extract the coefficients matrix from a gls summary.
> Contrary to the lm function,  the command fit$coefficients returns
> only the estimates of the model, not the whole matrix including the
> std errors, the t and the p values.
>
> example:
> ctl <- c(4.17,5.58,5.18,6.11,4.50,4.61,5.17,4.53,5.33,5.14)
>   trt <- c(4.81,4.17,4.41,3.59,5.87,3.83,6.03,4.89,4.32,4.69)
> group <- gl(2,10,20, labels=c("Ctl","Trt"))
> weight <- c(ctl, trt)
> fitlm<-lm(weight~group)
> summary(fitlm)$coefficients ### returns estimates, std errors, t
> values and Pr(>|t|)
> fitgls<-gls(weight~group)
> summary(fitgls)$coefficients  ### returns only the estimates.
>
> I would like to be able to extract the whole coefficient matrix form
> the gls. Any ideas how I could do that ?
>
> Thanks for the help,
>
> Tifenn<http://www.marinemammal.org/MMRU/tiphaine.html>
>
>         [[alternative HTML version deleted]]
>
> ______________________________________________
> R-help at stat.math.ethz.ch mailing list
> 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.
>


-- 
Renaud LANCELOT
Département Elevage et Médecine Vétérinaire (EMVT) du CIRAD
Directeur adjoint chargé des affaires scientifiques

CIRAD, Animal Production and Veterinary Medicine Department
Deputy director for scientific affairs

Campus international de Baillarguet
TA 30 / B (Bât. B, Bur. 214)
34398 Montpellier Cedex 5 - France
Tél   +33 (0)4 67 59 37 17
Secr. +33 (0)4 67 59 39 04
Fax   +33 (0)4 67 59 37 95



More information about the R-help mailing list