2
0
Fork 0
CVE/LaTeX/main.Rnw

153 lines
5.8 KiB
Plaintext

\documentclass[article]{jss}
\usepackage{thumbpdf, lmodern} % recommended by `JSS`
\usepackage{amsmath, amssymb, amstext}
% Configure `Sweave`
% Prevent `Sweave` to include its styles (line as is, already in `JSS` styles)
%% need no \usepackage{Sweave.sty}
%\SweaveUTF8
<<echo = FALSE>>=
options(prompt = "R> ", continue = "+ ", width = 70, useFancyQuotes = FALSE)
set.seed(1729) # taxicab number
@
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% Typesetting %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% \newcommand{\class}[1]{`\code{#1}'}
% \newcommand{\fct}[1]{\code{#1()}}
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% Operators %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\renewcommand{\t}[1]{{#1}^{T}}
\renewcommand{\epsilon}{\varepsilon}
\renewcommand{\E}{\operatorname{\mathbb{E}}}
\newcommand{\var}{\operatorname{Var}}
% \newcommand{\sd}{\operatorname{sd}}
% \newcommand{\independent}{\operatorname{\bot\!\!\!\bot}}
% \newcommand{\stiefel}[2]{\operatorname{St_{#2}}(\mathbb{R}^{#1})}
% \newcommand{\grassmann}[2]{\operatorname{Gr_{#2}}(\mathbb{R}^{#1})}
% \newcommand{\orthogonalGroup}[1]{\operatorname{O}(#1)}
% \newcommand{\argmin}{\operatorname*{arg\,min}}
% \newcommand{\argmax}{\operatorname*{arg\,max}}
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% Meta Information %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\author{Daniel Kapla\\TU Wien
\And Lukas Fertl\\TU Wien
\And Efstathia Bura\\TU Wien}
\Plainauthor{Daniel Kapla, Lukas Fertl, Efstathia Bura}
%% - \title{} in title case
%% - \Plaintitle{} without LaTeX markup (if any)
%% - \Shorttitle{} with LaTeX markup (if any), used as running title
\title{Conditional Variance Estimation With the \pkg{CVE} Package in \proglang{R}}
\Plaintitle{Conditional Variance Estimation With the CVE Package in R}
\Shorttitle{The \pkg{CVE} Package}
\Abstract{
Conditional variance estimation (CVE) is a novel sufficient dimension
reduction (SDR) method for regressions satisfying $\E(Y | X) = \E(Y | \t{B} X)$,
where $\t{B}X$ is a lower dimensional projection of the predictors. CVE,
similarly to its main competitor, the mean average variance estimation (MAVE),
is not based on inverse regression, and does not require the restrictive
linearity and constant variance conditions of moment based SDR methods. CVE
is data-driven and applies to additive error regressions with continuous
predictors and link function. Let $Y$ be a real univariate response and $X$
a real $p$-dimensional covariate vector. We assume that the dependence of
$Y$ and $X$ is modelled by
\begin{displaymath}
Y = g(\t{B}X) + \epsilon
\end{displaymath}
where $X$ is independent of $\epsilon$ with positive definite variance-covariance
matrix $\var(X) = \Sigma_X$. $\epsilon$ is a mean zero random variable with
finite $\var(\epsilon) = \E(\epsilon^2)$, $g$ is an unknown, continuous
non-constant function, and $B = (b_1 , ..., b_k)$ is a real $p \times k$
matrix of rank $k \leq p$. Without loss of generality $B$ is assumed to be
orthonormal.
}
%% - \Keywords{} with LaTeX markup, at least one required
%% - \Plainkeywords{} without LaTeX markup (if necessary)
%% - Should be comma-separated and in sentence case.
\Keywords{Dimension reduction, \proglang{R}}
\Plainkeywords{Dimension reduction, R}
%% - \Address{} of at least one author
%% - May contain multiple affiliations for each author
%% (in extra lines, separated by \emph{and}\\).
%% - May contain multiple authors for the same affiliation
%% (in the same first line, separated by comma).
\Address{
Daniel Kapla\\
Technische Universit\"at Wien\\
Institute of Statistics and Mathematical Methods in Economics\\
Faculty of Mathematics and Geoinformation\\
TU Wien, Vienna, Austria\\
E-mail: \email{daniel.kapla@tuwien.ac.at}\\
URL: \url{https://kapla.at}\\
\\
Lukas Fertl\\
Technische Universit\"at Wien\\
Institute of Statistics and Mathematical Methods in Economics\\
Faculty of Mathematics and Geoinformation\\
TU Wien, Vienna, Austria\\
E-mail: \email{lukas.fertl@tuwien.ac.at}\\
\\
Efstathia Bura\\
Technische Universit\"at Wien\\
Institute of Statistics and Mathematical Methods in Economics\\
Faculty of Mathematics and Geoinformation\\
TU Wien, Vienna, Austria
}
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% Document %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\begin{document}
\section[Introduction: Sufficient dimension reduction in R]{Introduction: Sufficient dimension reduction in \proglang{R}}\label{sec:intro}
A bit of text
<<>>=
library(CVE)
dataset <- function(n, p = 20, p.mix = 0.5, lambda = 1, sd = 0.5) {
B <- rep(1 / sqrt(p), p)
# B <- c(rep(1 / sqrt(p), p / 2), rep(-1 / sqrt(p), p / 2))
X <- matrix(rnorm(n * p), n, p)
X <- X + lambda * (2 * rbinom(n, 1, p.mix) - 1)
Y <- abs(X %*% B) + rnorm(n, 0, sd)
list(B = B, X = X, Y = Y)
}
ds <- dataset(100)
ds.test <- dataset(100)
@
Then we apply both methods, the \code{CVE} and the \code{MAVE} methods
<<>>=
fit.cve <- with(ds, cve(Y ~ X, k = 1))
fit.mave <- with(ds, MAVE::mave(Y ~ X, max.dim = 1, method = "meanMAVE"))
@
Get the estimated reduction matrices
<<>>=
B.cve <- coef(fit.cve, 1)
B.mave <- coef(fit.mave, 1)
@
and compute the prediction errors
<<>>=
Y.hat.cve <- with(ds.test, predict(fit.cve, X, 1))
Y.hat.mave <- with(ds.test, predict(fit.mave, X, 1))
# MSE - cve
mean((ds.test$Y - Y.hat.cve)^2)
# MSE - mave
mean((ds.test$Y - Y.hat.mave)^2)
@
and another bit of text
\newpage % required! Fixes vertical spacing problems with code chunks (last page)
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% Bibliography %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%% - References need to be provided in a .bib BibTeX database.
%% - All references should be made with \cite, \citet, \citep, \citealp etc.
%% - `JSS` - specific markup (\proglang, \pkg, \code) should be used in the .bib.
%% - Titles in the .bib should be in title case.
%% - DOIs should be included where available.
\bibliography{refs}
\end{document}