| Type: | Package | 
| Title: | Model Averaged Double Robust Estimation | 
| Version: | 1.0.0 | 
| Author: | Matthew Cefalu | 
| Maintainer: | Matthew Cefalu <Matthew_Cefalu@rand.org> | 
| Description: | Estimates average treatment effects using model average double robust (MA-DR) estimation. The MA-DR estimator is defined as weighted average of double robust estimators, where each double robust estimator corresponds to a specific choice of the outcome model and the propensity score model. The MA-DR estimator extend the desirable double robustness property by achieving consistency under the much weaker assumption that either the true propensity score model or the true outcome model be within a specified, possibly large, class of models. | 
| License: | GPL-3 | 
| LazyData: | TRUE | 
| RoxygenNote: | 5.0.1 | 
| NeedsCompilation: | no | 
| Packaged: | 2016-09-03 02:42:56 UTC; mcefalu | 
| Repository: | CRAN | 
| Date/Publication: | 2016-09-05 20:23:43 | 
Calculate model probabilities for the outcome models using a pseudo-MC3 algorithm
Description
This function uses a pseudo-MC3 algorithm to search the outcome model space.
Usage
OM.MA(Y, X, U, W = NULL, M = 1000, alpha = NULL, binary = F)
Arguments
| Y | vector of the outcome | 
| X | vector of the treatment (0/1) | 
| U | matrix of covariates to be considered for inclusion/exclusion | 
| W | matrix of covariates that will be included in all models (optional) | 
| M | the number of MCMC iteration | 
| alpha | vector of inclusion indicators (which columns of U) to start MCMC algorithm (optional) | 
| binary | indicator if the outcome is binary (optional) | 
Value
A list. The list contains the following named components:
| dict | a list that contains the BIC, predicted values, and estimated treatment effect from each outcome model | 
| alpha | the last model visited by the algorithm | 
| out.table | a matrix that contains the BIC and estimated treatment effect from each outcome model | 
Enumerates all possible outcome models (linear terms only)
Description
This function enumerates and fits all possible outcome models
Usage
OM.MA.enumerate(Y, X, U, W = NULL)
Arguments
| Y | vector of the outcome | 
| X | vector of the treatment indicator (0/1) | 
| U | matrix of covariates to be considered for inclusion/exclusion | 
| W | matrix of covariates that will be included in all models (optional) | 
Value
A list. The listcontains the following named components:
| dict | a list that contains the BIC, predicted values, and estimated treatment effect from each outcome model | 
| out.table | a matrix that contains the BIC and estimated treatment effect from each outcome model | 
Calculate model probabilities for the propensity score model using a pseudo-MC3 algorithm
Description
This function uses a pseudo-MC3 algorithm to search the propensity score model space.
Usage
PS.MA(X, U, W = NULL, M = 1000, alpha = NULL, master.index = NULL,
  master.dict = list())
Arguments
| X | vector of the treatment (0/1) | 
| U | matrix of covariates to be considered for inclusion/exclusion | 
| W | matrix of covariates that will be included in all models (optional) | 
| M | the number of MCMC iteration | 
| alpha | vector of inclusion indicators (which columns of U) to start MCMC algorithm (optional) | 
| master.index | indexes which columns of U should be considered for inclusion in the propensity score model (optional) | 
| master.dict | list containing information from previous propensity score model fits (optional) | 
Value
A list. The list contains the following named components:
| dict | a list that contains the BIC and estimated propensity scores from propensity score models | 
| alpha | the last model visited by the algorithm | 
| out.table | a matrix that contains the BIC from each propensity score model | 
Enumerates all possible propensity score models (linear terms only)
Description
This function enumerates and fits all possible propensity score models
Usage
PS.MA.enumerate(X, U, W = NULL)
Arguments
| X | vector of the treatment indicator (0/1) | 
| U | matrix of covariates to be considered for inclusion/exclusion | 
| W | matrix of covariates that will be included in all models (optional) | 
Value
A list. The list contains the following named components:
| dict | a list that contains the BIC and estimated propensity scores from propensity score models | 
| out.table | a matrix that contains the BIC from each propensity score model | 
Worker function that fits propensity score models
Description
This function fits propensity score models and saves necessary information
Usage
add.to.dictionary(X, U, W, alpha)
Arguments
| X | vector of the treatment (0/1) | 
| U | matrix of covariates to be considered for inclusion/exclusion | 
| W | matrix of covariates that will be included in all models (optional) | 
| alpha | vector of inclusion indicators (which columns of U) to included in the propensity score model | 
Value
A list. The list contains the following named components:
| out | a list that contains the BIC and estimated propensity scores from propensity score models | 
Worker function that fits outcome models
Description
This function fits outcome models and saves necessary information
Usage
add.to.dictionary.outcome(Y, X, U, W, alpha, binary = F)
Arguments
| Y | vector of the outcome | 
| X | vector of the treatment (0/1) | 
| U | matrix of covariates to be considered for inclusion/exclusion | 
| W | matrix of covariates that will be included in all models (optional) | 
| alpha | vector of inclusion indicators (which columns of U) to included in the propensity score model | 
| binary | indicates if the outcome is binary | 
Value
A list. The list contains the following named components:
| out | a list that contains the BIC, predicted values, and estimated treatment effect from each outcome model | 
Convert BIC to model probabilities
Description
This function transforms BIC to model probabilities
Usage
bic.to.prob(bic)
Arguments
| bic | vector of BICs | 
Value
A vector of model probabilities of the same dimension of bic
Expit (inverse logit) function
Description
This function transforms the input using the expit function
Usage
expit(x)
Arguments
| x | vector of values to apply the expit function | 
Value
A vector of the same dimension of x
Calculate model averaged double robust estimate
Description
This function estimates a model averaged double robust estimate.
Usage
madr(Y, X, U, W = NULL, M = 1000, cut = 0.95, enumerate = F,
  tau = NULL, two.stage = NULL)
