Become an expert in R — Interactive courses, Cheat Sheets, certificates and more!
Get Started for Free

exHe

Small Dataset Example of He


Description

The exHe data frame has 10 rows and 2 columns. It is an example for which smooth.spline cannot be used.

Usage

data(exHe)

Format

This data frame contains the following columns:

x

only values 0, 1, and 2.

y

10 randomly generated values

Details

Xuming He wrote about this JUST FOR FUN:
I was testing COBS using the following "data". For comparison, I tried smooth.spline in S+. I never got an answer back! No warning messages either. The point is that even the well-tested algorithm like smooth.spline could leave you puzzled.

To tell you the truth, the response values here were generated by white noise. An ideal fitted curve would be a flat line. See for yourself what COBS would do in this case.

Source

Originally found at the bottom of http://ux6.cso.uiuc.edu/~x-he/ftp.html, the web resource directory of Xuming He at the time, say 2006.

See Also

Examples

data(exHe)
plot(exHe, main = "He's 10 point example and cobs() fits")
tm <- tapply(exHe$y, exHe$x, mean)
lines(unique(exHe$x), tm, lty = 2)

cH. <- with(exHe,
    cobs(x, y, degree=1, constraint = "increase"))
cH <- with(exHe,
    cobs(x, y, lambda=0.2, degree=1, constraint = "increase"))
plot(exHe)
lines(predict(cH.), type = "o", col="tomato3", pch = "i")# constant
lines(predict(cH), type = "o", col=2, pch = "i")

cHn <- cobs(exHe$x, exHe$y, degree=1, constraint = "none")
lines(predict(cHn), col= 3, type = "o", pch = "n")

cHd <- cobs(exHe$x, exHe$y, degree=1, constraint = "decrease")
lines(predict(cHd), col= 4, type = "o", pch = "d")

cobs

Constrained B-Splines (Sparse Matrix Based)

v1.3-4
GPL (>= 2)
Authors
Pin T. Ng <Pin.Ng@nau.edu> and Martin Maechler
Initial release
2020-01-20

We don't support your browser anymore

Please choose more modern alternatives, such as Google Chrome or Mozilla Firefox.