The caEffect action provides model-agnostic methods for estimating potential outcome means and causal effects of categorical treatments. It supports several estimation methods, including inverse probability weighting (IPW), regression adjustment (REGADJ), augmented inverse probability weighting (AIPW), and targeted maximum likelihood estimation (TMLE). This action is essential for researchers and analysts who want to assess the impact of a treatment or intervention while controlling for confounding variables.
| Parameter | Description |
|---|---|
| alpha | specifies the significance level for the construction of all confidence intervals. |
| difference | specifies causal effects to estimate on the difference scale. |
| display | specifies a list of results tables to send to the client for display. |
| freq | names the numeric variable that contains the frequency of occurrence for each observation. |
| inference | when set to True, computes standard errors and confidence intervals for the potential outcome mean and causal effect estimates. |
| method | specifies the method to use for estimating potential outcome means (POMs). |
| outcomeModel | specifies the model to use for scoring predicted counterfactual outcomes. |
| outcomeVar | specifies information about the outcome variable. |
| outputTables | lists the names of results tables to save as CAS tables on the server. |
| pom | specifies the potential outcomes to estimate. |
| pomCov | when set to True, displays a covariance matrix of the potential outcome mean estimates. |
| pomInfo | when set to True, creates a table that summarizes the potential outcome specifications. |
| scaledIPWFlag | specifies a multiple of the expected inverse probability weight of an observation that is used to flag observations that have large weights. |
| table | specifies the input data table. |
| treatVar | specifies information about the treatment variable. |
| weight | names the numeric variable to use for performing a weighted analysis of the data. |
This example creates a dataset named 'treatment_data'. It contains an outcome variable 'outcome', a treatment variable 'treatment' (with levels 'Drug A' and 'Placebo'), and two confounding covariates 'covar1' and 'covar2'. This data will be used to estimate the causal effect of the drug.
| 1 | DATA mycas.treatment_data; |
| 2 | DO i = 1 to 100; |
| 3 | covar1 = rand('UNIFORM'); |
| 4 | covar2 = rand('NORMAL', 0, 1); |
| 5 | IF (covar1 + 0.5*covar2 > 0.5) THEN treatment = 'Drug A'; |
| 6 | ELSE treatment = 'Placebo'; |
| 7 | outcome = 10 + 5*(treatment='Drug A') + 3*covar1 + 2*covar2 + rand('NORMAL', 0, 2); |
| 8 | OUTPUT; |
| 9 | END; |
| 10 | RUN; |
This example first fits a linear regression model for the outcome. Then, it uses the `caEffect` action with the REGADJ method to estimate the potential outcome means (POMs) for each treatment level. This is a straightforward way to adjust for covariates.
| 1 | PROC CAS; |
| 2 | regression.glm TABLE={name='treatment_data'}, class={'treatment'}, model={depvar='outcome', effects={'treatment', 'covar1', 'covar2'}}, store={name='reg_model', replace=true}; |
| 3 | causalanalysis.caEffect TABLE={name='treatment_data'}, method='REGADJ', treatVar={name='treatment'}, outcomeVar={name='outcome', type='CONTINUOUS'}, outcomeModel={restore={name='reg_model'}, predName='P_outcome'}, pom={{trtLev='Drug A'}, {trtLev='Placebo'}}; |
| 4 | RUN; |
This example demonstrates the AIPW method, which is doubly robust. It requires two models: one for the outcome (like in REGADJ) and one for the treatment assignment (propensity score model). This example fits both models, then uses `caEffect` to estimate the potential outcome means and the average treatment effect (ATE) by specifying the `difference` parameter. It also enables inference to compute standard errors and confidence intervals.
| 1 | PROC CAS; |
| 2 | regression.glm TABLE={name='treatment_data'}, class={'treatment'}, model={depvar='outcome', effects={'treatment', 'covar1', 'covar2'}}, store={name='out_model', replace=true}; |
| 3 | logistic TABLE={name='treatment_data'}, class={'treatment'}, model={depvar='treatment', effects={'covar1', 'covar2'}}, store={name='ps_model', replace=true}; |
| 4 | logistic.score TABLE={name='treatment_data'}, restore={name='ps_model'}, copyVars={'outcome', 'treatment', 'covar1', 'covar2'}, casout={name='scored_data', replace=true}; |
| 5 | causalanalysis.caEffect TABLE={name='scored_data'}, method='AIPW', treatVar={name='treatment'}, outcomeVar={name='outcome', type='CONTINUOUS'}, outcomeModel={restore={name='out_model'}, predName='P_outcome'}, pom={{trtLev='Drug A', trtProb='P_treatmentDrug A'}, {trtLev='Placebo', trtProb='P_treatmentPlacebo'}}, difference={{evtLev='Drug A', refLev='Placebo'}}, inference=true, pomCov=true; |
| 6 | RUN; |