Fits a (spatially) correlated mixed model, for given correlation parameters
A fitting function acting as a convenient interface for HLfit
, constructing the correlation matrix of random effects from the arguments, then estimating fixed effects and dispersion parameters using HLfit
. Various arguments are available to constrain the correlation structure, covStruct
and distMatrix
being the more general ones (for any number of random effects), and adjMatrix
and corrMatrix
being alternatives to covStruct
for a single correlated random effect. uniqueGeo
is deprecated.
HLCor(formula, data, family = gaussian(), ranPars = NULL, distMatrix, adjMatrix, corrMatrix, covStruct=NULL, method = "REML", verbose = c(trace=FALSE), control.dist = list(), ...)
formula |
A |
ranPars |
A list of values for correlation parameters (some of which are mandatory), and possibly also dispersion parameters
(optional, but passed to HLfit if present). See |
data |
The data frame to be analyzed. |
family |
A |
distMatrix |
Either a distance matrix between geographic locations, forwarded to |
adjMatrix |
An single adjacency matrix, used if a random effect of the form |
corrMatrix |
A matrix C used if a random effect term of the form |
covStruct |
An interface for specifying correlation structures for different types of random effect ( |
method |
Character: the fitting method to be used, such as |
verbose |
A vector of booleans. |
control.dist |
A list of arguments that control the computation of the distance argument of the correlation functions. Possible elements are
|
... |
Further parameters passed to |
For approximations of likelihood, see method
. For the possible structures of random effects, see random-effects
, but note that HLCor
cannot adjust parameters of correlation models (with the exception of conditional autoregressive ones). Any such parameter must be specified by the ranPars
argument. More generally, the correlation matrix for random effects can be specified by various combinations of formula terms and other arguments (see Examples):
Matern(1|<...>)
, using the spatial coordinates in <...>
. This will construct a correlation matrix according to the Matérn correlation function (see MaternCorr
);
Cauchy(1|<...>)
, as for Matern (see CauchyCorr
);
as provided by distMatrix
(see Examples);
corrMatrix(1|<...>)
with corrMatrix
argument. See corrMatrix
for further details.
adjacency(1|<...>)
with adjMatrix
. See adjacency
for further details;
AR1(1|<...>)
See AR1
for further details.
The return value of an HLfit
call, with the following additional attributes:
HLCorcall |
the HLCor call |
info.uniqueGeo |
Unique geographic locations. |
autoregressive
for additional examples, MaternCorr
, HLfit
, and corrHLfit
# Example with an adjacency matrix (autoregressive model): # see 'adjacency' documentation page #### Matern correlation using only the Matern() syntax data("blackcap") (fitM <- HLCor(migStatus ~ means+ Matern(1|longitude+latitude),data=blackcap, method="ML", ranPars=list(nu=0.6285603,rho=0.0544659))) #### Using the 'distMatrix' argument data("blackcap") # # Build distance matrix (here equivalent to the default one for a Matern() term) MLdistMat <- as.matrix(proxy::dist(blackcap[,c("latitude","longitude")])) # (fitD <- HLCor(migStatus ~ means+ Matern(1|longitude+latitude),data=blackcap, distMatrix=MLdistMat, method="ML", ranPars=list(nu=0.6285603,rho=0.0544659))) # : result here must be equivalent to the one without the distMatrix. diff(c(logLik(fitM),logLik(fitD)))
Please choose more modern alternatives, such as Google Chrome or Mozilla Firefox.