Description Usage Arguments Value Examples
This function will take in the observed data and estimate a treatment effect assuming a homogeneous treatment effect. y,x, and z must all be supplied, though all other parameters have pre-set values the user can proceed with unless they wish to change the prior specification. We recommend using the EB option to estimate lambda0 as results can be very sensitive to this parameter and choosing it a-priori is a difficult task. Note, however, that the EB option will take longer as it requires running multiple MCMCs instead of just one
1 2 3 |
nScans |
The number of MCMC scans to run |
burn |
The number of MCMC scans that will be dropped as a burn-in |
thin |
This number represents how many iterations between each scan that is kept |
y |
The outcome to be analyzed |
x |
An n by p matrix of potential confounders |
z |
The treatment whose causal effect is to be estimated |
z_type |
String indicating whether treatment is binary or continuous. The default value is z_type="binary", though it should be set to z_type = "continuous" if the treatment is continuous |
lambda1 |
A numeric value for lambda1 |
thetaA |
The first parameter of the beta prior on the overall sparsity level |
thetaB |
The second parameter of the beta prior on the overall sparsity level |
lambda0 |
Either a numeric value to be used for the value of lambda0 or "EB" is specified to indicate that it will be estimated via empirical Bayes |
weight |
The weight used to prioritize variables associated with treatment. This parameter has a default of NULL, and should only be used when lambdo0 is provided instead of estimated using empirical Bayes |
kMax |
The maximum number of covariates to be prioritized due to association with treatment |
A list of values that contain the treatment effect, confidence interval for the treatment effect, full posterior draws for the treatment effect, posterior means and confidence intervals for the regression coefficients for confounders, and the posterior mean of the binary variables indicating whether a covariate is important.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 | ## p can be larger than n, but we keep the number of covariates small here
## just for illustration so that the code will finish faster
## n=200 and p=200 takes ~5 minutes to run for example
n = 200
p = 20
x = matrix(rnorm(n*p), n, p)
z = rbinom(n, 1, p=pnorm(0.7*x[,1] + 0.3*x[,2]))
y = rnorm(n, mean=z + 0.3*x[,1] + 0.6*x[,2] + 0.5*x[,3], sd=1)
ssl = SSL(y=y, z=z, x=x, nScans=3000, burn=1000, thin=2)
## Output treatment effect and credible interval
print(ssl$TreatEffect)
print(ssl$TreatEffectCI)
## Print the posterior inclusion probabilities for confounders
print(ssl$gammaPostMean)
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.