| Classic_Fit | R Documentation |
An R6 class representing the results of a classical (frequentist) estimation.
BayesRTMB::RTMB_Fit_Base -> Classic_Fit
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.
get_point_estimate()Get point estimate for a target parameter.
Classic_Fit$get_point_estimate(target, ...)
targetTarget parameter name.
...Additional arguments, ignored for classic fits.
Matrix, array, vector, or scalar point estimate.
new()Create a new 'Classic_Fit' object.
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, ... )
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.
robust_se()Compute robust standard errors (sandwich estimator).
Classic_Fit$robust_se(
cluster = NULL,
type = c("HC3", "HC0", "HC1", "CR1", "CR0"),
inplace = FALSE,
...
)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.
Self.
compute_robust()(Deprecated) Use robust_se() instead.
Classic_Fit$compute_robust(...)
...Arguments passed to robust_se(), including inplace.
Self.
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.
Classic_Fit$bootstrap(n_boot = 1000, seed = NULL, inplace = FALSE, ...)
n_bootInteger; number of bootstrap samples.
seedOptional integer random seed.
inplaceLogical; if FALSE, return a bootstrap-SE copy without modifying the original fit. If TRUE, update the object in place.
...Additional arguments.
A Classic_Fit object.
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.
Classic_Fit$compute_bootstrap(n_boot = 1000, seed = NULL, inplace = FALSE, ...)
n_bootInteger; number of bootstrap samples.
seedOptional integer random seed.
inplaceLogical; if FALSE, return a bootstrap-SE copy without modifying the original fit. If TRUE, update the object in place.
...Additional arguments.
A Classic_Fit object.
AIC()Get the AIC of the fitted model.
Classic_Fit$AIC()
BIC()Get the BIC of the fitted model.
Classic_Fit$BIC()
WAIC()WAIC is not defined for classical fits.
Classic_Fit$WAIC()
diagnose()Run basic diagnostics for the classical fit.
Classic_Fit$diagnose(...)
...Additional arguments passed to 'diagnose_classic_fit()'.
A 'diagnose_BayesRTMB' object.
print()Print the fit results.
Classic_Fit$print(...)
...Additional arguments passed to 'summary()'.
logLik()Get the Log-Likelihood of the fitted model.
Classic_Fit$logLik()
EAP()EAP estimates are not available for Classic_Fit.
Classic_Fit$EAP(...)
...Ignored.
MAP()MAP estimates are not available for Classic_Fit.
Classic_Fit$MAP(...)
...Ignored.
summary()Display a summary of the estimation results.
Classic_Fit$summary(view = NULL, digits = 5, max_rows = 10, ranef = FALSE)
viewCharacter vector of parameter names to prioritize or filter by.
digitsNumber of digits to print for estimates.
max_rowsMaximum number of rows to display in the coefficient table.
ranefLogical; whether to show random effects in the summary.
anova()Perform ANOVA (Wald F-tests / Chisq-tests) on the fitted model.
Classic_Fit$anova(method = c("reml", "ls"), type = 3)methodCharacter; "reml" (standard) or "ls" (experimental).
typeInteger; Type of Sum of Squares (only Type III supported currently).
A data frame containing the ANOVA table.
lsmeans()Calculate Least Squares Means (Marginal Means) and contrasts.
Classic_Fit$lsmeans( specs = NULL, pairwise = FALSE, simple = NULL, adjust = "holm", protect = FALSE )
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.
A data frame containing the marginal means or contrasts.
.calc_contrast()(Internal) Calculate metrics for a contrast.
Classic_Fit$.calc_contrast(L, specs)
LContrast matrix.
specsVariable names for lsmeans.
A data frame with estimate, SE, df, t-value, and p-value.
.get_lsmeans_df()(Internal) Get representative DF for lsmeans.
Classic_Fit$.get_lsmeans_df(specs)
specsVariable names for lsmeans.
Degrees of freedom.
.construct_par_list()(Internal) Construct a list of parameters from the fit.
Classic_Fit$.construct_par_list(fit)
fitThe fit result (dataframe or lm object).
A named list of parameters.
clone()The objects of this class are cloneable with this method.
Classic_Fit$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.