Arguments
| Y | vector of the outcome | 
| X | vector of the treatment (0/1) | 
| U | matrix of covariates to be considered for inclusion/exclusion | 
| W | matrix of covariates that will be included in all models (optional) | 
| M | the number of MCMC iteration | 
| cut | cumulative probability of models to be retained for improved computational efficiency (1 retains all visited models) | 
| enumerate | indicator if all possible models should be enumerated (default: FALSE) | 
| tau | scalar value for the prior model dependence (1 is an independent prior; defaults to 0) | 
| two.stage | indicator if the two-stage procedure for calculating the model weights should be used (defaults to TRUE) | 
Value
A list. The list contains the following named components:
| madr | the model averaged double robust estimate | 
| weight.ps | a vector that contains the inclusion probability of each covariate in the propensity score model | 
| weight.om | a vector that contains the inclusion probability of each covariate in the outcome model | 
Examples
set.seed(122)
## generate data
n = 100 # number of observations
k = 4   # number of covariates
U = matrix(rnorm(n*k),n,k)
colnames(U) = paste0("U",1:k)
A = rbinom(n,1,expit(-1+.5*rowSums(U)))
Y = rnorm(n,1+A+.25*rowSums(U))
## A is confounded -- true effect is 1
lm(Y~A)
## fit ma-dr -- can enumerate models if k isnt too big
res = madr(Y=Y,X=A,U=U,enumerate=TRUE,tau=1,two.stage=FALSE) # independent prior
res
res = madr(Y=Y,X=A,U=U,enumerate=TRUE,tau=0,two.stage=TRUE) # tau=0 and using two-stage weights
res
## no need to refit madr each time when enumerating -- use summarize and specify different taus
summary(res,tau=1,two.stage=FALSE) # independent prior
summary(res,tau=0,two.stage=FALSE)
summary(res,tau=0,two.stage=TRUE) # two-stage procedure for calculating weights
## use mcmc instead of enumerating (the default)
madr(Y=Y,X=A,U=U,M=1000,cut=1) #should approximate tau=0 and two.stage=TRUE
Model averaged double robust estimate with enumeration of all possible models (linear terms only)
Description
This function enumerates all possible models and estimates a model averaged double robust estimate
Usage
madr.enumerate(Y, X, U, W = NULL, tau = 1, two.stage = F)
Arguments
| Y | vector of the outcome | 
| X | vector of the treatment indicator (0/1) | 
| U | matrix of covariates to be considered for inclusion/exclusion | 
| W | matrix of covariates that will be included in all models (optional) | 
| tau | scalar value for the prior model dependence (1 is an independent prior) | 
| two.stage | indicator if the two-stage procedure for calculating the model weights should be used | 
Value
A object of class madr.enumerate. The object contains the following named components:
| out | a matrix that contains the BIC and estimated treatment from each outcome model | 
| ps | a matrix that contains the BIC from each propensity score model | 
| dr | a matrix that contains the model-specific double robust estimates | 
| U.names | the column names of U | 
Calculate model averaged double robust estimate using a pseudo-MC3 algorithm
Description
This function uses a pseudo-MC3 algorithm to search the model space, then estimate a model averaged double robust estimate using the two-stage procedure for estimating model weights with tau=0.
Usage
madr.mcmc(Y, X, U, W = NULL, M = 1000, cut = 0.95)
Arguments
| Y | vector of the outcome | 
| X | vector of the treatment (0/1) | 
| U | matrix of covariates to be considered for inclusion/exclusion | 
| W | matrix of covariates that will be included in all models (optional) | 
| M | the number of MCMC iteration | 
| cut | cumulative probability of models to be retained for improved computational efficiency (1 retains all visited models) | 
Value
A list. The list contains the following named components:
| madr | the model averaged double robust estimate | 
| weight.ps | a vector that contains the inclusion probability of each covariate in the propensity score model | 
| weight.om | a vector that contains the inclusion probability of each covariate in the outcome model | 
Print function for madr.enumerate class
Description
This function prints results from madr.enumerate class
Usage
## S3 method for class 'madr.enumerate'
print(x, ...)
Arguments
| x | madr.enumerate object | 
| ... | ignored | 
Print function for madr.mcmc class
Description
This function prints results from madr.mcmc class
Usage
## S3 method for class 'madr.mcmc'
print(x, ...)
Arguments
| x | madr.mcmc object | 
| ... | ignored | 
Print function for summary.madr.enumerate class
Description
This function prints results from summary.madr.enumerate class
Usage
## S3 method for class 'summary.madr.enumerate'
print(x, ...)
Arguments
| x | summary.madr.enumerate object | 
| ... | ignored | 
Provides model averaged double robust estimate for different values of tau
Description
This function estimates model averaged double robust estimate for different values of tau using a madr.enumerate object
Usage
## S3 method for class 'madr.enumerate'
summary(object, tau = NULL, two.stage = NULL, ...)
Arguments
| object | madr.enumerate object | 
| tau | scalar value for the prior model dependence (1 is an independent prior; defaults to value used in madr.enumerate) | 
| two.stage | indicator if the two-stage procedure for calculating the model weights should be used (defaults to value used in madr.enumerate) | 
| ... | ignored | 
Value
A list. The list contains the following named components:
| madr | the model averaged double robust estimate | 
| weight.ps | a vector that contains the inclusion probability of each covariate in the propensity score model | 
| weight.om | a vector that contains the inclusion probability of each covariate in the outcome model | 
| tau | value of tau used in estimation | 
| two.stage | indicator if the two-stage procedure for calculating the model weights was used |