| RTMB_Fit_Base | R Documentation |
Base class for RTMB Fit objects
Base class for RTMB Fit objects
An R6 base class providing common methods for Bayesian and MAP inference results.
modelThe 'RTMB_Model' object used for estimation.
get_point_estimate()Abstract method to get a point estimate for a target parameter.
RTMB_Fit_Base$get_point_estimate(target, ...)
targetCharacter string specifying the target parameter name.
...Additional arguments.
A numeric array or matrix of the point estimate.
estimate()Get point estimates for parameters, transformed parameters, and generated quantities.
RTMB_Fit_Base$estimate(
pars = NULL,
type = c("mean", "EAP", "marginal_map", "joint_map", "MAP"),
component = c("all", "parameters", "transform", "generate"),
chains = NULL,
best_chains = NULL,
drop = TRUE,
...
)parsOptional character or numeric vector of parameter names or indices to extract. Supports special keywords: "parameters", "transform", "generate", and "all".
typeCharacter string specifying the estimation type.
componentCharacter string specifying the component to filter by.
chainsNumeric vector of chains to include.
best_chainsNumber of best chains to include.
dropLogical; if TRUE and only one parameter is selected, return the value directly instead of a list.
...Additional arguments passed to draws().
A named list of point estimates, or a single value if 'drop = TRUE'.
EAP()Calculate Expected A Posteriori (EAP) estimates from posterior samples.
RTMB_Fit_Base$EAP( pars = "parameters", chains = NULL, best_chains = NULL, drop = TRUE, ... )
parsOptional character vector of parameter names to extract.
chainsNumeric vector of chains to include.
best_chainsNumber of best chains to include.
dropLogical; whether to drop the list if only one parameter is selected.
...Additional arguments passed to 'estimate()'.
A named list of EAP estimates.
MAP()Calculate Maximum A Posteriori (MAP) estimates.
RTMB_Fit_Base$MAP(
pars = "parameters",
chains = NULL,
best_chains = NULL,
type = c("marginal", "joint"),
drop = TRUE,
...
)parsOptional character vector of parameter names to extract.
chainsNumeric vector of chains to include.
best_chainsNumber of best chains to include.
typeCharacter string; "marginal" or "joint" MAP.
dropLogical; whether to drop the list if only one parameter is selected.
...Additional arguments passed to 'estimate()'.
A named list of MAP estimates.
rotate()Rotate sampled parameters.
RTMB_Fit_Base$rotate( target, reference = NULL, linked = NULL, principal = FALSE, suffix = "rot", overwrite = TRUE )
targetCharacter string specifying the target variable to base the rotation on.
referenceMatrix to rotate towards. If NULL, the target's point estimate is used.
linkedCharacter vector of variable names to be rotated in the same direction.
principalLogical; if TRUE and 'reference' is NULL, the point estimate is first rotated to its principal axes and then used as the Procrustes reference. This is useful for MDU configurations.
suffixCharacter suffix used for generated quantities. The default stores results as '<variable>_rot'.
overwriteLogical; if TRUE, existing generated quantities with the same names are overwritten. If FALSE, a numeric suffix is appended.
The updated object invisibly.
posterior_predict()Generate posterior predictive replications.
RTMB_Fit_Base$posterior_predict(
code = NULL,
variable = NULL,
draws = 100L,
seed = NULL,
random = c("conditional", "population", "simulate"),
chains = NULL,
best_chains = NULL,
observed = NULL
)codeOptional 'rtmb_code()' object containing a 'generate' block for custom models. The block should create and report one replicated outcome.
variableName of the replicated quantity returned by 'code'. If omitted, 'y_rep' or the only returned quantity is used.
drawsNumber of predictive draws, or 'NULL' to use every available posterior draw.
seedOptional random seed.
randomHierarchical prediction mode: '"conditional"' uses fitted random effects, '"population"' omits them, and '"simulate"' draws new random effects for the observed groups.
chainsOptional chains to use.
best_chainsOptional number of best chains to use.
observedOptional observed outcome or its name in model data. This is stored as metadata when its length matches a prediction.
A matrix with predictive draws in rows and observations in columns.
pp_check()Plot a posterior predictive check.
RTMB_Fit_Base$pp_check(
type = c("auto", "dens", "bars"),
stat = NULL,
x = NULL,
code = NULL,
observed = NULL,
variable = NULL,
draws = 100L,
seed = NULL,
random = c("conditional", "population", "simulate"),
chains = NULL,
best_chains = NULL,
plot = TRUE,
...
)typePlot type: '"dens"', '"bars"', or '"auto"'. Automatic mode uses the observation likelihood's '_lpdf' or '_lpmf' implementation.
statOptional scalar statistic function, or its name. When supplied, the replicated statistic distribution is compared with its observed value.
xOptional predictor used for a scatter-based check. Supply a column name from the model data or a vector with one value per observation.
codeOptional custom generate block; see 'posterior_predict()'.
observedOptional observed outcome or its name in model data.
variableName of the replicated quantity returned by 'code'.
drawsNumber of posterior predictive replications.
seedOptional random seed.
randomHierarchical prediction mode; see 'posterior_predict()'.
chainsOptional chains to use.
best_chainsOptional number of best chains to use.
plotLogical; draw the check immediately.
...Graphical arguments passed to the plotting method.
An 'rtmb_pp_check' object, invisibly.
fa_rotate()Rotate factor loadings and optional factor scores.
RTMB_Fit_Base$fa_rotate( target = "L", linked = NULL, scores = NULL, rotate = "promax", ..., suffix = NULL, overwrite = TRUE )
targetCharacter string specifying the target variable to base the rotation on.
linkedCharacter vector of variable names to be rotated in the same direction.
scoresCharacter vector of variable names to be rotated as factor scores (inverse direction).
rotateCharacter string specifying the rotation method.
...Additional arguments passed to the rotation function.
suffixCharacter suffix used for generated quantities. If NULL, the rotation method name is used.
overwriteLogical; if TRUE, existing generated quantities with the same names are overwritten. If FALSE, a numeric suffix is appended.
The updated object invisibly.
clone()The objects of this class are cloneable with this method.
RTMB_Fit_Base$clone(deep = FALSE)
deepWhether to make a deep clone.
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.