Function that fits the BAC method of Wang, Parmigianni, Dominici (2012).
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 |
X |
Vector of the treatment |
Y |
Vector of the outcome. |
D |
Matrix or data frame where the columns correspond to all possible predictors of Y, and the rows correspond to the units. |
chains |
Number of MCMC chains. |
Nsims |
Number of posterior samples we wish to get. |
mu_priorX |
The mean of the normal prior on the coefficients of the exposure model, where the first element corresponds to the intercept, and the remaining to the coefficients of the columns in D. The length of this vector must be equal to 1 + the number of columns in D. |
mu_priorY |
The mean of the normal prior on the coefficients of the outcome model, where the first element corresponds to the intercept, the second to the exposure, and the remaining to the coefficients in from of the columns in D. The length of this vector must be equal to 2 + the number of columns in D. |
Sigma_priorX |
The covariance matrix of the normal prior on the coefficients of the exposure model. The dimension of the matrix should be equal to 1 + the number of columns in D. |
Sigma_priorY |
The covariance matrix of the normal prior on the coefficients of the outcome model. The dimension of the matrix should be equal to 2 + the number of columns in D. |
alpha_priorX |
The value of alpha in the inverse gamma prior for the residual variance of the exposure model. Defaults to 0.01. |
alpha_priorY |
The value of alpha in the inverse gamma prior for the residual variance of the outcome model. Defaults to 0.01. |
beta_priorX |
The value of beta in the inverse gamma prior for the residual variance of the exposure model. Defaults to 0.01. |
beta_priorY |
The value of beta in the inverse gamma prior for the residual variance of the outcome model. Defaults to 0.01. |
omega |
The omega parameter of the BAC prior. Defaults to 50000. |
starting_alphas |
Array of dimensions: model (exposure or outcome), chains, potential confounders. Entries 0/1 represent exclusion/inclusion of a covariate in the model. If left NULL, values are set from the prior. |
starting_coefs |
Array with the starting values of all coefficients. Dimensions are: Exposure/Outcome model, chains, and covariate (intercept, coefficient of exposure, covariates). The coefficient of exposure should be NA for the exposure model. If left NULL, values are set from the prior with variance divided by 50 ^ 2. |
starting_vars |
Array including the starting values for the residual variances. Dimensions correspond to: Exposure/Outcome model, and chains. If NULL, values are set from an inverse gamma with parameters alpha and beta set to the prior values times 200. |
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.