-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathREADME.Rmd
More file actions
72 lines (58 loc) · 2.34 KB
/
README.Rmd
File metadata and controls
72 lines (58 loc) · 2.34 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
---
output: github_document
---
<!-- README.md is generated from README.Rmd. Please edit that file -->
```{r, include = FALSE}
knitr::opts_chunk$set(
collapse = TRUE,
comment = "#>",
fig.path = "man/figures/README-",
out.width = "100%"
)
```
# plotBart
<!-- badges: start -->
[](https://github.com/priism-center/plotBart/blob/master/LICENSE.md)
[](https://lifecycle.r-lib.org/articles/stages.html#experimental)
[](https://github.com/priism-center/plotBart/actions)
[](https://github.com/priism-center/plotBart/commits/master)
[](https://www.codefactor.io/repository/github/priism-center/plotbart)
<!--[](https://codecov.io/gh/joemarlo/plotBart?branch=master)-->
<!-- badges: end -->
plotBart is a diagnostic and plotting package for [bartCause](https://github.com/vdorie/bartCause) and [thinkCausal](https://github.com/priism-center/thinkCausal_dev).
```{r example, fig.width=8, message=FALSE, warning=FALSE, out.width = "75%", fig.align="center"}
library(plotBart)
data(lalonde)
confounders <- c('age', 'educ', 'black', 'hisp', 'married', 'nodegr')
# fit BART model
model_results <- bartCause::bartc(
response = lalonde[['re78']],
treatment = lalonde[['treat']],
confounders = as.matrix(lalonde[, confounders]),
estimand = 'ate',
commonSup.rule = 'none',
verbose = FALSE,
keepTrees = TRUE
)
# plot common support
plot_common_support(.model = model_results)
# plot CATE and manipulate ggplot object
plot_CATE(
.model = model_results,
type = 'density',
ci_80 = TRUE,
ci_95 = TRUE,
.mean = TRUE
) +
labs(subtitle = 'My comments on the results') +
theme_classic()
```
## Installation
plotBart is currently in development and is available to test by installing via:
``` r
# latest release on CRAN
install.packages('plotBart')
# latest development version
# install.packages("remotes")
remotes::install_github('priism-center/plotBart)
```