| fitme | R Documentation |
This is a common interface for fitting most models that spaMM can fit, from linear models to mixed models with non-gaussian random effects, except multivariate-response models (see fitmv for the latter). By default, it uses ML rather than REML (differing in this respect from the other fitting functions corrHLfit, HLCor and HLfit). It tends to use “outer optimization”, i.e., generic optimization methods for estimating all dispersion parameters, rather than the iterative methods implemented in HLfit (see Details).
fitme(formula, data, family = gaussian(), init = list(), fixed = list(),
lower = list(), upper = list(), resid.model = ~1, init.HLfit = list(),
control = list(), control.dist = list(), method = "ML",
HLmethod = method, processed = NULL, nb_cores = NULL, objective = NULL,
weights.form = NULL, ...)
# '...' may notably include arguments
# 'rand.family', 'control.HLfit', and 'verbose'
# (see HLfit() documentation for them),
# 'covStruct', 'corrMatrix', 'adjMatrix' and 'distMatrix'
# (see HLCor() documentation for them).
formula |
Either a linear model |
data |
A data frame containing the variables in the response and the model formula. |
family |
Either a response |
init |
An optional list of initial values for correlation and/or dispersion parameters for distribution family. The general syntax is the same as for the |
fixed |
A list similar to |
lower, upper |
optional (sub)lists of values of parameters, in the same format as |
resid.model |
See identically named |
init.HLfit |
See identically named |
control.dist |
See |
method, HLmethod |
Character: the fitting method to be used, such as |
weights.form |
Specification of prior weights by a one-sided formula: use |
control |
A list of (rarely needed) control parameters, with possible elements:
|
nb_cores |
For development purpose, not documented. |
processed |
For programming purpose, not documented. |
objective |
For development purpose, not documented. |
... |
Optional arguments, notably those listed in the comments of the Usage section above, passed to (or operating as if passed to) either |
For approximations of likelihood, see method. For the possible structures of random effects, see random-effects. For the different results that may be obtained by using the init argument to select “inner”- vs.“outer”-estimation methods for dispersion parameters \lambda and \phi, and the availability of standard errors for these estimates, see inner-vs-outer.
The return value of an HLCor or an HLfit call, with additional attributes. The HLCor call is evaluated at the estimated correlation parameter values. These values are included in the return object as its $corrPars member. The attributes added by fitme include the original call of the function (which can be retrived by getCall(<fitted object>), and information about the optimization call within fitme.
## Examples with Matern correlations
## A likelihood ratio test based on the ML fits of a full and of a null model.
data("blackcap")
(fullfit <- fitme(migStatus ~ means+ Matern(1|longitude+latitude),data=blackcap) )
(nullfit <- fitme(migStatus ~ 1 + Matern(1|longitude+latitude),data=blackcap))
## p-value:
1-pchisq(2*(logLik(fullfit)-logLik(nullfit)),df=1)
# See help("spaMM")" for examples of conditional
# autoregressive model and of non-spatial models.
# see help("COMPoisson"), help("negbin"), help("Loaloa"), help("inner-vs-outer"),
# and many other documentation pages, for further examples.
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.