Skip to contents

Model specification

bf()
Set up a model formula
lf()
Add parameter formulas to a model formula
nlf()
Add a nonlinear parameter formula to a model formula
ps()
A penalized spline whose value a nonlinear body consumes
mvbf() set_rescor()
Combine formulas into a multivariate model
`+`(<frmtmb_bform>)
Add to a model formula
set_mecor()
Control the correlation of noise-free latent variables
update_adterms()
Update the addition terms of a formula
num_factor()
Factor with numeric-coded levels for coordinate covariance structures
frmtmb-autocor
Within-group residual correlation (R-side autocorrelation)
ar() ma() arma() cosy() unstr() fcor() acformula()
Autocorrelation terms outside a formula
frmtmb-me me
Noise-free predictors with known measurement error
frmtmb-multimembership
Multi-membership random effects

Fitting

frm()
Fit a model
frmtmb_control()
Control parameters for frmtmb fits
par_template()
Parameter names and starting values
frm_allfit()
Refit a model with every available optimizer
frm_simulate()
Simulate responses from a formula and parameters
frm_multiple()
Fit a model across multiply imputed datasets
fixef(<frmtmb_multiple>) summary(<frmtmb_multiple>) conditional_effects(<frmtmb_multiple>) vcov(<frmtmb_multiple>) coef(<frmtmb_multiple>) ranef(<frmtmb_multiple>) VarCorr(<frmtmb_multiple>) fitted(<frmtmb_multiple>) nobs(<frmtmb_multiple>) formula(<frmtmb_multiple>) family(<frmtmb_multiple>)
Pooled post-processing of a frm_multiple() fit

Families

frmtmb_family() custom_family()
Define a model family
frmtmb_structure()
Declare a non-rowwise likelihood to the core
frmtmb_register_frame_check()
Check an assembled model frame from another package
frmtmb_register_aterm()
Add an addition term from another package
frmtmb_register_covstruct()
Register a covariance structure from another package
frmtmb_register_autocor()
Register a residual correlation term from another package
frmtmb_autocor_pars()
The parameters of a fit's residual correlation terms
frmtmb_covstruct_info()
What frmtmb knows about a covariance structure
frmtmb_local_registries()
Save frmtmb's registries, and restore them when a test ends
frmtmb_register_compat() compat_rule_builder() compat_aterm_rules()
Contribute to the compatibility matrix from another package
frmtmb_ad_overload()
Make a user-written function tape-safe
response_mean() mixture_multimodal_refusals() mixture_posterior() as_frmtmb_family() eval_dpars() single_response() fit_extras() dpar_linpred() structure_supports_all() frame_block_of()
The two fitting options every mixture-type family refuses, in its own name.
frm_stop() frm_warning() frm_message() frm_family_package() frm_match_arg()
Classed conditions
frmtmb-gp frmtmb_gp_nugget
Exact Gaussian processes and their nugget
dpar_log() dpar_log1m() dpar_log_complement() dpar_complement()
Exact distributional parameters for a custom density
us_sigma() us_theta()
Unstructured covariance matrix from its parameter vector
latent_probs()
Posterior probabilities of the latent states
dirichlet() logistic_normal() student() lognormal() negbinomial() nbinom1() Beta() tweedie() compois() zero_inflated_poisson() zero_inflated_negbinomial() hurdle_poisson() hurdle_negbinomial() multinomial() dirichlet_multinomial() cumulative() hurdle_cumulative() beta_binomial() zero_inflated_beta_binomial() skew_normal() exgaussian() bernoulli() geometric() exponential() weibull() shifted_lognormal() hurdle_gamma() hurdle_lognormal() zero_inflated_binomial() zero_inflated_beta() zero_one_inflated_beta() xbeta() asym_laplace() zero_inflated_asym_laplace() huber() sratio() cratio() acat() von_mises() categorical()
Additional response families
frechet() gen_extreme_value() discrete_weibull()
Extreme-value and discrete Weibull families
frmtmb-links
Link functions
print(<frmtmb_family>)
Print a family
brmsfamily()
Build a family by name, with a link for any of its parameters
mixture()
Finite mixture families
mixture_probs()
Posterior class probabilities of a mixture fit
frmtmb-student-re
Student-t distributed random effects
check_custom_family()
Check a custom family's log-density for AD safety

