gls(model, data, correlation, weights, subset, method, na.action,
control, verbose)
# S3 method for gls
update(object, model., …, evaluate = TRUE)
"gls"
, representing
a generalized least squares fitted linear model.~
operator and the
terms, separated by +
operators, on the right.update.formula
for
details.model
, correlation
, weights
, and
subset
. By default the variables are taken from the
environment from which gls
is called.corStruct
object describing the
within-group correlation structure. See the documentation of
corClasses
for a description of the available corStruct
classes. If a grouping variable is to be used, it must be specified in
the form
argument to the corStruct
constructor. Defaults to NULL
, corresponding to uncorrelated
errors.varFunc
object or one-sided formula
describing the within-group heteroscedasticity structure. If given as
a formula, it is used as the argument to varFixed
,
corresponding to fixed variance weights. See the documentation on
varClasses
for a description of the available varFunc
classes. Defaults to NULL
, corresponding to homoscedastic
errors.data
should be used in the fit. This can be a logical
vector, or a numeric vector indicating which observation numbers are
to be included, or a character vector of the row names to be
included. All observations are included by default."REML"
the model is fit by
maximizing the restricted log-likelihood. If "ML"
the
log-likelihood is maximized. Defaults to "REML"
.NA
s. The default action (na.fail
) causes
gls
to print an error message and terminate if there are any
incomplete observations.glsControl
.
Defaults to an empty list.TRUE
information on
the evolution of the iterative algorithm is printed. Default is
FALSE
.TRUE
evaluate the new call else return the call."gls"
representing the linear model
fit. Generic functions such as print
, plot
, and
summary
have methods to show the results of the fit. See
glsObject
for the components of the fit. The functions
resid
, coef
and fitted
,
can be used to extract some of its components.correlation
argument are described in Box, G.E.P., Jenkins,
G.M., and Reinsel G.C. (1994), Littel, R.C., Milliken, G.A., Stroup,
W.W., and Wolfinger, R.D. (1996), and Venables, W.N. and Ripley,
B.D. (2002). The use of variance functions for linear
and nonlinear models is presented in detail in Carroll, R.J. and Ruppert,
D. (1988) and Davidian, M. and Giltinan, D.M. (1995). Box, G.E.P., Jenkins, G.M., and Reinsel G.C. (1994) "Time Series
Analysis: Forecasting and Control", 3rd Edition, Holden-Day. Carroll, R.J. and Ruppert, D. (1988) "Transformation and Weighting in
Regression", Chapman and Hall. Davidian, M. and Giltinan, D.M. (1995) "Nonlinear Mixed Effects Models
for Repeated Measurement Data", Chapman and Hall. Littel, R.C., Milliken, G.A., Stroup, W.W., and Wolfinger, R.D. (1996)
"SAS Systems for Mixed Models", SAS Institute. Pinheiro, J.C., and Bates, D.M. (2000) "Mixed-Effects Models
in S and S-PLUS", Springer, esp. pp. 100, 461. Venables, W.N. and Ripley, B.D. (2002) "Modern Applied Statistics with
S", 4th Edition, Springer-Verlag.corClasses
,
glsControl
,
glsObject
,
glsStruct
,
plot.gls
,
predict.gls
,
qqnorm.gls
,
residuals.gls
,
summary.gls
,
varClasses
,
varFunc
# AR(1) errors within each Mare
fm1 <- gls(follicles ~ sin(2*pi*Time) + cos(2*pi*Time), Ovary,
correlation = corAR1(form = ~ 1 | Mare))
# variance increases as a power of the absolute fitted values
fm2 <- update(fm1, weights = varPower())
Run the code above in your browser using DataCamp Workspace