Skip to contents

Draws the estimate as a line over a shaded pointwise confidence band, a rug of the percentiles of the observed regressor, and dotted reference lines: at zero and at the reference value for link-scale curves, at zero for slope curves. Curves by group share one panel, one colour each, with a legend. Curves of a discrete regressor are drawn as points with confidence whiskers.

Usage

# S3 method for class 'panglm_effectcurve'
plot(
  x,
  xlab = attr(x, "variable"),
  ylab = NULL,
  band_col = "grey85",
  rug = TRUE,
  col = NULL,
  legend = "auto",
  ...
)

Arguments

x

a "panglm_effectcurve" object from effectcurve()

xlab, ylab

axis labels; ylab defaults to a label for the scale

band_col

colour of the confidence band (single curve)

rug

if TRUE, mark the percentiles of the observed regressor on the horizontal axis

col

colour(s) of the curve(s); black for a single curve and the Okabe-Ito palette for curves by group by default

legend

position of the legend for curves by group: "auto" (the corner of the plot least covered by the curves and bands), a keyword accepted by graphics::legend(), or FALSE for none

...

passed to graphics::plot()

Value

x, invisibly

Examples

data(copd)
fit <- panglm(fev1 ~ splines::ns(crp, 3), data = copd,
              index = c("id", "visit"), model = "within")
plot(effectcurve(fit, "crp"), band_col = "lightblue")