An R6 class representing the results of a classical (frequentist) estimation.
Super class
BayesRTMB::RTMB_Fit_Base -> Classic_Fit
Public fields
modelThe `RTMB_Model` object used for estimation.
fitThe result of the estimation (dataframe or lm object).
para named list of parameter estimates.
vcovVariance-covariance matrix of fixed effects.
se_methodCharacter string specifying the method used for standard errors.
clusterCharacter string specifying the cluster variable name, if any.
robust_typeCharacter string specifying the robust standard error correction type, if used.
bootstrap_resultsA matrix containing bootstrap samples, if applicable.
test_resultsList of additional test results (e.g., chisq.test).
viewCharacter vector of parameter names to prioritize in summary.
par_vecNumeric vector of parameter estimates.
objectiveFinal objective value.
log_likLog-likelihood.
restricted_log_likRestricted log-likelihood, if classical estimation used REML-style marginalization.
rssResidual sum of squares for classical linear models, if available.
df_residualResidual degrees of freedom for classical linear models, if available.
convergenceConvergence code.
sd_repTMB sdreport object.
df_fixedDataframe of fixed effects results.
random_effectsDataframe of random effects results.
df_transformDataframe of transformed parameters.
df_generateDataframe of generated quantities.
opt_historyDataframe of optimization history.
transformList of transformed parameters.
generateList of generated quantities.
se_samplesList of simulated samples for SE estimation.
par_uncNumeric vector of unconstrained parameter estimates.
vcov_uncVariance-covariance matrix of parameters in unconstrained space.
ci_methodMethod used for CI estimation.
laplaceWhether Laplace approximation was used.
mapParameter mapping used.
df_methodCharacter string specifying the degrees of freedom calculation method.
idx_fix_activeNumeric vector; mapping between active parameters and full unconstrained vector.
show_dfLogical; whether to display degrees of freedom in the summary output.
Methods
Method new()
Create a new `Classic_Fit` object.
Usage
Classic_Fit$new(
model,
par_vec = NULL,
par = NULL,
objective = NULL,
log_lik = NULL,
restricted_log_lik = NULL,
convergence = NULL,
sd_rep = NULL,
df_fixed = NULL,
random_effects = NULL,
df_transform = NULL,
df_generate = NULL,
opt_history = NULL,
transform = NULL,
generate = NULL,
se_samples = NULL,
par_unc = NULL,
vcov_unc = NULL,
ci_method = "wald",
laplace = TRUE,
map = NULL,
test_results = list(),
view = NULL,
fit = NULL,
vcov = NULL,
df_method = "auto",
idx_fix_active = NULL,
show_df = TRUE,
rss = NULL,
df_residual = NULL,
...
)Arguments
modelThe `RTMB_Model` object.
par_vecNumeric vector of parameter estimates.
parList of parameter estimates.
objectiveFinal objective value.
log_likFull log-likelihood used for information criteria.
restricted_log_likRestricted log-likelihood, if classical estimation used REML-style marginalization.
convergenceConvergence code.
sd_repTMB sdreport object.
df_fixedDataframe of fixed effects results.
random_effectsDataframe of random effects results.
df_transformDataframe of transformed parameters.
df_generateDataframe of generated quantities.
opt_historyDataframe of optimization history.
transformList of transformed parameters.
generateList of generated quantities.
se_samplesList of simulated samples for SE estimation.
par_uncParameter vector on unconstrained scale.
vcov_uncCovariance matrix on unconstrained scale.
ci_methodMethod used for CI estimation.
laplaceWhether Laplace approximation was used.
mapParameter mapping used.
test_resultsList of additional test results (e.g., chisq.test).
viewCharacter vector of parameter names to prioritize in summary.
fitLegacy argument for backward compatibility (maps to df_fixed).
vcovVariance-covariance matrix of parameters.
df_methodMethod for degrees of freedom calculation.
idx_fix_activeNumeric vector; mapping between active parameters and full unconstrained vector.
show_dfLogical; whether to display degrees of freedom in the summary output.
rssResidual sum of squares for classical linear models, if available.
df_residualResidual degrees of freedom for classical linear models, if available.
...Additional arguments passed to the constructor.
Method robust_se()
Compute robust standard errors (sandwich estimator).
Usage
Classic_Fit$robust_se(
cluster = NULL,
type = c("HC3", "HC0", "HC1", "CR1", "CR0"),
inplace = FALSE,
...
)Arguments
clusterCharacter; variable name for clustering.
typeCharacter; "HC3" (default), "HC0", or "HC1" for non-clustered robust SE; "CR1" or "CR0" for clustered robust SE.
inplaceLogical; if FALSE, return a robust-SE copy without modifying the original fit. If TRUE, update the object in place.
...Additional arguments.
Method bootstrap()
Compute nonparametric bootstrap standard errors and confidence intervals. Currently implemented only for mediation models. Bootstrap refits mediation equations with base R lm.fit()/glm.fit() when possible, and falls back to RTMB refits for unsupported families.
Method compute_bootstrap()
Compute nonparametric bootstrap standard errors and confidence intervals. Currently implemented only for mediation models. Bootstrap refits mediation equations with base R lm.fit()/glm.fit() when possible, and falls back to RTMB refits for unsupported families.
Method print()
Print the fit results.
Method summary()
Display a summary of the estimation results.
Method anova()
Perform ANOVA (Wald F-tests / Chisq-tests) on the fitted model.
Usage
Classic_Fit$anova(method = c("reml", "ls"), type = 3)Method lsmeans()
Calculate Least Squares Means (Marginal Means) and contrasts.
Usage
Classic_Fit$lsmeans(
specs = NULL,
pairwise = FALSE,
simple = NULL,
adjust = "holm",
protect = FALSE
)Arguments
specsCharacter vector of factors to calculate means for.
pairwiseLogical; whether to perform pairwise comparisons.
simpleCharacter vector of factors to hold constant for simple main effects.
adjustCharacter; p-value adjustment method (e.g., "bonferroni", "holm", "none").
protectLogical; whether to use hierarchical (protected) testing.