2
0
Fork 0

fix: CRAN submission revision (of 1.0 to 1.1)

This commit is contained in:
Daniel Kapla 2021-03-09 13:27:10 +01:00
parent ac34244094
commit f641f2132c
13 changed files with 73 additions and 77 deletions

View File

@ -1,17 +1,21 @@
Package: CVarE Package: CVarE
Type: Package Type: Package
Title: Conditional Variance Estimator for Sufficient Dimension Reduction Title: Conditional Variance Estimator for Sufficient Dimension Reduction
Version: 1.0 Version: 1.1
Date: 2021-03-05 Date: 2021-03-09
Maintainer: Daniel Kapla <daniel@kapla.at> Maintainer: Daniel Kapla <daniel@kapla.at>
Author: Daniel Kapla [aut, cph, cre], Author: Daniel Kapla [aut, cph, cre],
Lukas Fertl [aut, cph], Lukas Fertl [aut, cph],
Efstathia Bura [ctb] Efstathia Bura [ctb]
Description: Implementation of the Conditional Variance Estimation (CVE) Authors@R: c(
Fertl and Bura (2021) <arXiv:2102.08782> and the Ensemble Conditional Variance person("Daniel", "Kapla", role = c("aut", "cph", "cre"), email = "daniel@kapla.at"),
Estimation (ECVE) Fertl and Bura (2021) <arXiv:2102.13435> method. person("Lukas", "Fertl", role = c("aut", "cph")),
person("Efstathia", "Bura", role = "ctb")
CVE and ECVE are sufficient dimension reduction (SDR) methods )
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 in regressions with continuous response and predictors. CVE applies to general
additive error regression models while ECVE generalizes to non-additive error additive error regression models while ECVE generalizes to non-additive error
regression models. They operate under the assumption that the predictors can 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 URL: https://git.art-ist.cc/daniel/CVE
Encoding: UTF-8 Encoding: UTF-8
NeedsCompilation: yes NeedsCompilation: yes
Imports: stats,mda Imports: stats, mda
RoxygenNote: 7.0.2 RoxygenNote: 7.0.2

View File

@ -37,13 +37,13 @@
#' @author Daniel Kapla, Lukas Fertl, Bura Efstathia #' @author Daniel Kapla, Lukas Fertl, Bura Efstathia
#' #'
#' @references #' @references
#' [1] Fertl, L. and Bura, E. (2021), Conditional Variance #' [1] Fertl, L. and Bura, E. (2021) "Conditional Variance
#' Estimation for Sufficient Dimension Reduction. #' Estimation for Sufficient Dimension Reduction"
#' arXiv:2102.08782 #' <arXiv:2102.08782>
#' #'
#' [2] Fertl, L. and Bura, E. (2021), Ensemble Conditional Variance #' [2] Fertl, L. and Bura, E. (2021) "Ensemble Conditional Variance
#' Estimation for Sufficient Dimension Reduction. #' Estimation for Sufficient Dimension Reduction"
#' arXiv:2102.13435 #' <arXiv:2102.13435>
#' #'
#' @docType package #' @docType package
#' @useDynLib CVarE, .registration = TRUE #' @useDynLib CVarE, .registration = TRUE
@ -200,13 +200,13 @@
#' \code{\link{formula}}. #' \code{\link{formula}}.
#' #'
#' @references #' @references
#' [1] Fertl, L. and Bura, E. (2021), Conditional Variance #' [1] Fertl, L. and Bura, E. (2021) "Conditional Variance
#' Estimation for Sufficient Dimension Reduction. #' Estimation for Sufficient Dimension Reduction"
#' arXiv:2102.08782 #' <arXiv:2102.08782>
#' #'
#' [2] Fertl, L. and Bura, E. (2021), Ensemble Conditional Variance #' [2] Fertl, L. and Bura, E. (2021) "Ensemble Conditional Variance
#' Estimation for Sufficient Dimension Reduction. #' Estimation for Sufficient Dimension Reduction"
#' arXiv:2102.13435 #' <arXiv:2102.13435>
#' #'
#' @importFrom stats model.frame #' @importFrom stats model.frame
#' @export #' @export

View File

