Visualizes binned regression results from dbbinsreg. Plots dots at bin means with optional confidence intervals and/or confidence bands, and optionally overlays a smooth line if computed. Uses tinyplot for rendering but works with both plot() and tinyplot() generics.
Usage
## S3 method for class 'dbbinsreg'
plot(x, type = NULL, ci = TRUE, cb = TRUE, line = TRUE, ...)
## S3 method for class 'dbbinsreg'
tinyplot(x, type = NULL, ci = TRUE, cb = TRUE, line = TRUE, ...)
Arguments
x
A dbbinsreg object
type
The type of plot. If NULL (the default), then the type will be inferred based on the underlying object (e.g, “pointrange” for points with confidence intervals).
ci
Logical. Show confidence intervals for dots? Default is TRUE.
cb
Logical. Show confidence bands as a ribbon? Default is TRUE if available in the object.
line
Logical. Show the line overlay if available? Default is TRUE.
…
Additional arguments passed to , e.g. theme, main, file’, etc.
Examples
library("dbreg")### In-memory data ----# Like `dbreg`, we can pass in-memory R data frames to an ephemeral DuckDB# connection via the `data` argument. # Canonical binscatter: bin means (default)dbbinsreg(weight ~ Time, data = ChickWeight, nbins =10)
# For plot customization, save the model object so you can pass additional args# to (tiny)plot.dbbinsregbs =dbbinsreg(weight ~ Time, data = ChickWeight, nbins =10)plot(bs, theme ="clean", main ="A simple binscatter example")
# Alternatively: you can also set a global (tiny)plot themetinyplot::tinytheme("classic")# Piecewise linear (p = 1), no smoothness (s = 0)dbbinsreg(weight ~ Time, data = ChickWeight, nbins =10, points =c(1, 0))