
\documentstyle[11pt]{article}

\title{EPP: A preprocessor for typesetting results of statistical
estimation}
\author{Ajay Shah\thanks{{\tt ajayshah@usc.edu}}}
\date{1 August 1991}

\begin{document}
\maketitle

If you have typeset results of statistical estimation in LaTeX,
you know how painful it is.  This program makes it easier.

This is a LaTeX-generator for neatly typeset (tabular) results of 
statistical estimations.  It takes a easy-to-create file
describing the estimation results, and generates LaTeX.

Some limited facilities for customising the table are given.
Obviously, you can always take the generated LaTeX as a starting
point for your own editing.

\section{Awk Versions}

\vbox{{\sc EPP} will work with
\begin{itemize}
\item	Sun's nawk
\item gawk 2.13.2
\item MKS Toolkit awk
\item Any correct implementation of new awk
\end{itemize}}

\vbox{
\noindent
It is known to not work with
\begin{itemize}
\item Sun's /bin/awk
\item gawk 2.13.0 (the floating point bug)
\item Any implementation of old awk
\end{itemize}}

\section{Input to {\sc EPP}}

{\sc EPP} takes as input a file organised as follows.  
Each line in this file is a distinct entity.  Four kinds of 
lines are understood:

\begin{enumerate}
\item a blank line (inbed in the table)
\item a descriptive comment (inbed among parameter estimates)
\item a parameter estimate,
\item The table caption.
\end{enumerate}

\noindent
The first field on each line of input determines the line type. 
The options are:

\begin{itemize}
\item[{\tt comment}]
		This line appears in the generated table as a comment
\item[{\tt estimate}]
		This line appears in the generated table as a parameter
		estimate
\item[{\tt caption}]
		This line is the table caption
\item[{\tt blank}]
		A extra blank line in the table.
\end{itemize}

\noindent
Only the first two letters are matched, so these shortforms are 
allowed: {\tt co, es, ca, bl}.)
On comment lines and on the caption line, the remaining fields are 
treated as words which make up the comment/caption.

\vbox{
On parameter lines, there are three more pieces of information:

\begin{itemize}
\item[Field 2] label (a string with no spaces in it)
\item[Field 3] free or not (Was it being estimated?)
\item[Field 4] parameter estimate
\item[Field 5] standard error (need not be present when it was not free)
\end{itemize}}

\section{Running {\tt epp2tex.nawk}}

When the time comes to generate the table, you have two more
controls: 

\begin{enumerate}
\item do you want the t-statistic 
		to be computed and displayed?
\item do you want the ``free or not'' to be shown?
\end{enumerate}

\noindent
By default, both are off (i.e., if you do nothing, neither will
appear).

The command

\begin{verbatim}
     nawk -f epp2tex.nawk putt=1 demo.epp > table.tex
\end{verbatim}

\noindent
will read the input in ``demo.epp'' and generate table.tex,
where t-statistics are also computed and displayed.

The command

\begin{verbatim}
     nawk -f epp2tex.nawk putt=1 putfree=1 demo.epp > table.tex
\end{verbatim}

\noindent
will read the input in ``demo.epp'' and generate table.tex,
where t-statistics are computed+displayed and the ``free''
status for each parameter is shown.

Using defaults, the command

\begin{verbatim}
     nawk -f epp2tex.nawk demo.epp > table.tex
\end{verbatim}

\noindent
will typeset the table without showing ``free'' and t-statistics.

The syntax for initialising variables on the commandline is
slightly different depending on whether you're using gawk
or nawk.  Thus instead of saying

\begin{verbatim}
     nawk -f epp2tex.nawk putt=1 demo.epp
\end{verbatim}

you would say

\begin{verbatim}
     gawk -f epp2tex.nawk -v putt=1 demo.epp
\end{verbatim}

\section{Examples}

{\sc EPP} is best understood through examples.  We present
a few examples here.

\subsection{Example 1}

Given this input:

\vbox{
\small \begin{verbatim}
caption Estimates with Bequest Disabled, LogL = -108435
comment Utility Parameters
estimate $\beta$ yes -9.209 0.0286
estimate $\tau$ no -6.000
estimate $\rho$ yes -1.078 0.0288
estimate $\delta$ no -2.303
estimate $\theta$ no -9.000
estimate $\xi$ no -9.000
blank
comment Initial Assets Model
estimate Intercept($A_0$) yes 10.802 0.0290
estimate med\_lt yes -0.598 0.0312
estimate med\_gt yes 0.258 0.0366
estimate black yes -0.938 0.0348
estimate $\sigma_{A_0}$ yes 0.938 0.0081
blank
comment Measurement Error
estimate $\sigma_v$ yes 0.867 0.0036
\end{verbatim} \normalsize}

