[R] question about function "gls" in library "nlme"

Renaud Lancelot renaud.lancelot at gmail.com
Mon Nov 6 09:44:48 CET 2006


> library(nlme)
> fm1 <- gls(follicles ~ sin(2*pi*Time) + cos(2*pi*Time), Ovary,
+            correlation = corARMA(form = ~ 1 | Mare, p = 2))
> summary(fm1)
Generalized least squares fit by REML
  Model: follicles ~ sin(2 * pi * Time) + cos(2 * pi * Time)
  Data: Ovary
       AIC      BIC    logLik
  1561.995 1584.317 -774.9976

Correlation Structure: ARMA(2,0)
 Formula: ~1 | Mare
 Parameter estimate(s):
     Phi1      Phi2
0.5991803 0.2028649

Coefficients:
                       Value Std.Error   t-value p-value
(Intercept)        12.110836 0.7633842 15.864667  0.0000
sin(2 * pi * Time) -2.825762 0.5773713 -4.894185  0.0000
cos(2 * pi * Time) -0.838151 0.6432846 -1.302924  0.1936

 Correlation:
                   (Intr) s(*p*T
sin(2 * pi * Time)  0.000
cos(2 * pi * Time) -0.276  0.000

Standardized residuals:
        Min          Q1         Med          Q3         Max
-2.39970879 -0.73304443 -0.02229811  0.64429618  3.19313563

Residual standard error: 4.607767
Degrees of freedom: 308 total; 305 residual
> coef(fm1$modelStruct, unconstrained = FALSE)
corStruct.Phi1 corStruct.Phi2
     0.5991803      0.2028649

Best,

Renaud


2006/11/6, yyan liu <zhliur at yahoo.com>:
> Hi:
>    The gls function I used in my code is the following
>    fm<-gls(y~x,correlation=corARMA(p=2) )
>   My question is how to extact the AR(2) parameters from "fm".
>   The object "fm" is the following.  How can I extract the correlation parameters
>  Phi1 and Phi2 from "fm"? These two parametrs is not in the "coef" componenet  of "fm".
>  Thanks a lot!
>
>  liu
>  --------------------------------------------------------------------------------------------------------------
>  > fm
>  Generalized least squares fit by REML
>    Model: y ~ x
>    Data: NULL
>    Log-restricted-likelihood: -1634.588
>
>  Coefficients:
>  (Intercept)           x
>   16.0728672   0.2917921
>
>  Correlation Structure: ARMA(2,0)
>   Formula: ~1
>   Parameter estimate(s):
>        Phi1       Phi2
>   1.3368230 -0.4539957
>  Degrees of freedom: 480 total; 478 residual
>  Residual standard error: 20.80244
>  --------------------------------------------------------------------------------------------------------------
>
>
> ---------------------------------
>
>         [[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