% Generated by roxygen2: do not edit by hand % Please edit documentation in R/plot.R \name{plot.cve} \alias{plot.cve} \title{Loss distribution elbow plot.} \usage{ \method{plot}{cve}(x, ...) } \arguments{ \item{x}{Object of class \code{"cve"} (result of [\code{\link{cve}}]).} \item{...}{Pass through parameters to [\code{\link{plot}}] and [\code{\link{lines}}]} } \description{ Boxplots of the loss from \code{min.dim} to \code{max.dim} \code{k} values. } \examples{ # create B for simulation B <- cbind(rep(1, 6), (-1)^seq(6)) / sqrt(6) set.seed(21) # creat predictor data x ~ N(0, I_p) X <- matrix(rnorm(600), 100) # simulate response variable # y = f(B'x) + err # with f(x1, x2) = x1^2 + 2 x2 and err ~ N(0, 0.25^2) Y <- (X \%*\% B[, 1])^2 + 2 * X \%*\% B[, 2] + rnorm(100, 0, .1) # Create bandwidth estimation function estimate.bandwidth <- function(X, k, nObs) { n <- nrow(X) p <- ncol(X) X_c <- scale(X, center = TRUE, scale = FALSE) 2 * qchisq((nObs - 1) / (n - 1), k) * sum(X_c^2) / (n * p) } # calculate cve with method 'simple' for k = min.dim,...,max.dim cve.obj.simple <- cve(Y ~ X, h = estimate.bandwidth, nObs = sqrt(nrow(X))) # elbow plot plot(cve.obj.simple) } \seealso{ see \code{\link{par}} for graphical parameters to pass through as well as \code{\link{plot}}, the standard plot utility. }