\noindent
and this nawk command:

\begin{verbatim}
     nawk -f epp2tex.nawk demo.epp > epp.out
\end{verbatim}

\noindent we get

\newpage

\begin{table}[h]
\centering
\begin{tabular}{|llrr|} \hline
\multicolumn{4} {|l|} {} \\
  \multicolumn{1} {|l} {} & {Parameter}
& \multicolumn{1} {c}  {Estimate}
& \multicolumn{1} {c|}  {Standard Error}\\
\multicolumn{4}{|l|} {} \\ \hline
\multicolumn{4}{|l|} {} \\
\multicolumn{4}{|l|} {{\sf Utility Parameters }}\\
{} & {$\beta$} & {-9.209} & {0.0286}\\
{} & {$\tau$} & {-6.000} & {}\\
{} & {$\rho$} & {-1.078} & {0.0288}\\
{} & {$\delta$} & {-2.303} & {}\\
{} & {$\theta$} & {-9.000} & {}\\
{} & {$\xi$} & {-9.000} & {}\\
\multicolumn{4}{|l|} {} \\
\multicolumn{4}{|l|} {{\sf Initial Assets Model }}\\
{} & {Intercept($A_0$)} & {10.802} & {0.0290}\\
{} & {med\_lt} & {-0.598} & {0.0312}\\
{} & {med\_gt} & {0.258} & {0.0366}\\
{} & {black} & {-0.938} & {0.0348}\\
{} & {$\sigma_{A_0}$} & {0.938} & {0.0081}\\
\multicolumn{4}{|l|} {} \\
\multicolumn{4}{|l|} {{\sf Measurement Error }}\\
{} & {$\sigma_v$} & {0.867} & {0.0036}\\
\multicolumn{4}{|l|} {}\\\hline
\end{tabular}
\caption{Estimates with Bequest Disabled, LogL = -108435 }
\end{table}

\newpage
Using this same input, but with the nawk command

\begin{verbatim}
     nawk -f epp2tex.nawk putfree=1 demo.epp > epp.out
\end{verbatim}

\noindent we get

\begin{table}[h]
\centering
\begin{tabular}{|llcrr|} \hline
\multicolumn{5} {|l|} {} \\
  \multicolumn{1} {|l} {} & {Parameter}
& \multicolumn{1} {c}  {Free?}
& \multicolumn{1} {c}  {Estimate}
& \multicolumn{1} {c|}  {Standard Error}\\
\multicolumn{5}{|l|} {} \\ \hline
\multicolumn{5}{|l|} {} \\
\multicolumn{5}{|l|} {{\sf Utility Parameters }}\\
{} & {$\beta$} & {Yes} & {-9.209} & {0.0286}\\
{} & {$\tau$} & {No} & {-6.000} & {}\\
{} & {$\rho$} & {Yes} & {-1.078} & {0.0288}\\
{} & {$\delta$} & {No} & {-2.303} & {}\\
{} & {$\theta$} & {No} & {-9.000} & {}\\
{} & {$\xi$} & {No} & {-9.000} & {}\\
\multicolumn{5}{|l|} {} \\
\multicolumn{5}{|l|} {{\sf Initial Assets Model }}\\
{} & {Intercept($A_0$)} & {Yes} & {10.802} & {0.0290}\\
{} & {med\_lt} & {Yes} & {-0.598} & {0.0312}\\
{} & {med\_gt} & {Yes} & {0.258} & {0.0366}\\
{} & {black} & {Yes} & {-0.938} & {0.0348}\\
{} & {$\sigma_{A_0}$} & {Yes} & {0.938} & {0.0081}\\
\multicolumn{5}{|l|} {} \\
\multicolumn{5}{|l|} {{\sf Measurement Error }}\\
{} & {$\sigma_v$} & {Yes} & {0.867} & {0.0036}\\
\multicolumn{5}{|l|} {}\\\hline
\end{tabular}
\caption{Estimates with Bequest Disabled, LogL = -108435 }
\end{table}

