Browse Source

fix: CRAN submission revision (of 1.0 to 1.1)

master
Daniel Kapla 1 year ago
parent
commit
f641f2132c
13 changed files with 73 additions and 77 deletions
  1. +12
    -8
      CVarE/DESCRIPTION
  2. +12
    -12
      CVarE/R/CVE.R
  3. +11
    -16
      CVarE/R/datasets.R
  4. +4
    -2
      CVarE/R/summary.R
  5. +6
    -6
      CVarE/man/CVarE-package.Rd
  6. +6
    -6
      CVarE/man/cve.Rd
  7. +6
    -6
      CVarE/man/cve.call.Rd
  8. +3
    -3
      CVarE/man/dataset.Rd
  9. +0
    -3
      CVarE/man/rgnorm.Rd
  10. +0
    -3
      CVarE/man/rlaplace.Rd
  11. +3
    -4
      CVarE/man/rmvnorm.Rd
  12. +5
    -6
      CVarE/man/rmvt.Rd
  13. +5
    -2
      CVarE/man/summary.cve.Rd

+ 12
- 8
CVarE/DESCRIPTION View File

@@ -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 <daniel@kapla.at>
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) <arXiv:2102.08782> and the Ensemble Conditional Variance
Estimation (ECVE) Fertl and Bura (2021) <arXiv:2102.13435> 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) <arXiv:2102.08782> and the Ensemble Conditional
Variance Estimation (ECVE) method from Fertl and Bura (2021) <arXiv:2102.13435>.
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: <daniel@kapla.at>
URL: https://git.art-ist.cc/daniel/CVE
Encoding: UTF-8
NeedsCompilation: yes
Imports: stats,mda
Imports: stats, mda
RoxygenNote: 7.0.2

+ 12
- 12
CVarE/R/CVE.R View File

@@ -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"
#' <arXiv:2102.08782>
#'
#' [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"
#' <arXiv:2102.13435>
#'
#' @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"
#' <arXiv:2102.08782>
#'
#' [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"
#' <arXiv:2102.13435>
#'
#' @importFrom stats model.frame
#' @export

+ 11
- 16
CVarE/R/datasets.R View File

@@ -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"
#' <arXiv:2102.08782>
#'
#' @import stats
#' @importFrom stats rnorm rbinom

+ 4
- 2
CVarE/R/summary.R View File

@@ -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)

+ 6
- 6
CVarE/man/CVarE-package.Rd View File

@@ -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"
<arXiv:2102.08782>

[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"
<arXiv:2102.13435>
}
\seealso{
Useful links:

+ 6
- 6
CVarE/man/cve.Rd View File

@@ -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"
<arXiv:2102.08782>

[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"
<arXiv:2102.13435>
}
\seealso{
For a detailed description of \code{formula} see

+ 6
- 6
CVarE/man/cve.call.Rd View File

@@ -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"
<arXiv:2102.08782>

[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"
<arXiv:2102.13435>
}

+ 3
- 3
CVarE/man/dataset.Rd View File

@@ -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"
<arXiv:2102.08782>
}

+ 0
- 3
CVarE/man/rgnorm.Rd View File

@@ -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}

+ 0
- 3
CVarE/man/rlaplace.Rd View File

@@ -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}

+ 3
- 4
CVarE/man/rmvnorm.Rd View File

@@ -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}

+ 5
- 6
CVarE/man/rmvt.Rd View File

@@ -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}

+ 5
- 2
CVarE/man/summary.cve.Rd View File

@@ -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)

Loading…
Cancel
Save