\documentstyle[12pt,fullpage,psfig]{article}
\setlength{\textwidth}{6in}
\setlength{\oddsidemargin}{+.25in}
\setlength{\evensidemargin}{+.25in}
\begin{document}
\begin{verbatim}
####                        S_HOUT2a.tex                    ####
####                                                        ####
####                 A VARIATION OF QQ-PLOTS                ####
####                                                        ####
####  This file is in                                       ####
####  /afs/andrew/stat/data/707/S_Hout2a.tex                ####

####  Last modified on Sept. 11, 1997.

> postscript("plot2a.ps")

This is the same data set that was used in the HW1.
The andrew file is: {\tt /afm/andrew/stat/data/707/oxygen.DAT}
Assume one called the data frame ``oxygen'', and named
the variables ``Subjects'', ``Max.Oxygen'', and
``Time.in.Seconds''.

> attach(oxygen)
\end{verbatim}

{\bf Make a quantile-normal plot of each variable.}

\begin{verbatim}
> par(mfrow=c(1,2))
> qqnorm(Max.Oxygen)
> qqline(Max.Oxygen)
> title(main="Quantile-Normal Plot of Max.Oxygen")
> qqnorm(Time.in.Seconds)
> qqline(Time.in.Seconds)
> title(main="Quantile-Normal Plot of Time.in.Seconds")
\end{verbatim}
\vspace{1cm}
\centerline{\psfig{figure=qqnorm.ps,angle=-90,width=7in,height=2.5in}}
\vspace{1cm}

{\bf Make a quantile-exponential plot of each variable.}

\bigskip
There is no built-in S-PLUS function for a quantile-exponential plot.
However, you can build one on your own with \verb|qqplot| and a couple
of other functions.  The first is \verb|qexp| (which can be found
by searching the help index for ``exponential'').  This function takes
a vector of quantiles, and looks up where they lie in an exponential
distribution, with parameter $\lambda=1$. The other function is
\verb|ppoints| (which can be found by searching the help index for
``qqplot'').  This function returns the \verb|n| quantiles which
should be used in a quantile plot. 

So the first thing to do is figure out \verb|n| (it is 24 in this case),
then get the \verb|n| plotting points, then look them up in an
exponential distribution: \verb|qexp(ppoints(24))|. The comand:
\verb|qexp(ppoints(|variable\verb|))| does the same thing.
Plot the exponential quantiles against each variable,
add appropriate titles, and you are done:

\begin{verbatim}
> length(Max.Oxygen)
[1] 24
> qqplot(qexp(ppoints(24)), Max.Oxygen,
+ xlab="Quantiles of Standard Exponential")
> title(main="Quantile-Exponential Plot of Max.Oxygen")
> qqplot(qexp(ppoints(24)),Time.in.Seconds,
+ xlab="Quantiles of Standard Exponential")
> title(main="Quantile-Exponential Plot of Time.in.Seconds")
\end{verbatim}
\centerline{\psfig{figure=qqexp.ps,angle=-90,width=7in,height=2.5in}}

\bigskip
Another approach would be to see how S-PLUS does a quantile-normal
plot (by type \verb|qqnorm.default|) and adapting it
for an exponential.  This function contains the line:
\begin{verbatim}
y <- qnorm(ppoints(length(x)))[order(order(x))]
\end{verbatim}
I do not know what the ``order'' parts are intended for, but if you ignore
them and replace \verb|qnorm| with \verb|qexp|, you will see how to
get the appropriate quantiles of an exponential distribution.


{\bf Some comments on the results.}

Both ``maximum volume of oxygen uptake'' and ``time in seconds to run two
miles'' appear closer to normally distributed than to exponentially
distributed.  However, volume of oxygen has lighter tails than the normal
distribution, and time in seconds has an outlier on the low end
(someone who ran fast).


\end{document}