2
0
Fork 0

Compare commits

..

No commits in common. "master" and "1.0" have entirely different histories.
master ... 1.0

13 changed files with 77 additions and 74 deletions

View File

@ -1,22 +1,17 @@
Package: CVarE
Type: Package
Title: Conditional Variance Estimator for Sufficient Dimension Reduction
Version: 1.1
Date: 2021-03-09
Version: 1.0
Date: 2021-03-05
Maintainer: Daniel Kapla <daniel@kapla.at>
Author: Daniel Kapla [aut, cph, cre],
Lukas Fertl [aut, cph],
Efstathia Bura [ctb]
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 CVE (Conditional Variance Estimation) method
proposed by Fertl, L. and Bura, E. (2021) <arXiv:2102.08782> and the ECVE
(Ensemble Conditional Variance Estimation) method introduced in
Fertl, L. and Bura, E. (2021) <arXiv:2102.13435>.
CVE and ECVE are sufficient dimension reduction methods
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
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
@ -29,5 +24,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

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

View File

@ -10,9 +10,10 @@
#' @return a \eqn{n\times p}{n x p} matrix with samples in its rows.
#'
#' @examples
#' CVarE:::rmvnorm(20, sigma = matrix(c(2, 1, 1, 2), 2))
#' CVarE:::rmvnorm(20, mu = c(3, -1, 2))
#'
#' \dontrun{
#' rmvnorm(20, sigma = matrix(c(2, 1, 1, 2), 2))
#' rmvnorm(20, mu = c(3, -1, 2))
#' }
#' @keywords internal
rmvnorm <- function(n = 1, mu = rep(0, p), sigma = diag(p)) {
if (!missing(sigma)) {
@ -24,10 +25,11 @@ 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).
#'
@ -42,10 +44,11 @@ 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
#' 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)
#'
#' \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)
#' }
#' @keywords internal
rmvt <- function(n = 1, mu = rep(0, p), sigma = diag(p), df = Inf) {
if (!missing(sigma)) {
@ -77,6 +80,7 @@ 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) {
@ -97,6 +101,7 @@ 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)
@ -196,9 +201,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

View File

@ -6,14 +6,12 @@
#' \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)
#' # create predictor data x ~ N(0, I_p)
#' #creat predictor data x ~ N(0, I_p)
#' x <- matrix(rnorm(500), 100)
#'
#' # simulate response variable
@ -21,7 +19,7 @@
#' # with f(x1) = x1 and err ~ N(0, 0.25^2)
#' y <- x %*% B + 0.25 * rnorm(100)
#'
#' # calculate cve for unknown reduction dimension.
#' # calculate cve for unknown k between min.dim and max.dim.
#' cve.obj.simple <- cve(y ~ x)
#'
#' summary(cve.obj.simple)

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:

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

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
}

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
}

View File

@ -21,4 +21,7 @@ numeric array of length \eqn{n}.
\description{
Random generation for generalized Normal Distribution.
}
\seealso{
https://en.wikipedia.org/wiki/Generalized_normal_distribution
}
\keyword{internal}

View File

@ -19,4 +19,7 @@ numeric array of length \eqn{n}.
\description{
Random generation for Laplace distribution.
}
\seealso{
https://en.wikipedia.org/wiki/Laplace_distribution
}
\keyword{internal}

View File

@ -21,8 +21,9 @@ Random generation for the multivariate normal distribution.
\deqn{X \sim N_p(\mu, \Sigma)}{X ~ N_p(\mu, \Sigma)}
}
\examples{
CVarE:::rmvnorm(20, sigma = matrix(c(2, 1, 1, 2), 2))
CVarE:::rmvnorm(20, mu = c(3, -1, 2))
\dontrun{
rmvnorm(20, sigma = matrix(c(2, 1, 1, 2), 2))
rmvnorm(20, mu = c(3, -1, 2))
}
}
\keyword{internal}

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,9 +25,10 @@ a \eqn{n\times p}{n x p} matrix with samples in its rows.
Random generation from multivariate t distribution (student distribution).
}
\examples{
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)
\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)
}
}
\keyword{internal}

View File

@ -12,9 +12,6 @@
\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}.
}
@ -23,7 +20,7 @@ Prints a summary statistics of the \code{L} component of a \code{cve} object #'
B <- rep(1, 5) / sqrt(5)
set.seed(21)
# create predictor data x ~ N(0, I_p)
#creat predictor data x ~ N(0, I_p)
x <- matrix(rnorm(500), 100)
# simulate response variable
@ -31,7 +28,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 reduction dimension.
# calculate cve for unknown k between min.dim and max.dim.
cve.obj.simple <- cve(y ~ x)
summary(cve.obj.simple)