59 lines
1.9 KiB
R
59 lines
1.9 KiB
R
% Generated by roxygen2: do not edit by hand
|
||
% Please edit documentation in R/predict_dim.R
|
||
\name{predict_dim}
|
||
\alias{predict_dim}
|
||
\title{Estimate Dimension of Reduction Space.}
|
||
\usage{
|
||
predict_dim(object, ..., method = "CV")
|
||
}
|
||
\arguments{
|
||
\item{object}{instance of class \code{cve} (result of \code{\link{cve}},
|
||
\code{\link{cve.call}}).}
|
||
|
||
\item{...}{ignored.}
|
||
|
||
\item{method}{This parameter specify which method will be used in dimension
|
||
estimation. It provides three methods \code{'CV'} (default), \code{'elbow'},
|
||
and \code{'wilcoxon'} to estimate the dimension of the SDR.}
|
||
}
|
||
\value{
|
||
list with
|
||
\describe{
|
||
\item{}{cretirion of method for \code{k = min.dim, ..., max.dim}.}
|
||
\item{k}{estimated dimension as argmin over \eqn{k} of criterion.}
|
||
}
|
||
}
|
||
\description{
|
||
This function estimates the dimension of the mean dimension reduction space,
|
||
i.e. number of columns of \eqn{B} matrix. The default method \code{'CV'}
|
||
performs cross-validation using \code{mars}. Given
|
||
\code{k = min.dim, ..., max.dim} a cross-validation via \code{mars} is
|
||
performed on the dataset \eqn{(Y i, B_k' X_i)_{i = 1, ..., n}} where
|
||
\eqn{B_k} is the \eqn{p \times k}{p x k} dimensional CVE estimate given
|
||
\eqn{k}. The estimated SDR dimension is the \eqn{k} where the
|
||
cross-validation mean squared error is the lowest. The method \code{'elbow'}
|
||
estimates the dimension via \eqn{k = argmin_k L_n(V_{p − k})} where
|
||
\eqn{V_{p − k}} is the CVE estimate of the orthogonal columnspace of
|
||
\eqn{B_k}. Method \code{'wilcoxon'} is similar to \code{'elbow'} but finds
|
||
the minimum using the wilcoxon-test.
|
||
}
|
||
\examples{
|
||
# create B for simulation
|
||
B <- rep(1, 5) / sqrt(5)
|
||
|
||
set.seed(21)
|
||
# creat predictor data x ~ N(0, I_p)
|
||
x <- matrix(rnorm(500), 100)
|
||
|
||
# simulate response variable
|
||
# y = f(B'x) + err
|
||
# with f(x1) = x1 and err ~ N(0, 0.25^2)
|
||
y <- x \%*\% B + 0.25 * rnorm(100)
|
||
|
||
# Calculate cve for unknown k between min.dim and max.dim.
|
||
cve.obj.simple <- cve(y ~ x)
|
||
|
||
predict_dim(cve.obj.simple)
|
||
|
||
}
|