Description Usage Arguments Examples

Can be used on its own but is also useable as plotfun in
`node_pmterminal`

.

1 2 | ```
binomial_glm_plot(mod, data = NULL, plot_data = FALSE,
theme = theme_classic(), ...)
``` |

`mod` |
A model of class glm with binomial family. |

`data` |
optional data frame. If NULL the data stored in mod is used. |

`plot_data` |
should the data in form of a mosaic type plot be plotted? |

`theme` |
A ggplot2 theme. |

`...` |
ignored at the moment. |

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 | ```
set.seed(2017)
# number of observations
n <- 1000
# balanced binary treatment
# trt <- factor(rep(c("C", "A"), each = n/2),
# levels = c("C", "A"))
# unbalanced binary treatment
trt <- factor(c(rep("C", n/4), rep("A", 3*n/4)),
levels = c("C", "A"))
# some continuous variables
x1 <- rnorm(n)
x2 <- rnorm(n)
# linear predictor
lp <- -0.5 + 0.5*I(trt == "A") + 1*I(trt == "A")*I(x1 > 0)
# compute probability with inverse logit function
invlogit <- function(x) 1/(1 + exp(-x))
pr <- invlogit(lp)
# bernoulli response variable
y <- rbinom(n, 1, pr)
dat <- data.frame(y, trt, x1, x2)
# logistic regression model
mod <- glm(y ~ trt, data = dat, family = "binomial")
binomial_glm_plot(mod, plot_data = TRUE)
# logistic regression model tree
ltr <- pmtree(mod)
plot(ltr, terminal_panel = node_pmterminal(ltr,
plotfun = binomial_glm_plot,
confint = TRUE,
plot_data = TRUE))
``` |

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.