rmse_cvs: Estimate smoothing RMSE using leave-one-out cross-validation.

Description Usage Arguments See Also Examples

View source: R/rmse.r

Description

rmse_cv computes the leave-one-out RMSE for a single vector of bandwidths, rmse_cvs computes for a multiple vectors of bandwidths, stored as a data frame.

Usage

1
2
3
rmse_cvs(x, hs = h_grid(x), ...)

rmse_cv(x, h, var = summary_vars(x)[1], ...)

Arguments

x

condensed summary table

...

other variables passed on to smooth

h,hs

for rmse_cv, a vector of bandwidths; for rmse_cv a data frame of bandwidths, as generated by h_grid.

var

variable to smooth

See Also

Other bandwidth estimation functions: best_h; h_grid

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
set.seed(1014)
# 1d -----------------------------
x <- rchallenge(1e4)
xsum <- condense(bin(x, 1 / 10))
cvs <- rmse_cvs(xsum)

if (require("ggplot2")) {
autoplot(xsum)
qplot(x, err, data = cvs, geom = "line")
xsmu <- smooth(xsum, 1.3)
autoplot(xsmu)
autoplot(peel(xsmu))
}

# 2d -----------------------------
y <- runif(1e4)
xysum <- condense(bin(x, 1 / 10), bin(y, 1 / 100))
cvs <- rmse_cvs(xysum, h_grid(xysum, 10))
if (require("ggplot2")) {
qplot(x, y, data = cvs, size = err)
}

hadley/bigvis documentation built on May 17, 2019, 9:45 a.m.