View source: R/propensity_scores.R
propensity_scores | R Documentation |
'propensity_scores' builds a logistic regression with the target as the treatment variable and the covariates as the independent variables.
propensity_scores( data, f = NA, simple = pkg.env$simple, family = binomial(), ... )
data |
a data frame containing the variables in the model.
This should be the same data used in |
f |
(optional) an object of class "formula" that overrides the default parameter |
simple |
a boolean indicator to build default formula with interactions. If true, interactions will be excluded. If false, interactions will be included. By default, simple is set to false. |
family |
the family to be used in the general linear model.
By default, this is set to |
... |
additional arguments that may be passed to the underlying |
propensity_scores
returns an object of class "propensity_scores"
The functions print
, summary
, and predict
can be used to interact with
the underlying glm
model.
An object of class "propensity_scores"
is a list containing the following:
call |
the matched call. |
formula |
the formula used in the model. |
model |
the underlying glm model. |
p.scores |
the estimated propensity scores. |
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 ) p.score <- propensity_scores(nhefs.nmv) p.score
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.