Description Usage Arguments Details Value Examples
Fits a regression model to the specified outcome variable
1 2 |
data |
Data frame, containing the dataset to be analyzed. The data frame must contain a treatment indicator variable called 'treat' and propensity score values called 'ps_values'. |
outcome |
String, containing the outcome variable name to be analyzed |
covariates |
Vector, containing the set of covariate variable names to include in the regression |
family |
Model family, passed through to glm. Defaults to binomial() - see ?glm for additional documentation |
w |
Vector, containing the subject weights. Defaults to equally weighted. If analysis of matched data is desired, set this value to myData$is_matched. |
This function uses the glm package to fit a regression model to the specified outcome variable. By default, the regression model will fit outcome ~ treat + ps_values. Inclusion of the PS values in the outcome model is recommended by literature producing a "doubly robust" analysis. In addition, any unbalanced covariates be included in the vector of covariate names parameter. These will also be included in the regression model. Weights for the regression model can be specified, or default to use the calculated weights in the data frame.
Object, containing fitted model values. In addition to standard glm/lm output, the treatment effect is appended to the model object as model$treatment.effect. For dichotomous outcome variables, this is the odds ratio with confidence interval.
1 2 3 4 5 | ## Not run:
ps.regression(myData, "outcome")
ps.regression(myData, "outcome", covariates, w = myData$is_matched)
## End(Not run)
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.