\HeaderA{PPFit}{Modelling Point Processes}{PPFit}
\aliasA{plot.ppFit}{PPFit}{plot.ppFit}
\aliasA{ppFit}{PPFit}{ppFit}
\aliasA{print.ppFit}{PPFit}{print.ppFit}
\aliasA{summary.ppFit}{PPFit}{summary.ppFit}
\keyword{models}{PPFit}
\begin{Description}\relax
A collection and description of functions to model 
point processes, PP, over a threshold, based on \R's 
'ismev' package. The parameter estimation allows to 
include generalized linear modelling, GLM, of each 
parameter.
\\

The functions are:

\Tabular{ll}{
\code{potSim} & generates data from a point process, \\
\code{potFit} & fits empirical or simulated data to a point process, \\ 
\code{print} & print method for a fitted POT object of class ..., \\
\code{plot} & plot method for a fitted GEV object, \\ 
\code{summary} & summary method for a fitted GEV object, \\     
\code{gevrlevelPlot} & k-block return level with confidence intervals. }
\end{Description}
\begin{Usage}
\begin{verbatim}
ppFit(x, threshold, npy = 365, y = NULL, mul = NULL, sigl = NULL, 
    shl = NULL, mulink = identity, siglink = identity, shlink =
    identity, method = "Nelder-Mead", maxit = 10000, ...)

## S3 method for class 'ppFit':
print(x, ...)
## S3 method for class 'ppFit':
plot(x, which = "ask", ...)
## S3 method for class 'ppFit':
summary(object, doplot = TRUE, which = "all", ...)
\end{verbatim}
\end{Usage}
\begin{Arguments}
\begin{ldescription}
\item[\code{doplot}] a logical. Should the results be plotted?

\item[\code{maxit}] [ppFit] - \\
the maximum number of iterations.

\item[\code{method}] [ppFit] - \\
The optimization method (see \code{\LinkA{optim}{optim}} for details).

\item[\code{mul, sigl, shl}] [ppFit] - \\
numeric vectors of integers, giving the columns
of \code{ydat} that contain covariates for generalized linear
modelling of the location, scale and shape parameters repectively
(or \code{NULL} (the default) if the corresponding parameter is
stationary).

\item[\code{mulink, siglink, shlink}] [ppFit] - \\
inverse link functions for generalized
linear modelling of the location, scale and shape parameters
repectively.

\item[\code{npy}] [ppFit] - \\
the number of observations per year/block.

\item[\code{object}] [summary] - \\
a fitted object of class \code{"ppFit"}.

\item[\code{threshold}] [ppFit] - \\
the threshold; a single number or a numeric
vector of the same length as \code{x}.

\item[\code{which}] [print][plot][summary] - \\
a logical for each plot, denoting which plots should be created.

\item[\code{x}] [ppFit] - \\
a numeric vector of data to be fitted.
\\{}
[print][plot] -
a fitted object of class \code{"ppFit"}.

\item[\code{y}] [ppFit] - \\
a matrix of covariates for generalized linear modelling
of the parameters (or \code{NULL} (the default) for stationary
fitting). The number of rows should be the same as the length
of \code{x}.

\item[\code{...}] [ppFit] - \\
control parameters and plot parameters optionally passed to the 
optimization and/or plot function. Parameters for the optimization
function are passed to components of the \code{control} argument of
\code{optim}.

\end{ldescription}
\end{Arguments}
\begin{Details}\relax
For non-stationary fitting it is recommended that the covariates
within the generalized linear models are (at least approximately)
centered and scaled (i.e.\ the columns of \code{ydat} should be
approximately centered and scaled).
\end{Details}
\begin{Value}
A list containing the following components. A subset of these
components are printed after the fit. If \code{show} is
\code{TRUE}, then assuming that successful convergence is
indicated, the components \code{nexc}, \code{nllh}, \code{mle}
and \code{se} are always printed.

\begin{ldescription}
\item[\code{trans}] An logical indicator for a non-stationary fit.

\item[\code{model}] A list with components \code{mul}, \code{sigl}
and \code{shl}.

\item[\code{link}] A character vector giving inverse link functions.

\item[\code{threshold}] The threshold, or vector of thresholds.

\item[\code{npy}] The number of observations per year/block.

\item[\code{nexc}] The number of data points above the threshold.

\item[\code{data}] The data that lie above the threshold. For
non-stationary models, the data is standardized.

\item[\code{conv}] The convergence code, taken from the list returned by
\code{\LinkA{optim}{optim}}. A zero indicates successful convergence.

\item[\code{nllh}] The negative logarithm of the likelihood evaluated at
the maximum likelihood estimates.

\item[\code{vals}] A matrix with four columns containing the maximum
likelihood estimates of the location, scale and shape
parameters, and the threshold, at each data point.

\item[\code{gpd}] A matrix with three rows containing the maximum
likelihood estimates of corresponding GPD location, scale
and shape parameters at each data point.

\item[\code{mle}] A vector containing the maximum likelihood estimates.

\item[\code{cov}] The covariance matrix.

\item[\code{se}] A vector containing the standard errors.

\end{ldescription}


For stationary models two plots are produced; a probability plot 
and a quantile plot. For non-stationary models two plots are produced; 
a residual probability plot and a residual quantile plot.
\end{Value}
\begin{Author}\relax
Alec Stephenson for the code implemented from \R's ismev package, \\
Stuart Scott for the original code, and
Diethelm Wuertz for this \R-port.
\end{Author}
\begin{References}\relax
Coles S. (2001);
\emph{Introduction to Statistical Modelling of Extreme Values},
Springer.
\end{References}
\begin{Examples}
\begin{ExampleCode}
## SOURCE("fExtremes.54C-PPFit")

## Use Rain Data:
   data(rain)
   
## Fit Point Process Model:
   xmpExtremes("Start: Parameter Fit for Point Process > ")
   fit = ppFit(x = rain[1:200], threshold = 10)
   print(fit) 
   
## Summarize Results:
   xmpExtremes("Next: Diagnostic Analysis > ")
   par(mfrow = c(2, 2), cex = 0.75)
   summary(fit)
   xmpExtremes("Next: Interactive Plot > ")
   
## Interactive Plot:
   ##> par(mfrow = c(2, 2), cex = 0.75)
   ##> plot(fit)
\end{ExampleCode}
\end{Examples}

