Learn R Programming

HoRM (version 0.1.3)

regressogram: Regressogram

Description

Computes and plots the regressogram for a single predictor and single response relationship. The regressogram is plotted using ggplot2.

Usage

regressogram(x, y, nbins = 10, show.bins = TRUE,
			       show.means = TRUE, show.lines = TRUE,
             x.lab = "X", y.lab = "Y", main = "TITLE")

Arguments

x

A vector of predictor values for the data. Must be the same length as y.

y

A vector of response values for the data. Must be the same length as x.

nbins

How many bins to use construction of the regressogram.

show.bins

A logical argument specifying if dashed vertical lines should be drawn at the boundaries of the bins. Default is TRUE.

show.means

A logical argument specifying if a large point should be overlayed at the midpoint of each bin and the respective mean of the response values within that bin. Default is TRUE.

show.lines

A logical argument specifying if a line should be drawn connecting the points determined by show.means. Default is TRUE.

x.lab

Label for the x-axis.

y.lab

Label for the y-axis.

main

Title for the regressogram.

Value

regressogram returns a plotted regressogram using the ggplot2 package.

References

Wasserman, L. (2006), All of Nonparametric Statistics, Springer.

Young, D. S. (2017), Handbook of Regression Methods, CRC Press.

See Also

hist

Examples

Run this code
# NOT RUN {
## Regressogram for the natural gas dataset.

data(gas)

regressogram(x = gas$LA, y = gas$OK, nbins = 6, x.lab = "LA",
             y.lab = "OK", main = "Regressogram")

# }

Run the code above in your browser using DataLab