corMatern | R Documentation |
This implements the Matérn correlation structure (see Matern
) for use with lme
or glmmPQL
. Usage is as for others corSpatial
objects
such as corGaus
or corExp
, except that the Matérn family
has an additional parameter. This function was defined for comparing
results obtained with corrHLfit
to those produced by lme
and glmmmPQL
. There
are problems in fitting (G)LMMs in the latter way, so it is not a
recommended practice.
corMatern(value = c(1, 0.5), form = ~1, nugget = FALSE, nuScaled = FALSE,
metric = c("euclidean", "maximum", "manhattan"), fixed = FALSE)
value |
An optional vector of parameter values, with serves as initial values or as fixed values depending on the If If |
form |
(Pasted from corSpatial) a one sided formula of the form |
nugget |
an optional logical value indicating whether a nugget
effect is present. Defaults to |
nuScaled |
If |
metric |
(Pasted from corSpatial) an optional character string specifying the distance
metric to be used. The currently available options are
|
fixed |
an optional logical value indicating whether the
coefficients should be allowed to vary in the optimization, or kept
fixed at their initial value. Defaults to |
This function is a constructor for the corMatern
class,
representing a Matérn spatial correlation structure. See
MaternCorr
for details on the Matérn family.
an object of class corMatern
, also inheriting from class
corSpatial
, representing a Matérn spatial correlation
structure.
The R and C code for the methods for corMatern
objects builds on code for corSpatial
objects, by D.M. Bates, J.C. Pinheiro and S. DebRoy, in a circa-2012 version of nlme.
Mixed-Effects Models in S and S-PLUS, José C. Pinheiro and Douglas M. Bates, Statistics and Computing Series, Springer-Verlag, New York, NY, 2000.
glmmPQL
, lme
## LMM
data("blackcap")
blackcapD <- cbind(blackcap,dummy=1) ## obscure, isn't it?
## With method= 'ML' in lme, The correlated random effect is described
## as a correlated residual error and no extra residual variance is fitted:
nlme::lme(fixed = migStatus ~ means, data = blackcapD, random = ~ 1 | dummy,
correlation = corMatern(form = ~ longitude+latitude | dummy),
method = "ML", control=nlme::lmeControl(sing.tol=1e-20))
## Binomial GLMM
if (spaMM.getOption("example_maxtime")>32) {
data("Loaloa")
LoaloaD <- cbind(Loaloa,dummy=1)
MASS::glmmPQL(fixed =cbind(npos,ntot-npos)~elev1+elev2+elev3+elev4+maxNDVI1+seNDVI,
data = LoaloaD, random = ~ 1 | dummy,family=binomial,
correlation = corMatern(form = ~ longitude+latitude | dummy))
}
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.