diff --git a/CVarE/DESCRIPTION b/CVarE/DESCRIPTION index cc96119..8ce06c5 100644 --- a/CVarE/DESCRIPTION +++ b/CVarE/DESCRIPTION @@ -1,17 +1,21 @@ Package: CVarE Type: Package Title: Conditional Variance Estimator for Sufficient Dimension Reduction -Version: 1.0 -Date: 2021-03-05 +Version: 1.1 +Date: 2021-03-09 Maintainer: Daniel Kapla Author: Daniel Kapla [aut, cph, cre], Lukas Fertl [aut, cph], Efstathia Bura [ctb] -Description: Implementation of the Conditional Variance Estimation (CVE) - Fertl and Bura (2021) and the Ensemble Conditional Variance - Estimation (ECVE) Fertl and Bura (2021) method. - - CVE and ECVE are sufficient dimension reduction (SDR) methods +Authors@R: c( + person("Daniel", "Kapla", role = c("aut", "cph", "cre"), email = "daniel@kapla.at"), + person("Lukas", "Fertl", role = c("aut", "cph")), + person("Efstathia", "Bura", role = "ctb") + ) +Description: Implementation of the Conditional Variance Estimation (CVE) method + from Fertl and Bura (2021) and the Ensemble Conditional + Variance Estimation (ECVE) method from Fertl and Bura (2021) . + CVE and ECVE are Sufficient Dimension Reduction (SDR) methods in regressions with continuous response and predictors. CVE applies to general additive error regression models while ECVE generalizes to non-additive error regression models. They operate under the assumption that the predictors can @@ -24,5 +28,5 @@ Contact: URL: https://git.art-ist.cc/daniel/CVE Encoding: UTF-8 NeedsCompilation: yes -Imports: stats,mda +Imports: stats, mda RoxygenNote: 7.0.2 diff --git a/CVarE/R/CVE.R b/CVarE/R/CVE.R index 8a868b6..d4be062 100644 --- a/CVarE/R/CVE.R +++ b/CVarE/R/CVE.R @@ -37,13 +37,13 @@ #' @author Daniel Kapla, Lukas Fertl, Bura Efstathia #' #' @references -#' [1] Fertl, L. and Bura, E. (2021), Conditional Variance -#' Estimation for Sufficient Dimension Reduction. -#' arXiv:2102.08782 +#' [1] Fertl, L. and Bura, E. (2021) "Conditional Variance +#' Estimation for Sufficient Dimension Reduction" +#' #' -#' [2] Fertl, L. and Bura, E. (2021), Ensemble Conditional Variance -#' Estimation for Sufficient Dimension Reduction. -#' arXiv:2102.13435 +#' [2] Fertl, L. and Bura, E. (2021) "Ensemble Conditional Variance +#' Estimation for Sufficient Dimension Reduction" +#' #' #' @docType package #' @useDynLib CVarE, .registration = TRUE @@ -200,13 +200,13 @@ #' \code{\link{formula}}. #' #' @references -#' [1] Fertl, L. and Bura, E. (2021), Conditional Variance -#' Estimation for Sufficient Dimension Reduction. -#' arXiv:2102.08782 +#' [1] Fertl, L. and Bura, E. (2021) "Conditional Variance +#' Estimation for Sufficient Dimension Reduction" +#' #' -#' [2] Fertl, L. and Bura, E. (2021), Ensemble Conditional Variance -#' Estimation for Sufficient Dimension Reduction. -#' arXiv:2102.13435 +#' [2] Fertl, L. and Bura, E. (2021) "Ensemble Conditional Variance +#' Estimation for Sufficient Dimension Reduction" +#' #' #' @importFrom stats model.frame #' @export diff --git a/CVarE/R/datasets.R b/CVarE/R/datasets.R index 7ff4532..e2568bd 100644 --- a/CVarE/R/datasets.R +++ b/CVarE/R/datasets.R @@ -10,10 +10,9 @@ #' @return a \eqn{n\times p}{n x p} matrix with samples in its rows. #' #' @examples -#' \dontrun{ -#' rmvnorm(20, sigma = matrix(c(2, 1, 1, 2), 2)) -#' rmvnorm(20, mu = c(3, -1, 2)) -#' } +#' CVarE:::rmvnorm(20, sigma = matrix(c(2, 1, 1, 2), 2)) +#' CVarE:::rmvnorm(20, mu = c(3, -1, 2)) +#' #' @keywords internal rmvnorm <- function(n = 1, mu = rep(0, p), sigma = diag(p)) { if (!missing(sigma)) { @@ -25,11 +24,10 @@ rmvnorm <- function(n = 1, mu = rep(0, p), sigma = diag(p)) { stop("At least one of 'mu' or 'sigma' must be supplied.") } - # See: https://en.wikipedia.org/wiki/Multivariate_normal_distribution return(rep(mu, each = n) + matrix(rnorm(n * p), n) %*% chol(sigma)) } -#' Multivariate t distribution. +#' Multivariate t Distribution. #' #' Random generation from multivariate t distribution (student distribution). #' @@ -44,11 +42,10 @@ rmvnorm <- function(n = 1, mu = rep(0, p), sigma = diag(p)) { #' @return a \eqn{n\times p}{n x p} matrix with samples in its rows. #' #' @examples -#' \dontrun{ -#' rmvt(20, c(0, 1), matrix(c(3, 1, 1, 2), 2), 3) -#' rmvt(20, sigma = matrix(c(2, 1, 1, 2), 2), 3) -#' rmvt(20, mu = c(3, -1, 2), 3) -#' } +#' CVarE:::rmvt(20, c(0, 1), matrix(c(3, 1, 1, 2), 2), 3) +#' CVarE:::rmvt(20, sigma = matrix(c(2, 1, 1, 2), 2), df = 3) +#' CVarE:::rmvt(20, mu = c(3, -1, 2), df = 3) +#' #' @keywords internal rmvt <- function(n = 1, mu = rep(0, p), sigma = diag(p), df = Inf) { if (!missing(sigma)) { @@ -80,7 +77,6 @@ rmvt <- function(n = 1, mu = rep(0, p), sigma = diag(p), df = Inf) { #' #' @return numeric array of length \eqn{n}. #' -#' @seealso https://en.wikipedia.org/wiki/Generalized_normal_distribution #' @keywords internal rgnorm <- function(n = 1, mu = 0, alpha = 1, beta = 1) { if (alpha <= 0 | beta <= 0) { @@ -101,7 +97,6 @@ rgnorm <- function(n = 1, mu = 0, alpha = 1, beta = 1) { #' #' @return numeric array of length \eqn{n}. #' -#' @seealso https://en.wikipedia.org/wiki/Laplace_distribution #' @keywords internal rlaplace <- function(n = 1, mu = 0, sd = 1) { U <- runif(n, -0.5, 0.5) @@ -201,9 +196,9 @@ rlaplace <- function(n = 1, mu = 0, sd = 1) { #' \eqn{Var(\epsilon) = 0.25}. #' #' @references -#' Fertl, L. and Bura, E. (2021), Conditional Variance -#' Estimation for Sufficient Dimension Reduction. -#' arXiv:2102.08782 +#' Fertl, L. and Bura, E. (2021) "Conditional Variance +#' Estimation for Sufficient Dimension Reduction" +#' #' #' @import stats #' @importFrom stats rnorm rbinom diff --git a/CVarE/R/summary.R b/CVarE/R/summary.R index ca3c4c4..b5cd5e8 100644 --- a/CVarE/R/summary.R +++ b/CVarE/R/summary.R @@ -6,12 +6,14 @@ #' \code{\link{cve}} or \code{\link{cve.call}}. #' @param ... ignored. #' +#' @return No return value, prints human readable summary. +#' #' @examples #' # create B for simulation #' B <- rep(1, 5) / sqrt(5) #' #' set.seed(21) -#' #creat predictor data x ~ N(0, I_p) +#' # create predictor data x ~ N(0, I_p) #' x <- matrix(rnorm(500), 100) #' #' # simulate response variable @@ -19,7 +21,7 @@ #' # 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. +#' # calculate cve for unknown reduction dimension. #' cve.obj.simple <- cve(y ~ x) #' #' summary(cve.obj.simple) diff --git a/CVarE/man/CVarE-package.Rd b/CVarE/man/CVarE-package.Rd index c315ec4..a07f441 100644 --- a/CVarE/man/CVarE-package.Rd +++ b/CVarE/man/CVarE-package.Rd @@ -42,13 +42,13 @@ reduction estimation method that is shown to be consistent under mild assumptions. } \references{ -[1] Fertl, L. and Bura, E. (2021), Conditional Variance - Estimation for Sufficient Dimension Reduction. - arXiv:2102.08782 +[1] Fertl, L. and Bura, E. (2021) "Conditional Variance + Estimation for Sufficient Dimension Reduction" + - [2] Fertl, L. and Bura, E. (2021), Ensemble Conditional Variance - Estimation for Sufficient Dimension Reduction. - arXiv:2102.13435 + [2] Fertl, L. and Bura, E. (2021) "Ensemble Conditional Variance + Estimation for Sufficient Dimension Reduction" + } \seealso{ Useful links: diff --git a/CVarE/man/cve.Rd b/CVarE/man/cve.Rd index a36ddaa..f7e432d 100644 --- a/CVarE/man/cve.Rd +++ b/CVarE/man/cve.Rd @@ -159,13 +159,13 @@ norm(PB - PB.w, type = 'F') } \references{ -[1] Fertl, L. and Bura, E. (2021), Conditional Variance - Estimation for Sufficient Dimension Reduction. - arXiv:2102.08782 +[1] Fertl, L. and Bura, E. (2021) "Conditional Variance + Estimation for Sufficient Dimension Reduction" + - [2] Fertl, L. and Bura, E. (2021), Ensemble Conditional Variance - Estimation for Sufficient Dimension Reduction. - arXiv:2102.13435 + [2] Fertl, L. and Bura, E. (2021) "Ensemble Conditional Variance + Estimation for Sufficient Dimension Reduction" + } \seealso{ For a detailed description of \code{formula} see diff --git a/CVarE/man/cve.call.Rd b/CVarE/man/cve.call.Rd index a5f5e0c..3b55c11 100644 --- a/CVarE/man/cve.call.Rd +++ b/CVarE/man/cve.call.Rd @@ -192,11 +192,11 @@ coef(cve.obj.simple1, k = 1) coef(cve.obj.simple2, k = 1) } \references{ -[1] Fertl, L. and Bura, E. (2021), Conditional Variance - Estimation for Sufficient Dimension Reduction. - arXiv:2102.08782 +[1] Fertl, L. and Bura, E. (2021) "Conditional Variance + Estimation for Sufficient Dimension Reduction" + - [2] Fertl, L. and Bura, E. (2021), Ensemble Conditional Variance - Estimation for Sufficient Dimension Reduction. - arXiv:2102.13435 + [2] Fertl, L. and Bura, E. (2021) "Ensemble Conditional Variance + Estimation for Sufficient Dimension Reduction" + } diff --git a/CVarE/man/dataset.Rd b/CVarE/man/dataset.Rd index b40acca..3040df3 100644 --- a/CVarE/man/dataset.Rd +++ b/CVarE/man/dataset.Rd @@ -122,7 +122,7 @@ location 0, shape-parameter 1, and the scale-parameter is chosen such that } \references{ -Fertl, L. and Bura, E. (2021), Conditional Variance - Estimation for Sufficient Dimension Reduction. - arXiv:2102.08782 +Fertl, L. and Bura, E. (2021) "Conditional Variance + Estimation for Sufficient Dimension Reduction" + } diff --git a/CVarE/man/rgnorm.Rd b/CVarE/man/rgnorm.Rd index ed85d22..a7c39de 100644 --- a/CVarE/man/rgnorm.Rd +++ b/CVarE/man/rgnorm.Rd @@ -21,7 +21,4 @@ numeric array of length \eqn{n}. \description{ Random generation for generalized Normal Distribution. } -\seealso{ -https://en.wikipedia.org/wiki/Generalized_normal_distribution -} \keyword{internal} diff --git a/CVarE/man/rlaplace.Rd b/CVarE/man/rlaplace.Rd index 4cfcf52..ee5ee7b 100644 --- a/CVarE/man/rlaplace.Rd +++ b/CVarE/man/rlaplace.Rd @@ -19,7 +19,4 @@ numeric array of length \eqn{n}. \description{ Random generation for Laplace distribution. } -\seealso{ -https://en.wikipedia.org/wiki/Laplace_distribution -} \keyword{internal} diff --git a/CVarE/man/rmvnorm.Rd b/CVarE/man/rmvnorm.Rd index 0b53ba2..ae1b418 100644 --- a/CVarE/man/rmvnorm.Rd +++ b/CVarE/man/rmvnorm.Rd @@ -21,9 +21,8 @@ Random generation for the multivariate normal distribution. \deqn{X \sim N_p(\mu, \Sigma)}{X ~ N_p(\mu, \Sigma)} } \examples{ -\dontrun{ -rmvnorm(20, sigma = matrix(c(2, 1, 1, 2), 2)) -rmvnorm(20, mu = c(3, -1, 2)) -} +CVarE:::rmvnorm(20, sigma = matrix(c(2, 1, 1, 2), 2)) +CVarE:::rmvnorm(20, mu = c(3, -1, 2)) + } \keyword{internal} diff --git a/CVarE/man/rmvt.Rd b/CVarE/man/rmvt.Rd index 38ea6f7..ee7318d 100644 --- a/CVarE/man/rmvt.Rd +++ b/CVarE/man/rmvt.Rd @@ -2,7 +2,7 @@ % Please edit documentation in R/datasets.R \name{rmvt} \alias{rmvt} -\title{Multivariate t distribution.} +\title{Multivariate t Distribution.} \usage{ rmvt(n = 1, mu = rep(0, p), sigma = diag(p), df = Inf) } @@ -25,10 +25,9 @@ a \eqn{n\times p}{n x p} matrix with samples in its rows. Random generation from multivariate t distribution (student distribution). } \examples{ -\dontrun{ -rmvt(20, c(0, 1), matrix(c(3, 1, 1, 2), 2), 3) -rmvt(20, sigma = matrix(c(2, 1, 1, 2), 2), 3) -rmvt(20, mu = c(3, -1, 2), 3) -} +CVarE:::rmvt(20, c(0, 1), matrix(c(3, 1, 1, 2), 2), 3) +CVarE:::rmvt(20, sigma = matrix(c(2, 1, 1, 2), 2), df = 3) +CVarE:::rmvt(20, mu = c(3, -1, 2), df = 3) + } \keyword{internal} diff --git a/CVarE/man/summary.cve.Rd b/CVarE/man/summary.cve.Rd index a8964d0..e3f4636 100644 --- a/CVarE/man/summary.cve.Rd +++ b/CVarE/man/summary.cve.Rd @@ -12,6 +12,9 @@ \item{...}{ignored.} } +\value{ +No return value, prints human readable summary. +} \description{ Prints a summary statistics of the \code{L} component of a \code{cve} object #' for \code{k = min.dim, ..., max.dim}. } @@ -20,7 +23,7 @@ Prints a summary statistics of the \code{L} component of a \code{cve} object #' B <- rep(1, 5) / sqrt(5) set.seed(21) -#creat predictor data x ~ N(0, I_p) +# create predictor data x ~ N(0, I_p) x <- matrix(rnorm(500), 100) # simulate response variable @@ -28,7 +31,7 @@ x <- matrix(rnorm(500), 100) # 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. +# calculate cve for unknown reduction dimension. cve.obj.simple <- cve(y ~ x) summary(cve.obj.simple)