[R-sig-ME] Question about gls

Louise Ryan Louise.M.Ryan at uts.edu.au
Fri Mar 23 20:27:46 CET 2018


Hi there,

I am using your function gls in R to fit some AR models (it is part of a larger thing I am trying to do). I can see from the printed output that the function is estimating the AR parameter.  But I CANNOT for the life of me figure out how to extract this parameter so I can use it for something else.

Here’s a bit of code that simulates some data and runs the model.

#####
# Set true parameter values:
beta0True <- 0.3
beta1True <- 1.6
sigmaTrue <- 0.5
rhoTrue <- 0.2

# Generate data:
set.seed(1)
n <- 500
x <- seq(0,1,length=n)
epsilon <- rep(NA,n)
epsilon[1] <- sigmaTrue*rnorm(1)
for (i in 2:n) {epsilon[i] <- rhoTrue*epsilon[i-1] + sigmaTrue*rnorm(1)}
y <- beta0True + beta1True*x + epsilon

fit.gls <- gls(y~x,  correlation=corAR1())
print(summary(fit.gls))
###########################

For my little simulation, the parameter Phi is being estimated as .1748786.

I have looked at attributes(fit.gls) and just cannot figure out where this estimate is stored!

I’d appreciate your help!

Louise
UTS CRICOS Provider Code: 00099F DISCLAIMER: This email message and any accompanying attachments may contain confidential information. If you are not the intended recipient, do not read, use, disseminate, distribute or copy this message or attachments. If you have received this message in error, please notify the sender immediately and delete this message. Any views expressed in this message are those of the individual sender, except where the sender expressly, and with authority, states them to be the views of the University of Technology Sydney. Before opening any attachments, please check them for viruses and defects. Think. Green. Do. Please consider the environment before printing this email.


More information about the R-sig-mixed-models mailing list