Inference and diagnostics

confint(<frmtmb_fit>)
Confidence intervals for frmtmb fits
confint_varcorr()
Natural-scale confidence intervals for covariance parameters
vcov_cluster()
Cluster-robust (sandwich) covariance
cluster_scores()
Per-cluster score matrix
autocor_matrix()
Estimated within-group residual correlation matrix
autocor()
Autocorrelation structures of a fit (deprecated)
profile(<frmtmb_fit>)
Likelihood profiles
hypothesis()
Hypothesis tests on parameter expressions
plot(<frmtmb_hypothesis>) print(<frmtmb_hyp_plot>) plot(<frmtmb_hyp_plot>)
Plot hypothesis tests
variables()
Usable parameter names
parnames()
Deprecated name of variables()
frm_bootstrap()
Parametric bootstrap
diagnose()
Convergence diagnostics for a frmtmb fit
dharma_residuals()
DHARMa residual diagnostics
residuals(<frmtmb_fit>)
Residuals from a frmtmb fit
plot(<frmtmb_fit>)
Diagnostic plots for a fit
pp_check()
Predictive check against simulated responses
anova(<frmtmb_fit>)
Likelihood-ratio tests between nested frmtmb fits
logLik_penalized() AIC(<frmtmb_fit>) BIC(<frmtmb_fit>) logLik(<frmtmb_fit>)
Log-likelihood and penalized log-likelihood of a fit
anova(<frmtmb_multiple>)
Pooled model comparison across imputations (D1, D2, D3)
drop1(<frmtmb_fit>)
Single-term deletions
as_draws() as_draws_matrix() as_draws_array() as_draws_df() as_draws_list() as_draws_rvars()
Convert to a posterior draws object
loo() waic() loo_compare() LOO() WAIC()
Approximate leave-one-out cross-validation
log_lik()
Pointwise log-likelihood
bayes_R2()
Bayesian R-squared
loo_epred() loo_linpred() loo_predict() loo_predictive_interval() loo_R2() loo_model_weights() kfold() reloo() loo_moment_match() loo_subsample()
Leave-one-out functions that need posterior draws
add_criterion()
Add a model comparison criterion to a fit
pp_mixture()
Posterior mixture-component probabilities at the estimates
stancode() standata()
Stan code and Stan data of a model
posterior_summary()
Summaries and intervals of draws
expose_functions()
Expose a model's compiled functions
ndraws() nchains() niterations() nvariables()
Size of a draws object
getME(<frmtmb_fit>)
Extract components of a fit, lme4 style
frmtmb-sampling-api build_objective gp_tape_scope gp_tape_order gp_nugget_message row_lpdf with_cs_offsets cs_offsets_add update_merge_prior ce_by_response resp_refuse_single ce_na_vars autocor_for_newdata us_chol_cor expand_b aterms_for_newdata has_trunc as_priorlist check_prior_slots resolve_prior_input neg_log_prior_fn resolve_bounds spec_target spec_spelling frmtmb_register_prior_defaults ncp_eligible ncp_scale_b ncp_unscale_b covstruct_has_chol block_sd_idx block_cor_prior block_n_cor is_student_block sim_can sim_note sim_context sim_draw sim_is_structured par_name_bare outer_par_names estimated_coef_names log_sd_theta_index sdr_of require_fitted hyp_parse_all hyp_vals_only hyp_env_vals hyp_eval hyp_tail_p hyp_class_prefix hyp_labels hyp_samples_frame hyp_brms_result brms_coef_names brms_re_rnames brms_block_has_r brms_coef_table brms_stan_name brms_group_name brms_levels brms_re_parts hyp_eval_in hyp_expr_vars brms_par_labels gp_brms_natural mi_sampling varcorr_matrices varcorr_layout varcorr_values ce_grids_build ce_boot_one ce_frame ce_finalize ce_cats_display ce_display_kind ce_pred_dpar ce_group_vars ce_structure_check ce_re_formula ce_dots find_linpred arg_unset re_form_arg frm_install_generics frm_check_dots vcov_estimated fam_is_category_valued predict_category_props brms_summary_matrix brms_summary_array brms_summarize_draws brms_prob_cols brms_fixef_rows ord_delta_info ord_lp_blocks ord_thres_linpred rescor_row_loglik predict_rescor_draw autocor_flat_priors autocor_bound_chart autocor_row_loglik arma_cond_resp frame_ac_terms latres_new_spec latres_shifted autocor_cond_strip_latent arma_cond_dpars arma_cond_fill_dpars arma_cond_fill_epred response_codes_newdata subset_resp_check subset_newdata mo_simplex mo_coords mo_chart_frame mo_frame_terms simplex_frame_terms summary_mo_frame cs_build cs_coef cs_frame cs_finalize cs_probs ce_spaghetti ce_check_distance ce_spaghetti_check ce_level_plan ce_plan_eval ce_plan_has_new ce_method ce_predict_family_check ce_sim_one pp_check_resp check_weights_unbounded
Core internals for a sampling extension
influence(<frmtmb_fit>) cooks.distance(<frmtmb_fit>) dfbeta(<frmtmb_influence>) dfbetas(<frmtmb_influence>)
Influence measures by case deletion
plot(<frmtmb_influence>)
Plot case-deletion influence
set_prior()
Set up priors brms-style
prior() prior_() prior_string()
Set up priors with brms's quoting spelling
print(<frmtmb_priorlist>)
Print a prior specification
`$`(<frmtmb_priorlist>) `$<-`(<frmtmb_priorlist>)
Column access on a prior specification
empty_prior()
An empty prior specification
as.brmsprior()
Transform an object into a prior specification
default_prior() get_prior()
Default priors: the slots a prior can target
validate_prior()
Check a prior against a model
prior_normal() prior_t() prior_logistic() prior_gamma() prior_inv_gamma() prior_beta() prior_lkj() prior_dirichlet()
Prior density objects
prior_summary()
Priors used in a fit

