estimate_weights.Rd
This functions is essentially a wrapper around the weightit function. The user can specify the method to be used to estimate the weights.
estimate_weights(
dat,
exposure,
covariates,
s.weights,
id_var,
method,
method_args
)
A dataframe containing the variables of interest. A dataframe.
The name of the variable corresponding to the exposure. A string.
A vector of covariates' names. A vector.
Sampling weights. A vector.
The variable name to be used to identify subjects. A string.
The method to be used by weightit to estimate the weights. A string.
A named list with the following variables:
stabilize
, whether to stabilize the weights or not.
by
, a string containing the name of the variable
for which weighting is to be done within categories.
sl_lib
, either a vector of learners or FALSE
, in which case
it uses a fixed library of learners.
sl_discrete
, whether to use discrete SuperLearner, which
selects the best performing method, or to find the optimal combination of predictions.
use_kernel
, whether to use kernel density estimation
to estimate the numerator and denominator densities for the weights. A logical.
family_link
, family to be used within the fitted model.
A named list containing the estimated weights, and the names of the exposure and covariates used.