Description Usage Arguments Value Examples

View source: R/bart_multiTrt.R

This function implements the BART method. Please use our main function causal_multi_treat.R.

1 2 3 4 5 6 7 8 9 10 11 12 | ```
bart_multiTrt(
y,
x,
trt,
discard = FALSE,
estimand = "ATE",
k = 2,
ntree = 100,
ndpost = parent.frame()$ndpost,
nskip = 1000,
reference = parent.frame()$reference_trt
)
``` |

`y` |
numeric vector for the binary outcome |

`x` |
dataframe including the treatment indicator and the covariates |

`trt` |
numeric vector for the treatment indicator |

`discard` |
discarding rules for BART method, inherited from causal_multi_treat.R |

`estimand` |
causal estimands. Please select "ATT" or "ATE" |

`k` |
For binary y, k is the number of prior standard deviations f(x) is away from +/-3. The bigger k is, the more conservative the fitting will be. |

`ntree` |
The number of trees in the sum |

`ndpost` |
The number of posterior draws returned |

`nskip` |
Number of MCMC iterations to be treated as burn in |

`reference` |
Reference group for ATT |

list with 2 elements for ATT effect. It contains

`ATT12:` |
A dataframe containing the estimation, standard error, lower and upper 95% CI for RD/RR/OR |

`ATT13:` |
A dataframe containing the estimation, standard error, lower and upper 95% CI for RD/RR/OR |

list with 3 elements for ATE effect. It contains

`ATE12:` |
A dataframe containing the estimation, standard error, lower and upper 95% CI for RD/RR/OR |

`ATE13:` |
A dataframe containing the estimation, standard error, lower and upper 95% CI for RD/RR/OR |

`ATE23:` |
A dataframe containing the estimation, standard error, lower and upper 95% CI for RD/RR/OR |

1 2 3 4 5 6 7 8 9 | ```
library(CIMTx)
set.seed(3242019)
idata = data_gen(n = 5, ratio =1,scenario = 1)
trt_ind <- as.numeric(idata$trtdat$trt_ind)
all_vars <- idata$trtdat[, -1] #exclude treatment indicator
y <- idata$Yobs
reference_trt <- 2
causal_multi_treat(y = y, x = all_vars,
trt = trt_ind, method = "BART", estimand = "ATT", discard = "No", ndpost = 10, reference_trt = 2)
``` |

Embedding an R snippet on your website

Add the following code to your website.

For more information on customizing the embed code, read Embedding Snippets.