diff --git a/CVE/R/directions.R b/CVE/R/directions.R index 23f1b8b..b74f2bc 100644 --- a/CVE/R/directions.R +++ b/CVE/R/directions.R @@ -5,8 +5,8 @@ directions <- function(object, k, ...) { #' Computes projected training data \code{X} for given dimension `k`. #' -#' Returns \eqn{B'X}. That is the dimensional design matrix \eqn{X} on the -#' columnspace of the cve-estimate for given dimension \eqn{k}. +#' Returns \eqn{B'X}. That is, it computes the projection of the \eqn{n x p} +#' design matrix \eqn{X} on the column space of \eqn{B} of dimension \eqn{k}. #' #' @param object an object of class \code{"cve"}, usually, a result of a call to #' \code{\link{cve}} or \code{\link{cve.call}}. diff --git a/CVE/R/estimateBandwidth.R b/CVE/R/estimateBandwidth.R index d0a3326..4dbd73c 100644 --- a/CVE/R/estimateBandwidth.R +++ b/CVE/R/estimateBandwidth.R @@ -37,7 +37,6 @@ #' # calculate cve with method 'simple' for k = 1 #' set.seed(21) #' cve.obj.simple <- cve(y ~ x, k = k) -#' print(cve.obj.simple$res$'1'$h) #' print(estimate.bandwidth(x, k = k)) #' @export estimate.bandwidth <- function (X, k, nObs, version = 1L) { diff --git a/CVE/R/plot.R b/CVE/R/plot.R index 087d4b6..0c48223 100644 --- a/CVE/R/plot.R +++ b/CVE/R/plot.R @@ -2,9 +2,9 @@ #' #' Boxplots of the output \code{L} from \code{\link{cve}} over \code{k} from #' \code{min.dim} to \code{max.dim}. For given \code{k}, \code{L} corresponds -#' to \eqn{L_n(V, X_i)} where \eqn{V} is a stiefel manifold element as -#' minimizer of -#' \eqn{L_n(V)}, for further details see Fertl, L. and Bura, E. (2019). +#' to \eqn{L_n(V, X_i)} where \eqn{V} is the minimizer of \eqn{L_n(V)} where +#' \eqn{V} is an element of a Stiefel manifold (see +#' Fertl, L. and Bura, E. (2019)). #' #' @param x an object of class \code{"cve"}, usually, a result of a call to #' \code{\link{cve}} or \code{\link{cve.call}}. diff --git a/CVE/R/predict.R b/CVE/R/predict.R index 10f6049..a25defb 100644 --- a/CVE/R/predict.R +++ b/CVE/R/predict.R @@ -1,7 +1,7 @@ #' Predict method for CVE Fits. #' -#' Predict response using projected data \eqn{B'C} by fitting -#' \eqn{g(B'C) + \epsilon} using \code{\link{mars}}. +#' Predict response using projected data. The forward model \eqn{g(B' X)} is +#' estimated with \code{\link{mars}} in the \code{\pkg{mda}} package. #' #' @param object an object of class \code{"cve"}, usually, a result of a call to #' \code{\link{cve}} or \code{\link{cve.call}}. @@ -9,7 +9,7 @@ #' @param k dimension of SDR space to be used for data projection. #' @param ... further arguments passed to \code{\link{mars}}. #' -#' @return prediced response at \code{newdata}. +#' @return prediced respone(s) for \code{newdata}. #' #' @examples #' # create B for simulation diff --git a/CVE/R/predict_dim.R b/CVE/R/predict_dim.R index 3c8e4fa..e5e38f2 100644 --- a/CVE/R/predict_dim.R +++ b/CVE/R/predict_dim.R @@ -122,31 +122,32 @@ predict_dim_wilcoxon <- function(object, p.value = 0.05) { )) } -#' Estimate Dimension of Reduction Space. +#' Estimate Dimension of the Sufficient Reduction. #' -#' 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 l.o.o cross-validation using \code{mars}. Given -#' \code{k = min.dim, ..., max.dim} a cross-validation via \code{mars} is +#' This function estimates the dimension, i.e. the rank of \eqn{B}. The default +#' method \code{'CV'} performs leave-one-out (LOO) cross-validation using +#' \code{mars} as follows for \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. The #' estimated SDR dimension is the \eqn{k} where the #' cross-validation mean squared error is minimal. The method \code{'elbow'} #' estimates the dimension via \eqn{k = argmin_k L_n(V_{p - k})} where -#' \eqn{V_{p - k}} is space that is orthogonal to the columns-space of the CVE estimate of \eqn{B_k}. Method \code{'wilcoxon'} is similar to \code{'elbow'} -#' but finds the minimum using the wilcoxon-test. +#' \eqn{V_{p - k}} is the space that is orthogonal to the column space of the +#' CVE estimate of \eqn{B_k}. Method \code{'wilcoxon'} finds the minimum using +#' the Wilcoxon test. #' #' @param object an object of class \code{"cve"}, usually, a result of a call to #' \code{\link{cve}} or \code{\link{cve.call}}. -#' @param 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. +#' @param method This parameter specifies which method is used in dimension +#' estimation. It provides three options: \code{'CV'} (default), +#' \code{'elbow'} and \code{'wilcoxon'}. #' @param ... ignored. #' -#' @return list with +#' @return A \code{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.} +#' \item{}{criterion for method and \code{k = min.dim, ..., max.dim}.} +#' \item{k}{estimated dimension is the minimizer of the criterion.} #' } #' #' @examples diff --git a/CVE/R/summary.R b/CVE/R/summary.R index 84588b0..ca3c4c4 100644 --- a/CVE/R/summary.R +++ b/CVE/R/summary.R @@ -1,7 +1,6 @@ -#' Prints a summary of a \code{cve} result. +#' Prints summary statistics of the \eqn{L} \code{cve} component. #' -#' Prints a summary statistics of output \code{L} from \code{cve} for -#' \code{k = min.dim, ..., max.dim}. +#' Prints a summary statistics of the \code{L} component of a \code{cve} object #' for \code{k = min.dim, ..., max.dim}. #' #' @param object an object of class \code{"cve"}, usually, a result of a call to #' \code{\link{cve}} or \code{\link{cve.call}}. diff --git a/CVE/R/util.R b/CVE/R/util.R index c91954e..3627d51 100644 --- a/CVE/R/util.R +++ b/CVE/R/util.R @@ -1,11 +1,13 @@ -#' Draws a sample from the invariant measure on the Stiefel manifold +#' Random sample from Stiefel manifold. +#' +#' Draws a random sample from the invariant measure on the Stiefel manifold #' \eqn{S(p, q)}. #' #' @param p row dimension #' @param q col dimension -#' @return \eqn{p \times q}{p x q} semi-orthogonal matrix. +#' @return A \eqn{p \times q}{p x q} semi-orthogonal matrix. #' @examples -#' V <- rStiefel(6, 4) +#' V <- rStiefel(6, 4) #' @export rStiefel <- function(p, q) { return(qr.Q(qr(matrix(rnorm(p * q, 0, 1), p, q))))