`gestimation` uses the propensity_scores
function to generate inverse probability
weights. The weights can either be standardized weights or non-standardized weights. A grid search is done on \(\alpha\)
to construct the best \(\beta\) coefficient in the structural nested mean model. Alternatively, a linear mean model can be used
for a closed form estimator.
gestimation(
data,
grid,
ids = list(),
f = NA,
family = binomial(),
simple = pkg.env$simple,
p.f = NA,
p.simple = pkg.env$simple,
p.family = binomial(),
p.scores = NA,
SW = TRUE,
n.boot = 100,
type = "one.grid",
...
)
gestimation
returns an object of class "gestimation"
.
The functions print
, summary
, and predict
can be used to interact with
the underlying glm
or geeglm
model.
An object of class "gestimation"
is a list containing the following:
the matched call.
the formula used in the model.
the underlying glm model. If the model performed a grid search, this will be renamed 'best.model'
the estimated IP weights.
returns the value used for the 'type' parameter.
the estimated average treatment effect (risk difference).
a data frame containing the ATE, SE, and 95% CI of the ATE.
a data frame containing the variables in the model.
This should be the same data used in init_params
.
a list of possible \(\beta\) values that will be used in the grid search.
(optional) see documentation for geeglm
. By default rownames of the data will be used.
(optional) an object of class "formula" that overrides the default parameter. NOTE: for g-estimation this should be a propensity formula.
the family to be used in the general linear model.
By default, this is set to gaussian
.
(optional) a boolean indicator to build default formula with interactions for the g-estimation model. If true, interactions will be excluded. If false, interactions will be included. By default, simple is set to false. NOTE: \(\beta\) will be appended to the end of the formula
(optional) an object of class "formula" that overrides the default formula for the denominator of the IP weighting function.
(optional) a boolean indicator to build default formula with interactions for the propensity models. If true, interactions will be excluded. If false, interactions will be included. By default, simple is set to false. NOTE: if this is changed, the coefficient for treatment may not accurately represent the average causal effect.
the family to be used in the underlying propensity model.
By default, this is set to binomial
.
(optional) use calculated propensity scores for the weights. If using standardized weights, the numerator will still be modeled.
a boolean indicator to indicate the use of standardized weights. By default, this is set to true.
(optional) an integer value that indicates number of bootstrap iterations to calculate standard error. If no value is given, the standard error from the underlying linear model will be used. NOTE: when type is 'one.grid' bootstrapping is not performed. By default, this is set to 100.
the type of g-estimation to perform. It must be one of "one.grid"
or "one.linear"
for a
one parameter grid and linear mean model estimation respectively.
additional arguments that may be passed to the underlying model.
library(causaldata)
data(nhefs)
nhefs.nmv <- nhefs[which(!is.na(nhefs$wt82)), ]
nhefs.nmv$qsmk <- as.factor(nhefs.nmv$qsmk)
confounders <- c(
"sex", "race", "age", "education", "smokeintensity",
"smokeyrs", "exercise", "active", "wt71"
)
init_params(wt82_71, qsmk,
covariates = confounders,
data = nhefs.nmv
)
gest.model <- gestimation(nhefs.nmv, type = "one.linear", n.boot = 150)
gest.model$ATE.summary
Run the code above in your browser using DataLab