\documentclass[a4paper]{article} %\usepackage[square, sort]{natbib} %\usepackage{fullpage} \usepackage{amsmath} \input{defs.tex} \parindent0pt \title{What to expect -- an \texttt{R} vignette for \texttt{expectreg}} \author{Fabian Sobotka, Thomas Kneib, Sabine Schnabel, Paul Eilers} \usepackage{Sweave} %%\VignetteIndexEntry{expectreg introduction} %%\VignetteDepends{expectreg} \begin{document} \maketitle \begin{abstract} \texttt{expectreg} is an \texttt{R} package for estimating expectile curves from univariate and multivariate data. Expectile curves are a valuable least squares alternative to quantile regression which is based on linear programming techniques. \texttt{expectreg} provides a number of functions for different approaches taken to estimate expectiles investigated since their introduction in \cite{NeweyPowell1987} using asymmetric least squares. \end{abstract} \section{Overview} This section offers an overview over the functions implemented in \texttt{expectreg}. It assumes that the user already installed the package successfully. <>= library(expectreg) @ <>= help(package = "expectreg") data(package = "expectreg") @ will give you a short overview about the available help files of the package as well as the data that will be provided with \texttt{expectreg}. The package includes the following functions: \begin{table}[ht] \begin{tabular}{ll} \texttt{rb}& Creates bases for a regression based on covariates\\ \texttt{demq} & Density of a special distribution developed by Roger Koenker \cite{KoenkerSolution}\\ \texttt{ebeta} & Expectiles of the beta distribution\\ \texttt{eemq} & Expectiles of a special distribution developed by Roger Koenker\\ \texttt{enorm} & Expectiles of the normal distribution \\ \texttt{eunif} & Expectiles of the uniform distribution \\ \texttt{expectreg.boost} & Expectile regression using boosting \\ \texttt{expectreg.ls} & Expectiles regression of additive models \\ \texttt{expectreg.qp} & Expectile sheets with monotonicity constraints \\ \texttt{pemq}& Distribution function for a special distribution developed by Roger Koenker\\ \texttt{qemq}& Quantile function for a special distribution developed by Roger Koenker\\ \texttt{quant.boost} & Quantile regression using boosting\\ \texttt{remq}& Random variable generated from a special distribution developed by Roger Koenker\\ \end{tabular} \end{table} \section{Expectiles in a nutshell} \subsection{Introduction to expectiles using LAWS} Asymmetric least squares or least asymmetrically weighted squares (LAWS) is a weighted generalization of ordinary least squares (OLS) estimation. LAWS minimizes \begin{eqnarray*} \label{ALS.goal} S &=& \sum_{i=1}^n w_i(p) (y_i - \mu_i(p))^2, \end{eqnarray*} with \begin{eqnarray}\label{weights} w_i(p) = \left\{ \begin{array}{ll} p & \mbox{ if } y_i > \mu_i(p)\\ 1-p & \mbox{ if } y_i \le \mu_i(p)\\ \end{array} \; \;, \right. \end{eqnarray} where $y_i$ is the response and $\mu_i(p)$ is the population expectile for different values of an asymmetry parameter $p$ with $0>= data(india) data(dutchboys) @ \texttt{india} consists of a data sample of 4000 observations with 6 variables from a 'Demographic and Health Survey' about malnutrition of children in India. Data set only contains 1/10 of the observations and some basic variables to enable first analyses. Details are given in \cite{IndiaTechReport}. \texttt{dutchboys} contains data from the Fourth Dutch growth study and includes 6848 observations on 10 variables. More information can be found in \cite{Buuren}. \subsection{Basic examples} The basic function \texttt{expectreg.ls} can be used to estimate 11 expectiles curves for different levels of asymmetry parameter $p$. The results are shown in the following graph. <>= data(dutchboys) @ <>= exp.l <- expectreg.ls(dutchboys[,3] ~ rb(dutchboys[,2],"pspline"),smooth="acv") @ \begin{center} \begin{figure}[ht] \includegraphics[width=10cm]{figures/dutchbsp_laws.pdf} \caption{Expectile curves estimated using \texttt{expectreg.ls}} \end{figure} \end{center} Due to the large number of observations in the data set crossing of curves is already unlikely to happen. Nevertheless we apply also the expectile bundle model implemented in \texttt{expectile.bundle} to this example. <>= exp.b <- expectreg.ls(dutchboys[,3] ~ rb(dutchboys[,2],"pspline"),smooth="none",estimate="bundle") @ \begin{center} \begin{figure}[ht] \includegraphics[width=10cm]{figures/dutchbsp_bundle.pdf} \caption{Expectile curves estimated using \texttt{expectreg.ls} with bundle estimate} \end{figure} \end{center} Additionally we analyze the data with the algorithm proposed in \cite{He1997} implemented in \texttt{expectile.restricted}. <>= exp.r <- expectreg.ls(dutchboys[,3] ~ rb(dutchboys[,2],"pspline"),smooth="schall",estimate="restricted") @ \begin{center} \begin{figure}[ht] \includegraphics[width=10cm]{figures/dutchbsp_rest.pdf} \caption{Expectile curves estimated using \texttt{expectreg.ls} with restricted estimate} \end{figure} \end{center} \subsection{Applied boosting} <>= exp.boost <- expectreg.boost(hgt ~ bbs(age,df=5,degree=2),dutchboys,mstop=rep(500,11)) @ \begin{center} \begin{figure}[ht] \includegraphics[width=10cm]{figures/dutchbsp_boost.pdf} \caption{Expectile curves estimated using \texttt{expectreg.boost}} \end{figure} \end{center} %\bibliographystyle{genetics} \newcommand{\noopsort}[1]{} \begin{thebibliography}{5} \expandafter\ifx\csname natexlab\endcsname\relax\def\natexlab#1{#1}\fi \bibitem[{{\sc {\noopsort{Buuren}}Van~Buuren} and {\sc Fredriks}(2001)}] {Buuren} {\sc {\noopsort{Buuren}}Van~Buuren, S.}, and {\sc A.~M. Fredriks}, 2001 Worm plot: A simple diagnostic device for modeling growth reference curves. \newblock Statistics in Medicine {\bf 20}: 1259--1277. %\bibitem[{{\sc Fenske} {\em et~al.\/}(2009){\sc Fenske}, {\sc Kneib} and {\sc % Hothorn}}]{IndiaTechReport} \bibitem[{{\sc Fenske} {\em et~al.\/}(2009)}]{IndiaTechReport} {\sc Fenske, N.}, {\sc T.~Kneib}, and {\sc T.~Hothorn}, 2009 Identifying risk factors for severe childhood malnutrition by boosting additive quantile regression. \newblock Techical Report~52, University of Munich. \bibitem[{{\sc He}(1997)}]{He1997} {\sc He, X.}, 1997 Quantile curves without crossing. \newblock The American Statistician {\bf 51}: 186--192. \bibitem[{{\sc Koenker}(1992)}]{KoenkerSolution} {\sc Koenker, R.}, 1992 When are expectiles percentiles? (solution). \newblock Economic Theory {\bf 9}: 526--527. \bibitem[{{\sc Newey} and {\sc Powell}(1987)}]{NeweyPowell1987} {\sc Newey, W.~K.}, and {\sc J.~L. Powell}, 1987 Asymmetric least squares estimation and testing. \newblock Econometrica {\bf 55}: 819--847. %\bibitem[{{\sc Schnabel} and {\sc Eilers}(2009{\natexlab{a}})}]{Schnabel_21_5} %{\sc Schnabel, S.~K.}, and {\sc P.~H.~C. Eilers}, 2009{\natexlab{a}} {An % analysis of life expectancy and economic production using expectile frontier % zones}. %\newblock Demographic Research {\bf 21}: 109--134. \bibitem[{{\sc Schnabel} and {\sc Eilers}(2009)}]{SchnabelEilers} {\sc Schnabel, S.~K.}, and {\sc P.~H.~C. Eilers}, 2009{\natexlab{b}} Optimal expectile smoothing. \newblock Computational Statistics and Data Analysis {\bf 53}: 4168--4177. \bibitem[{{\sc Schnabel} and {\sc Eilers}(2010)}]{SchnabelEilersPaper3Submitted} {\sc Schnabel, S.~K.}, and {\sc P.~H.~C. Eilers}, 2010 Non crossing expectiles and quantiles. \newblock Journal for Computational and Graphical Statistics (Submitted). \bibitem[{{\sc Sobotka} and {\sc Kneib}(2010)}]{Sobotka:2010} {\sc Sobotka, F.}, and {\sc T. Kneib}, 2010 Geoadditive Expectile Regression. \newblock Computational Statistics and Data Analysis, doi: 10.1016/j.csda.2010.11.015. \end{thebibliography} \end{document}