@ -10,10 +10,9 @@
#' @return a \eqn{n\times p}{n x p} matrix with samples in its rows. #' @return a \eqn{n\times p}{n x p} matrix with samples in its rows.
#' #'
#' @examples #' @examples
#' \dontrun{ #' CVarE:::rmvnorm(20, sigma = matrix(c(2, 1, 1, 2), 2))
#' rmvnorm(20, sigma = matrix(c(2, 1, 1, 2), 2)) #' CVarE:::rmvnorm(20, mu = c(3, -1, 2))
#' rmvnorm(20, mu = c(3, -1, 2)) #'
#' }
#' @keywords internal #' @keywords internal
rmvnorm <- function(n = 1, mu = rep(0, p), sigma = diag(p)) { rmvnorm <- function(n = 1, mu = rep(0, p), sigma = diag(p)) {
if (!missing(sigma)) { 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.") 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)) 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). #' 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. #' @return a \eqn{n\times p}{n x p} matrix with samples in its rows.
#' #'
#' @examples #' @examples
#' \dontrun{ #' CVarE:::rmvt(20, c(0, 1), matrix(c(3, 1, 1, 2), 2), 3)
#' 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)
#' rmvt(20, sigma = matrix(c(2, 1, 1, 2), 2), 3) #' CVarE:::rmvt(20, mu = c(3, -1, 2), df = 3)
#' rmvt(20, mu = c(3, -1, 2), 3) #'
#' }
#' @keywords internal #' @keywords internal
rmvt <- function(n = 1, mu = rep(0, p), sigma = diag(p), df = Inf) { rmvt <- function(n = 1, mu = rep(0, p), sigma = diag(p), df = Inf) {
if (!missing(sigma)) { 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}. #' @return numeric array of length \eqn{n}.
#' #'
#' @seealso https://en.wikipedia.org/wiki/Generalized_normal_distribution
#' @keywords internal #' @keywords internal
rgnorm <- function(n = 1, mu = 0, alpha = 1, beta = 1) { rgnorm <- function(n = 1, mu = 0, alpha = 1, beta = 1) {
if (alpha <= 0 | beta <= 0) { 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}. #' @return numeric array of length \eqn{n}.
#' #'
#' @seealso https://en.wikipedia.org/wiki/Laplace_distribution
#' @keywords internal #' @keywords internal
rlaplace <- function(n = 1, mu = 0, sd = 1) { rlaplace <- function(n = 1, mu = 0, sd = 1) {
U <- runif(n, -0.5, 0.5) U <- runif(n, -0.5, 0.5)
@ -201,9 +196,9 @@ rlaplace <- function(n = 1, mu = 0, sd = 1) {
#' \eqn{Var(\epsilon) = 0.25}. #' \eqn{Var(\epsilon) = 0.25}.
#' #'
#' @references #' @references
#' Fertl, L. and Bura, E. (2021), Conditional Variance #' Fertl, L. and Bura, E. (2021) "Conditional Variance
#' Estimation for Sufficient Dimension Reduction. #' Estimation for Sufficient Dimension Reduction"
#' arXiv:2102.08782 #' <arXiv:2102.08782>
#' #'
#' @import stats #' @import stats
#' @importFrom stats rnorm rbinom #' @importFrom stats rnorm rbinom

View File

@ -6,12 +6,14 @@
#' \code{\link{cve}} or \code{\link{cve.call}}. #' \code{\link{cve}} or \code{\link{cve.call}}.
#' @param ... ignored. #' @param ... ignored.
#' #'
#' @return No return value, prints human readable summary.
#'
#' @examples #' @examples
#' # create B for simulation #' # create B for simulation
#' B <- rep(1, 5) / sqrt(5) #' B <- rep(1, 5) / sqrt(5)
#' #'
#' set.seed(21) #' set.seed(21)
#' #creat predictor data x ~ N(0, I_p) #' # create predictor data x ~ N(0, I_p)
#' x <- matrix(rnorm(500), 100) #' x <- matrix(rnorm(500), 100)
#' #'
#' # simulate response variable #' # simulate response variable
@ -19,7 +21,7 @@
#' # with f(x1) = x1 and err ~ N(0, 0.25^2) #' # with f(x1) = x1 and err ~ N(0, 0.25^2)
#' y <- x %*% B + 0.25 * rnorm(100) #' 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) #' cve.obj.simple <- cve(y ~ x)
#' #'
#' summary(cve.obj.simple) #' summary(cve.obj.simple)

View File

@ -42,13 +42,13 @@ reduction estimation method that is shown to be consistent under mild
assumptions. assumptions.
} }
\references{ \references{
[1] Fertl, L. and Bura, E. (2021), Conditional Variance [1] Fertl, L. and Bura, E. (2021) "Conditional Variance
Estimation for Sufficient Dimension Reduction. Estimation for Sufficient Dimension Reduction"
arXiv:2102.08782 <arXiv:2102.08782>
[2] Fertl, L. and Bura, E. (2021), Ensemble Conditional Variance [2] Fertl, L. and Bura, E. (2021) "Ensemble Conditional Variance
Estimation for Sufficient Dimension Reduction. Estimation for Sufficient Dimension Reduction"
arXiv:2102.13435 <arXiv:2102.13435>
} }
\seealso{ \seealso{
Useful links: Useful links:

View File

@ -159,13 +159,13 @@ norm(PB - PB.w, type = 'F')
} }
\references{ \references{
[1] Fertl, L. and Bura, E. (2021), Conditional Variance [1] Fertl, L. and Bura, E. (2021) "Conditional Variance
Estimation for Sufficient Dimension Reduction. Estimation for Sufficient Dimension Reduction"
arXiv:2102.08782 <arXiv:2102.08782>
[2] Fertl, L. and Bura, E. (2021), Ensemble Conditional Variance [2] Fertl, L. and Bura, E. (2021) "Ensemble Conditional Variance
Estimation for Sufficient Dimension Reduction. Estimation for Sufficient Dimension Reduction"
arXiv:2102.13435 <arXiv:2102.13435>
} }
\seealso{ \seealso{
For a detailed description of \code{formula} see 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) coef(cve.obj.simple2, k = 1)
} }
\references{ \references{
[1] Fertl, L. and Bura, E. (2021), Conditional Variance [1] Fertl, L. and Bura, E. (2021) "Conditional Variance
Estimation for Sufficient Dimension Reduction. Estimation for Sufficient Dimension Reduction"
arXiv:2102.08782 <arXiv:2102.08782>
[2] Fertl, L. and Bura, E. (2021), Ensemble Conditional Variance [2] Fertl, L. and Bura, E. (2021) "Ensemble Conditional Variance
Estimation for Sufficient Dimension Reduction. Estimation for Sufficient Dimension Reduction"
arXiv:2102.13435 <arXiv:2102.13435>
} }

View File

@ -122,7 +122,7 @@ location 0, shape-parameter 1, and the scale-parameter is chosen such that
} }
\references{ \references{
Fertl, L. and Bura, E. (2021), Conditional Variance Fertl, L. and Bura, E. (2021) "Conditional Variance
Estimation for Sufficient Dimension Reduction. Estimation for Sufficient Dimension Reduction"
arXiv:2102.08782 <arXiv:2102.08782>
} }

View File

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

View File

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

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)} \deqn{X \sim N_p(\mu, \Sigma)}{X ~ N_p(\mu, \Sigma)}
} }
\examples{ \examples{
\dontrun{ CVarE:::rmvnorm(20, sigma = matrix(c(2, 1, 1, 2), 2))
rmvnorm(20, sigma = matrix(c(2, 1, 1, 2), 2)) CVarE:::rmvnorm(20, mu = c(3, -1, 2))
rmvnorm(20, mu = c(3, -1, 2))
}
} }
\keyword{internal} \keyword{internal}

View File

@ -2,7 +2,7 @@
% Please edit documentation in R/datasets.R % Please edit documentation in R/datasets.R
\name{rmvt} \name{rmvt}
\alias{rmvt} \alias{rmvt}
\title{Multivariate t distribution.} \title{Multivariate t Distribution.}
\usage{ \usage{
rmvt(n = 1, mu = rep(0, p), sigma = diag(p), df = Inf) 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). Random generation from multivariate t distribution (student distribution).
} }
\examples{ \examples{
\dontrun{ CVarE:::rmvt(20, c(0, 1), matrix(c(3, 1, 1, 2), 2), 3)
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)
rmvt(20, sigma = matrix(c(2, 1, 1, 2), 2), 3) CVarE:::rmvt(20, mu = c(3, -1, 2), df = 3)
rmvt(20, mu = c(3, -1, 2), 3)
}
} }
\keyword{internal} \keyword{internal}

View File

@ -12,6 +12,9 @@
\item{...}{ignored.} \item{...}{ignored.}
} }
\value{
No return value, prints human readable summary.
}
\description{ \description{
Prints a summary statistics of the \code{L} component of a \code{cve} object #' 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}.
} }
@ -20,7 +23,7 @@ Prints a summary statistics of the \code{L} component of a \code{cve} object #'
B <- rep(1, 5) / sqrt(5) B <- rep(1, 5) / sqrt(5)
set.seed(21) set.seed(21)
#creat predictor data x ~ N(0, I_p) # create predictor data x ~ N(0, I_p)
x <- matrix(rnorm(500), 100) x <- matrix(rnorm(500), 100)
# simulate response variable # simulate response variable
@ -28,7 +31,7 @@ x <- matrix(rnorm(500), 100)
# with f(x1) = x1 and err ~ N(0, 0.25^2) # with f(x1) = x1 and err ~ N(0, 0.25^2)
y <- x \%*\% B + 0.25 * rnorm(100) 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) cve.obj.simple <- cve(y ~ x)
summary(cve.obj.simple) summary(cve.obj.simple)