get_fittedPars
returns estimated parameters.
get_ranPars
returns various subsets of random-effect parameters (correlation or variance parameters), as controlled by its which
argument.
It is one of several extractors for fixed or estimated parameters of different classes of parameters, for which a quick guide is
get_ranPars
: for random-effect parameters, excluding residual dispersion (with a subtlety for corrFamily
models: see Details);
VarCorr
: alternative extractor for random-effect (co)variance and optionally residual variance, in a data frame format;
residVar
: for residual variance parameters, family dispersion parameters, or information about residual variance models;
get_residVar
: alternative extractor of residual variances with different features inherited from get_predVar
;
get_inits_from_fit
: extracts estimated parameters from a fit, in a different format from get_fittedPars
.
remove_from_parlist
removes elements from a list of parameters, and from its type
attribute.
get_fittedPars(object, partial_rC="rm", phiPars=TRUE)
get_ranPars(object, which=NULL, verbose=TRUE,
lambda_names = "Group.Term", ...)
remove_from_parlist(parlist, removand=NULL, rm_names=names(unlist(removand)))
get_fittedPars
returns a list of model parameters, with possible elements: beta
(fixed-effect coefficients); lambda
, phi
, ranCoefs
and corrPars
(same meaning as in fixed
parameters); hyper
, for multIMRF
models;
the residual-dispersion parameters beta_prec
, NB_shape
and COMP_nu
when they are single scalars;
and rdisPars
for more complex residual-dispersion parameters. See the specific resid.model
and phi-resid.model
documentations for the rdisPars
format, dependent on the nature of the residual-dispersion parameter being modelized. Use residVar(., which="fam_parm")
to extract the vector of fitted values of the dispersion parameter.
get_ranPars(.,which="corrPars")
returns a (possibly nested) list of correlation parameters (or NULL if there is no such parameter). Top-level elements correspond to the different random effects. The list has a "type"
attribute having the same nested-list structure and describing whether and how the parameters where fitted: "fix"
means they where fixed, not fitted; "var"
means they were fitted by HLfit
's specific algorithms; "outer"
means they were fitted by a generic optimization method.
get_ranPars(.,which="lambda")
returns a vector of variance values, one per random effect, including both fixed, “outer”- and “inner”-optimized ones. The variances of random-coefficients terms with correlation parameters are not included.
get_ranPars(.,which="outer_lambda")
returns only “outer”-optimized variance parameters, ignoring those fitted by HLfit
's specific algorithms.
get_ranPars(.,which=NULL)
(the default) is not fully defined. It returns a list including the results of which="lambda"
and which="corrPars"
, but possibly other elements too.
get_ranPars(.,which="fitted")
is designed to provide fitted parameters with respect to which an information matrix is to be calculated (using numDeriv. It excludes fixed values, and has no type
attribute.
get_ranPars(. which="ranef_var")
(experimental) returns a list with elements
Var
same as get_ranPars(.,which="lambda")
lembda_est
A vector of variance values, one for each level of each random effect
outer
A vector or outer-optimized variance values, as returned by get_ranPars(.,which="outer_lambda")
Other elements, subject to change in later versions.
remove_from_parlist
returns a list of model parameters with given elements removed, and likewise for its (optional) type
attribute. See Details for context of application.
An object of class HLfit
, as returned by the fitting functions in spaMM
.
Controls handling of partially-fixed random coefficients. The default as set by "rm"
is to remove the fixed values as for other parameters. But alternative option "keep"
will keep the fixed value, and NA
will replace it by a NA.
Boolean: whether to include the parameters of any residual-dispersion model for \(phi\) (se phi-resid.model
) in the rdisPars
element of the returned list.
NULL or character string. Use which="corrPars"
to get the correlation parameters. Use which="lambda"
to get variances. see Details for the meaning of this for heteroscedastic models, and Value for other possible which
values.
Other arguments that may be needed by some method.
Boolean: Whether to print some notes.
A list of parameters. see Details.
Optional. A list of parameters to be removed from parlist
.
Names of parameters to be removed from parlist
. Mandatory if removand
is not given.
By default the names of the lambda
vector are built from the Group (RHS of random effect term of the for (LHS|RHS)) and Term (variable from LHS). By setting a non-default value of lambda_names
the names will be integer indices of the random-effect term in the model formula (currently, for which="ranef_var"
or NULL.
For heteroscedastic random effects, such as conditional autoregressive models, the variance parameter “lambda” refers to a common scaling coefficient. For other random-effect models, “lambda” typically refers to the single variance parameter.
remove_from_parlist
is designed to manipulate structured lists of parameters, such as a list with elements phi
, lambda
, and corrPars
, the latter being itself a list structured as the return value of get_ranPars(.,which="corrPars")
. parlist
may have an attribute type
, also with elements phi
, lambda
, and corrPars
... If given, removand
must have the same structure (but typically not all the elements of parlist
); otherwise, rm_names
must have elements which match names of unlist(names(parlist))
.
If a corrFamily parameter is fixed through the formula term, as in ARp(1|time, p=3, fixed=c(p2=0))
, the fixed parameter is not considered a model parameter and get_ranPars
will not extract it from the object. However, the parameter will be extracted if it has been fixed through fitme
's fixed
argument rather than through the formula term (see example in ARp
).
See get_fittedPars
, VarCorr
, residVar
, get_residVar
, or get_inits_from_fit
as described in the quick guide above.
data("wafers")
m1 <- HLfit(y ~X1+X2+(1|batch), resid.model = ~ 1, data=wafers, method="ML")
get_ranPars(m1,which="corrPars") # NULL since no correlated random effect
parlist1 <- list(lambda=1,phi=2,corrPars=list("1"=list(rho=3,nu=4),"2"=list(rho=5)))
parlist2 <- list(lambda=NA,corrPars=list("1"=list(rho=NA))) # values of elements do not matter
remove_from_parlist(parlist1,parlist2) ## same result as:
remove_from_parlist(parlist1,rm_names = names(unlist(parlist2)))
Run the code above in your browser using DataLab