Extractors and prediction

predict(<frmtmb_fit>)
Predictions from a frmtmb fit
frm_linpred()
Predictions from a frmtmb fit
fitted(<frmtmb_fit>)
Fitted values
conditional_effects()
Conditional effects of predictors
plot(<frmtmb_conditional_effects>) print(<frmtmb_ce_plot>) plot(<frmtmb_ce_plot>)
Plot conditional effects
conditional_smooths()
Display the smooth terms of a model
make_conditions()
Build a conditions data frame for conditional_effects()
simulate(<frmtmb_fit>)
Simulate responses from a frmtmb fit
refit(<frmtmb_fit>)
Refit a model to a new response
update(<frmtmb_fit>)
Update and refit a model
coef(<frmtmb_fit>)
Per-group coefficients (fixed effects plus conditional modes)
fixef(<frmtmb_fit>)
Extract fixed effects
fixef_by_dpar()
Fixed effects per linear predictor
ranef(<frmtmb_fit>)
Extract random-effect modes
ngrps()
Number of levels per random-effect grouping factor
VarCorr(<frmtmb_fit>)
Extract random-effect standard deviations and correlations
rescor_matrix()
Estimated residual correlation matrix (rescor fits), else NULL
vcov(<frmtmb_fit>)
Covariance matrix of the fixed-effect estimates
frm_lp_basis()
The design of a linear predictor over the coefficient vector
frm_extra_cov_deriv()
The covariance of a curve's derivative that is not coefficient uncertainty
frm_curve()
A fitted curve on a grid, with pointwise and simultaneous bands
frm_curve_deriv()
Derivatives of a fitted curve
frm_curve_feature()
Features of a fitted curve: a peak, a trough, or a level crossing
frmtmb-emmeans
emmeans support
frmtmb-marginaleffects
marginaleffects on frmtmb fits
frm_joint_cov()
The joint covariance of the fixed and random coefficients
sigma(<frmtmb_fit>)
Residual standard deviation
frmtmb-scales
Which scale each method reports

Feature compatibility

frm_compat()
Query the feature compatibility registry
frm_compat_features()
Feature metadata for the compatibility registry
frm_compat_rules()
Compatibility rules, before resolution

Spectral models

frm_periodogram()
Periodogram for a Whittle-likelihood fit
whittle()
Whittle likelihood for a periodogram response
frm_series_draw()
Draw a time series from a fitted spectrum

Package

frmtmb frmtmb-package
frmtmb: Formula-Based Regression Models via 'RTMB'
habit_prep
Forced-response habit data from Hardwick et al. (2019)
frm_hazard_reads()
Find $ reads of a partial-matching container