Learn R Programming

spaMM (version 4.5.0)

get_inits_from_fit: Initiate a fit from another fit

Description

get_inits_from_fit is an extractor of some fitted values from a fit in a convenient format to initiate a next fit.

Usage

get_inits_from_fit(from, template = NULL, to_fn = NULL, inner_lambdas=FALSE)

Value

A list with elements

init, init.corrHLfit

(depending on the fitting function) giving initial values for outer-optimization;

init.HLfit

giving initial values for the iterative algorithms in HLfit. It is itself a list with possible elements:

fixef

for the coefficients of the linear predictor, adjusted to the format of the coefficients of the linear predictor of the template object, if available;

ranCoefs

random-coefficients parameters (if not outer-optimized).

Arguments

from

Fit object (inheriting from class "HLfit") from which fitted values are taken.

template

Another fit object. Usage with a template fit object is suitable for refitting this object using fitted values from the from object as starting values.

to_fn

NULL or character: the name of the function to be used the next fit. If NULL, taken from template (if available), else from from. It is meaningful to provide a to_fn distinct from the function used to fit a template.

inner_lambdas

Boolean; Whether the output should include estimates of the dispersion parameters estimated by the iterative methods implemented in HLfit.

See Also

get_ranPars and VarCorr.

Examples

Run this code
if (FALSE) {
data("blackcap")
(corrhlfit <- corrHLfit(migStatus ~ means+ Matern(1|longitude+latitude),data=blackcap,
                        method="ML")) 
inits <- get_inits_from_fit(corrhlfit, to_fn = "fitme")                    
(fitfit <- fitme(migStatus ~ means+ Matern(1|longitude+latitude),data=blackcap, 
                  init=inits[["init"]])) 
inits <- get_inits_from_fit(corrhlfit, template = fitfit)                    
fitme(migStatus ~ means+ Matern(1|longitude+latitude),data=blackcap, 
      init=inits[["init"]])
# In these examples, inits$init.HLfit is useless 
# as it is ignored when LMMs are fitted by fitme().
}

Run the code above in your browser using DataLab