plot.confound.grid: Plot a grid of x y plots split by a confounder z

View source: R/plots.R

plot.confound.gridR Documentation

Plot a grid of x y plots split by a confounder z

Description

Plot a grid of x y plots showing how a third confounding variable 'z' changes the slope.

Usage

## S3 method for class 'confound.grid'
plot(x, f, breaks=4, mains=NA,...)

Arguments

x

a data frame

f

a formula of the form "Y ~ X | confounder" with names that correspond to names of the dataframe columns.

breaks

number or vector of breaks to split the plots horizontally (across x), automatically set for factors.

mains

a vector plot title strings; defaults to the continuous->categorical break levels of 'confounder'

...

other arguments passed to 'plot'

Value

A confounding diagnostic grid of plots.

References

Simpson, E.H. (1951). "The Interpretation of Interaction in Contingency Tables". Journal of the Royal Statiatical Soceity, Series B. 13(2) p. 238-241.

Examples


# Swiss Fertility dataset confounding example
plot.confound.grid(x=swiss, f="Infant.Mortality ~ Fertility | Education", breaks=4)

# Intertility dataset confounding example
infert$parity <- as.factor(infert$parity)
plot.confound.grid(x=infert, f="spontaneous ~ age |  parity")


caroline documentation built on July 15, 2026, 9:06 a.m.