outcome_model: outcome_model

Description Usage Arguments Value References Examples

View source: R/outcome_model.R

Description

This function will run the outcomes model for your analysis. Upon completeion, use the model object returned from this function and call ov_simgrid to check the sensitivity of your findings.

Usage

1
2
outcome_model(ps_object = NULL, stop.method=NULL, data, weights=NULL, treatment,
outcome, model_covariates, estimand = "ATE")

Arguments

ps_object

A ps object exported from TWANG

stop.method

If the user specifies ps_object, stop.method should be used to export the weights (e.g "ks.max")

data

A data frame containing the data

weights

A column name in data that represents the relevant weights

treatment

A column name in data for the treatment indicator

outcome

A column name in data indicating the outcome vector

model_covariates

A vector of column names representing the covariates in your final outcome's model

estimand

"ATE" or "ATT"

Value

outcome_model returns a list containing the following components:

ps_object

The ps_object from TWANG specified in the function call. If ignored, this component will be NULL

stop.method

The stop method, if applicable, specified in the function call

data

the updated data frame

weights

the original vector of weights

tx

a character name in data indicating the treatment indicator

y

a character name in data indicating the outcome

outcome_mod_fmla

the final outcome model formula

estimand

The estimand specified in the function call

mod_results

an object of class "svyglm"

References

Lumley T (2020). “survey: analysis of complex survey samples.” R package version 4.0.

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
data(sud)
sud = data.frame(sud)
sud$treat = ifelse(sud$treat == "A", 1, 0)
sud$wts = sample(seq(1, 10, by=.01), size=nrow(sud), replace = TRUE)
outcome_mod = outcome_model(data = sud,
                            weights = "wts",
                            treatment = "treat",
                            outcome = "eps7p_3",
                            model_covariates = c("sfs8p_0"),
                            estimand = "ATE")

OVtool documentation built on Nov. 2, 2021, 9:07 a.m.