\newpage
Using this same input but with the nawk command

\begin{verbatim}
     nawk -f epp2tex.nawk putt=1 demo.epp > epp.out
\end{verbatim}

\noindent we get 

\begin{table}[h]
\centering
\begin{tabular}{|llrrr|} \hline
\multicolumn{5} {|l|} {} \\
  \multicolumn{1} {|l} {} & {Parameter}
& \multicolumn{1} {c}  {Estimate}
& \multicolumn{1} {c}  {Standard Error}
& \multicolumn{1} {c|}  {t-statistic} \\
\multicolumn{5}{|l|} {} \\ \hline
\multicolumn{5}{|l|} {} \\
\multicolumn{5}{|l|} {{\sf Utility Parameters }}\\
{} & {$\beta$} & {-9.209} & {0.0286} & {-321.993} \\
{} & {$\tau$} & {-6.000} & {} & {} \\
{} & {$\rho$} & {-1.078} & {0.0288} & {-37.4306} \\
{} & {$\delta$} & {-2.303} & {} & {} \\
{} & {$\theta$} & {-9.000} & {} & {} \\
{} & {$\xi$} & {-9.000} & {} & {} \\
\multicolumn{5}{|l|} {} \\
\multicolumn{5}{|l|} {{\sf Initial Assets Model }}\\
{} & {Intercept($A_0$)} & {10.802} & {0.0290} & {372.483} \\
{} & {med\_lt} & {-0.598} & {0.0312} & {-19.1667} \\
{} & {med\_gt} & {0.258} & {0.0366} & {7.04918} \\
{} & {black} & {-0.938} & {0.0348} & {-26.954} \\
{} & {$\sigma_{A_0}$} & {0.938} & {0.0081} & {115.802} \\
\multicolumn{5}{|l|} {} \\
\multicolumn{5}{|l|} {{\sf Measurement Error }}\\
{} & {$\sigma_v$} & {0.867} & {0.0036} & {240.833} \\
\multicolumn{5}{|l|} {}\\\hline
\end{tabular}
\caption{Estimates with Bequest Disabled, LogL = -108435 }
\end{table}

\newpage
\noindent
Finally, using this same input but with the nawk command

\begin{verbatim}
     nawk -f epp2tex.nawk putfree=1 putt=1 demo.epp > epp.out
\end{verbatim}

\noindent we get

\begin{table}[h]
\centering
\begin{tabular}{|llcrrr|} \hline
\multicolumn{6} {|l|} {} \\
  \multicolumn{1} {|l} {} & {Parameter}
& \multicolumn{1} {c}  {Free?}
& \multicolumn{1} {c}  {Estimate}
& \multicolumn{1} {c}  {Standard Error}
& \multicolumn{1} {c|}  {t-statistic} \\
\multicolumn{6}{|l|} {} \\ \hline
\multicolumn{6}{|l|} {} \\
\multicolumn{6}{|l|} {{\sf Utility Parameters }}\\
{} & {$\beta$} & {Yes} & {-9.209} & {0.0286} & {-321.993} \\
{} & {$\tau$} & {No} & {-6.000} & {} & {} \\
{} & {$\rho$} & {Yes} & {-1.078} & {0.0288} & {-37.4306} \\
{} & {$\delta$} & {No} & {-2.303} & {} & {} \\
{} & {$\theta$} & {No} & {-9.000} & {} & {} \\
{} & {$\xi$} & {No} & {-9.000} & {} & {} \\
\multicolumn{6}{|l|} {} \\
\multicolumn{6}{|l|} {{\sf Initial Assets Model }}\\
{} & {Intercept($A_0$)} & {Yes} & {10.802} & {0.0290} & {372.483} \\
{} & {med\_lt} & {Yes} & {-0.598} & {0.0312} & {-19.1667} \\
{} & {med\_gt} & {Yes} & {0.258} & {0.0366} & {7.04918} \\
{} & {black} & {Yes} & {-0.938} & {0.0348} & {-26.954} \\
{} & {$\sigma_{A_0}$} & {Yes} & {0.938} & {0.0081} & {115.802} \\
\multicolumn{6}{|l|} {} \\
\multicolumn{6}{|l|} {{\sf Measurement Error }}\\
{} & {$\sigma_v$} & {Yes} & {0.867} & {0.0036} & {240.833} \\
\multicolumn{6}{|l|} {}\\\hline
\end{tabular}
\caption{Estimates with Bequest Disabled, LogL = -108435 }
\end{table}
\newpage

