\documentclass[nojss]{jss}

%% need no \usepackage{Sweave}
\usepackage{thumbpdf}

%% new commands
\newcommand{\class}[1]{``\code{#1}''}
\newcommand{\fct}[1]{\code{#1()}}

\SweaveOpts{engine=R, eps=FALSE, keep.source = TRUE}
<<options, echo=FALSE>>=
options(prompt = "R> ", digits = 4, show.signif.stars = FALSE)
@
%%\VignetteIndexEntry{Applied Econometrics with R: Package Vignette and Errata}
%%\VignettePackage{AER}
%%\VignetteDepends{AER}
%%\VignetteKeywords{econometrics, statistical software, R}

\author{Christian Kleiber\\Universit\"at Basel
   \And Achim Zeileis\\Universit\"at Innsbruck}
\Plainauthor{Christian Kleiber, Achim Zeileis}
\title{Applied Econometrics with \proglang{R}:\\Package Vignette and Errata}
\Plaintitle{Applied Econometrics with R: Package Vignette and Errata}
\Shorttitle{\pkg{AER}: Package Vignette and Errata}

\Keywords{econometrics, statistical software, \proglang{R}}
\Plainkeywords{econometrics, statistical software, R}

\Abstract{
  ``Applied Econometrics with \proglang{R}''
  \citep[Springer-Verlag, ISBN~978-0-387-77316-2, pp.~vii+222]{aer:Kleiber+Zeileis:2008}
  is the first book on applied econometrics using the \proglang{R}~system
  for statistical computing and graphics \citep{aer:R:2010}. 
  It presents hands-on examples for a
  wide range of econometric models, from classical linear regression models for
  cross-section, time series or panel data and the common non-linear models of
  microeconometrics, such as logit, probit, tobit models as well as regression
  models for count data, to recent
  semiparametric extensions. In addition, it provides a chapter on programming,
  including simulations, optimization and an introduction to \proglang{R} tools
  enabling reproducible econometric research. 
  The methods are presented by illustrating, among other things, the fitting
  of wage equations, growth regressions, dynamic
  regressions and time series models as well as various models of microeconometrics.
   
  The book is accompanied by the \proglang{R} package
  \pkg{AER} \citep{aer:Kleiber+Zeileis:2010} which contains some new \proglang{R}
  functionality, some 100 data sets
  taken from a wide variety of sources, the full source code for all examples
  used in the book, as well as further worked examples, e.g., from popular textbooks.

  This vignette provides an overview of the package contents and contains
  a list of errata for the book.
}

\Address{
  Christian Kleiber\\
  Wirtschaftswissenschaftliches Zentrum (WWZ)\\
  Universit\"at Basel\\
  Peter Merian-Weg 6\\
  4002 Basel, Switzerland\\
  E-mail: \email{Christian.Kleiber@unibas.ch}\\
  URL: \url{http://wwz.unibas.ch/kleiber/}\\

  Achim Zeileis\\
  Department of Statistics\\
  Faculty of Economics and Statistics\\
  Universit\"at Innsbruck\\
  Universit\"atsstr.~15\\
  6020 Innsbruck, Austria\\
  E-mail: \email{Achim.Zeileis@R-project.org}\\
  URL: \url{http://eeecon.uibk.ac.at/~zeileis/}
}

\begin{document}

\section{Package overview}

\subsection[R code from the book]{\proglang{R} code from the book}

The full \proglang{R} code from the book is provided in the demos for the package \pkg{AER}.
The source scripts can be found in the \code{demo}
directory of the package and executed interactively by calling
\fct{demo}, as in
%
<<demo, eval=FALSE>>=
demo("Ch-Intro", package = "AER")
@
%
One demo per chapter is provided:
\begin{itemize}
  \item \code{Ch-Intro} (Chapter~1: Introduction),
  \item \code{Ch-Basics} (Chapter~2: Basics),
  \item \code{Ch-LinearRegression} (Chapter~3: Linear Regression),
  \item \code{Ch-Validation} (Chapter~4: Diagnostics and Alternative Methods of Regression),
  \item \code{Ch-Microeconometrics} (Chapter~5: Models of Microeconometrics),
  \item \code{Ch-TimeSeries} (Chapter~6: Time Series),
  \item \code{Ch-Programming} (Chapter~7: Programming Your Own Analysis).
\end{itemize}
This list of demos is also shown by \code{demo(package = "AER")}.

The same scripts are contained in the \code{tests} directory of the package
so that they are automatically checked and compared with the desired output
provided in \code{.Rout.save} files.

To make the code fully reproducible and to avoid some lengthy computations
in the daily checks, a few selected code chunks are commented out in the
scripts. Also, for technical reasons, some graphics code chunks are repeated,
once commented out and once without comments.


\subsection{Data sets}

The \pkg{AER} package includes some 100 data sets from leading applied
econometrics journals and popular econometrics textbooks. Many data sets
have been obtained from the data archives of the \emph{Journal of Applied
Econometrics} and the \emph{Journal of Business \& Economic Statistics}. 
Some of these are used in recent textbooks, among them 
\cite{aer:Baltagi:2002}, \cite{aer:Davidson+MacKinnon:2004}, \cite{aer:Greene:2003},
\cite{aer:Stock+Watson:2007}, and \cite{aer:Verbeek:2004}. In addition, we provide
all further data sets from \cite{aer:Baltagi:2002},  \cite{aer:Franses:1998},
\cite{aer:Greene:2003}, \cite{aer:Stock+Watson:2007}, and \cite{aer:Winkelmann+Boes:2009}.

Detailed information about the source of each data set, descriptions of
the variables included, and usually also examples for typical analyses
are provided on the respective manual pages. A full list of all data sets
in \pkg{AER} can be obtained via
%
<<data, eval=FALSE>>=
data(package = "AER")
@
%
In addition, manual pages corresponding to selected textbooks are available.
They list all data sets from the respective book and provide extensive
code for replicating many of the empirical examples. See, for example,
<<help, eval=FALSE>>=
help("Greene2003", package = "AER")
@
for data sets and code for \cite{aer:Greene:2003}.
Currently available manual pages are:

\begin{itemize}
  \item \code{Baltagi2002} for \cite{aer:Baltagi:2002},
  \item \code{CameronTrivedi1998} for \cite{aer:Cameron+Trivedi:1998},
  \item \code{Franses1998} for \cite{aer:Franses:1998},
  \item \code{Greene2003} for \cite{aer:Greene:2003},
  \item \code{StockWatson2007} for \cite{aer:Stock+Watson:2007}.
  \item \code{WinkelmannBoes2009} for \cite{aer:Winkelmann+Boes:2009}.
\end{itemize}


\subsection[New R functions]{New \proglang{R} functions}

\pkg{AER} provides a few new \proglang{R} functions extending
or complementing methods previously available in \proglang{R}:
\begin{itemize}
  \item \fct{tobit} is a convenience interface to \fct{survreg}
        from package \pkg{survival} for fitting tobit regressions
	to censored data. In addition to the fitting function itself,
	the usual set of accessor and extractor functions is
	provided, e.g., \fct{print}, \fct{summary}, \fct{logLik},
	etc. For more details see \code{?tobit}.
  \item \fct{ivreg} fits instrumental-variable regressions
        via two-stage least squares. It provides a formula
	interface and calls the workhorse function \fct{ivreg.fit}
	which in turn calls \fct{lm.fit} twice. In addition to the fitting functions,
	the usual set of accessor and extractor functions is
	provided, e.g., \fct{print}, \fct{summary}, \fct{anova}, etc.
	For more details see \code{?ivreg}, \code{?ivreg.fit},
	and \code{?summary.ivreg}, respectively.
  \item \fct{dispersiontest} tests the null hypothesis of
        equidispersion in Poisson regressions against the alternative
	of overdispersion and/or underdispersion. For more details
	see \code{?dispersiontest}.
\end{itemize}



\section{Errata}

The following errors have been found in the book so far.

Please report any further errors you find to us.

\begin{itemize}
  \item p.~5--9, 46--53: There are now very minor differences in the plots pertaining to
    Example~2 (Determinants of wages) in Chapter~1.1 and Chapter~2.8 (Exploratory Data Analysis with \proglang{R})
    due to a missing observation. Specifically, the version of the \code{CPS1985} data used
    for the book contained only 533~observations, the original observation~1 had been omitted inadvertently.
  \item p.~63--65, 130, 143: The function \fct{linear.hypothesis} from the \pkg{car} package has
    been renamed to \fct{linearHypothesis} starting from \pkg{car}~2.0-0. The old interface
    is currently still supported but results in a warning.
  \item p.~85--86: Due to a bug in the \code{summary()} method for ``\code{plm}'' objects,
    the degrees of freedom reported for the $F$~statistics were interchanged and thus the
    $p$~values were not correct. Therefore, the $p$~values printed in the book at the end
    of \code{summary(gr_fe)} and \code{summary(gr_re)} are not correct,
    they should both be \code{< 2.22e-16}. Using \pkg{plm} 1.1-1 or higher, the code produces
    the correct output.
  \item pp.~88--89: As of version 1.3-1 of the \pkg{plm} package, summaries of ``\code{pgmm}''
    objects provide robust standard errors by default. The output presented on pp.~88--89 is
    still available, but now requires \code{summary(empl_ab, robust = FALSE)}.   
  \item p.~92: Exercise~6 cannot be solved using \code{PSID1982} since that data set only
    contains a cross-section while Hausman-Taylor requires panel data. A panel version has
    been available in the \pkg{plm} package under the name \code{Wages}; we have now added
    \code{PSID7682} to \pkg{AER} for completeness (and consistent naming conventions).
    Use \code{PSID7682} for the exercise.
  \item p.~141: The log-likelihood for the tobit model lacked a minus sign. The correct version is
%
\[
\ell(\beta, \sigma^2) 
= \sum_{y_i > 0} \left( \log\phi\{(y_i - x_i^\top \beta)/\sigma\} - \log\sigma \right)
 + \sum_{y_i = 0} \log \Phi( - x_i^\top \beta /\sigma).
\]  
%    
  \item p.~149: The standard error (and hence the corresponding $z$~test) of \code{admin|manage}
    in the output of \code{coeftest(bank_polr)} is wrong, it should be \code{1.4744}.
    This was caused by an inconsistency between \fct{polr} and its \fct{vcov} method which
    has now been improved in the \pkg{MASS} package ($\ge$ 7.3-6).
  \item p.~169: The comment regarding the output from the Johansen test is in error.
    The null hypothesis of no cointegration is not rejected at the 10\% level. Nonetheless,
    the table corresponding to Case~2 in \citet[][p.~420]{aer:Juselius:2006} reveals that the
    trace statistic is significant at the 15\% level, thus the Johansen test weakly confirms
    the initial two-step approach.
  \item p.~179: For consistency, the GARCH code should be preceded by \code{data("MarkPound")}.
  
  \item p.~192: The likelihood for the generalized production function was in error (code and computations were correct though). 
  
The correct likelihood for the model is
%
\[
\mathcal{L} = 
\prod_{i=1}^n \left\{ \frac{1}{\sigma} \phi \left(\frac{\varepsilon_i}{\sigma}\right) \cdot \frac{1 + \theta Y_i}{Y_i} \right\} .
\]
%
giving the log-likelihood
%
\[
\ell = \sum_{i=1}^n \left\{ \log (1 + \theta Y_i) - \log Y_i \right\}
        - n \log \sigma + \sum_{i=1}^n \log \phi (\varepsilon_i/\sigma) .
\]

  \item p.~205: The reference for Henningsen (2008) should be: %% FIXME: will be package vignette
    \begin{quote}
      Henningsen A (2008). ``Demand Analysis with the Almost Ideal Demand System
      in \proglang{R}: Package \pkg{micEcon},'' Unpublished.
      URL~\url{http://CRAN.R-project.org/package=micEcon}.
    \end{quote}
\end{itemize}


\emph{Note:} Currently, all links on manual pages corresponding to data sets taken from
the Journal of Business \& Economic Statistics (JBES) archive are broken (data sets
\code{MarkPound}, and \code{RecreationDemand}). The reason is the redesign of the American
Statistical Association (ASA) website, rendering the old ASA data archive nonfunctional.
The ASA journals manager currently appears to supply data on a case-by-case basis. The problem awaits a more permanent solution.


\bibliography{aer}

\end{document}
