R/calc_sum_counterfactual_gam.R
calc_sum_counterfactual_gam.Rd
Calculate the variance between a baseline sum of predictions against a counterfactual sum of predictions in a gam based on modified code from gam predict function help
calc_sum_counterfactual_gam(
m,
baseline_data,
counter_data = NULL,
ci = 0.95,
use_relative_diff = FALSE,
method = "delta",
nrep = 1000
)
model object
data.frame of baseline predictors
data.frame of counterfactual predictors. counter_data
cannot be NULL
range of confidence interval
provide estimates as a relative difference, otherwise presented as an absolute difference
Selects which method is used to estimate confidence intervals and expectation. Can be one of the following:
"delta"Implements delta approximation.
"posterior"Implements posterior sampling. Use nrep
to specify number of bootstrap samples
"bootstrap"Implements simple bootstrap. Use nrep
to specify number of bootstrap samples
"efron bootstrap"Implements Efron bootstrap. Use nrep
to specify number of bootstrap samples
number of samples used for posterior sampling. Only used if using
posterior
or bootstrap
methods
is TRUE
list