\subsection{Example 2}

This shows {\sc EPP} being used for typesetting the results of
an {\sc OLS} estimation.

The input file is:

\vbox{
\small \begin{verbatim}
caption Typical display of results after OLS
comment Regression Coefficients
estimate $\beta$ yes -9.209 0.0286
estimate $\tau$ yes -6.000 0.234
estimate $\rho$ yes -1.078 0.0288
estimate $\delta$ yes -2.303 0.21
estimate $\theta$ yes -9.000 0.113
estimate $\xi$ yes -9.000 1.00
blank
comment Regression Standard Error
estimate $\sigma_v$ no 0.867
\end{verbatim} \normalsize}

\noindent
We issue this {\sc EPP} command:

\begin{verbatim}
     nawk -f epp2tex.nawk putt=1 ols.epp > epp.out
\end{verbatim}

Here is what {\tt epp.out} here looks like:

\vbox{
\small \begin{verbatim}
\documentstyle[11pt]{article}
\begin{document}

\begin{table}[h]
\centering
\begin{tabular}{|llrrr|} \hline
\multicolumn{5} {|l|} {} \\
  \multicolumn{1} {|l} {} & {Parameter}
& \multicolumn{1} {c}  {Estimate}
& \multicolumn{1} {c}  {Standard Error}
& \multicolumn{1} {c|}  {t-statistic} \\
\multicolumn{5}{|l|} {} \\ \hline
\multicolumn{5}{|l|} {} \\
\multicolumn{5}{|l|} {{\sf Regression Coefficients }}\\
{} & {$\beta$} & {-9.209} & {0.0286} & {-321.993} \\
{} & {$\tau$} & {-6.000} & {0.234} & {-25.641} \\
{} & {$\rho$} & {-1.078} & {0.0288} & {-37.4306} \\
{} & {$\delta$} & {-2.303} & {0.21} & {-10.9667} \\
{} & {$\theta$} & {-9.000} & {0.113} & {-79.646} \\
{} & {$\xi$} & {-9.000} & {1.00} & {-9} \\
\multicolumn{5}{|l|} {} \\
\multicolumn{5}{|l|} {{\sf Regression Standard Error }}\\
{} & {$\sigma_v$} & {0.867} & {} & {} \\
\multicolumn{5}{|l|} {}\\\hline
\end{tabular}
\caption{Typical display of results after OLS }
\end{table}
\end{document}
\end{verbatim} \normalsize}

\noindent
Here is what it looks like in print:

\newpage
\begin{table}[h]
\centering
\begin{tabular}{|llrrr|} \hline
\multicolumn{5} {|l|} {} \\
  \multicolumn{1} {|l} {} & {Parameter}
& \multicolumn{1} {c}  {Estimate}
& \multicolumn{1} {c}  {Standard Error}
& \multicolumn{1} {c|}  {t-statistic} \\
\multicolumn{5}{|l|} {} \\ \hline
\multicolumn{5}{|l|} {} \\
\multicolumn{5}{|l|} {{\sf Regression Coefficients }}\\
{} & {$\beta$} & {-9.209} & {0.0286} & {-321.993} \\
{} & {$\tau$} & {-6.000} & {0.234} & {-25.641} \\
{} & {$\rho$} & {-1.078} & {0.0288} & {-37.4306} \\
{} & {$\delta$} & {-2.303} & {0.21} & {-10.9667} \\
{} & {$\theta$} & {-9.000} & {0.113} & {-79.646} \\
{} & {$\xi$} & {-9.000} & {1.00} & {-9} \\
\multicolumn{5}{|l|} {} \\
\multicolumn{5}{|l|} {{\sf Regression Standard Error }}\\
{} & {$\sigma_v$} & {0.867} & {} & {} \\
\multicolumn{5}{|l|} {}\\\hline
\end{tabular}
\caption{Typical display of results after OLS }
\end{table}
\newpage

\section{Common Mistakes}

Remember: even if you are not using ``putfree=1'', the layout
of the input file *must* contain the third field for all
parameters, telling whether it's free or not.

epp2tex.nawk uses the new awk language, it will not work with
(the old) awk.

\end{document}

