\HeaderA{RlargFit}{Modelling the Order Statistic Model}{RlargFit}
\aliasA{plot.rlargFit}{RlargFit}{plot.rlargFit}
\aliasA{print.rlargFit}{RlargFit}{print.rlargFit}
\aliasA{rlargFit}{RlargFit}{rlargFit}
\aliasA{summary.rlargFit}{RlargFit}{summary.rlargFit}
\keyword{models}{RlargFit}
\begin{Description}\relax
A collection and description of functions to model 
the Order Statistic Model by maximum likelihood 
approximation based on \R's 'ismev' package. The 
parameter estimation allows to include generalized 
linear modelling of each parameter.
\\

The functions are:

\Tabular{ll}{
\code{gpdglmFit} & fits empirical or simulated data to the distribution, \\ 
\code{print} & print method for a fitted GPD object of class ..., \\
\code{plot} & plot method for a fitted GPD object, \\ 
\code{summary} & summary method for a fitted GPD object, \\
\code{gevglmprofPlot} & profile log-likelihoods for return levels, \\ 
\code{gevglmprofxiPlot} & profile log-likelihoods for shape parameters. }
\end{Description}
\begin{Usage}
\begin{verbatim}
rlargFit(x, r = dim(x)[2], y = NULL, mul = NULL, sigl = NULL,
    shl = NULL, mulink = identity, siglink = identity, shlink = identity,
    method = "Nelder-Mead", maxit = 10000, ...)

## S3 method for class 'rlargFit':
print(x, ...)
## S3 method for class 'rlargFit':
plot(x, which = "all", ...)
## S3 method for class 'rlargFit':
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}] [rlargFit] - \\
the maximum number of iterations.

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

\item[\code{mul, sigl, shl}] [rlargFit] - \\
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}] [rlargFit] - \\
inverse link functions for generalized linear modelling of the 
location, scale and shape parameters repectively.

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

\item[\code{r}] [rlargFit] - \\
the largest \code{r} order statistics are used for the fitted model.

\item[\code{x}] [rlargFit] - \\
a numeric matrix of data to be fitted. Each row should be a vector 
of decreasing order, containing the largest order statistics for 
each year (or time period). The first column therefore contains annual 
(or period) maxima.
Only the first \code{r} columns are used for the fitted model. By 
default, all columns are used.
If one year (or time period) contains fewer order statistics than 
another, missing values can be appended to the end of the 
corresponding row.
\\{}
[print][plot] - \\
a fitted object of class \code{"rlargFit"}.

\item[\code{y}] [rlargFit] - \\
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 number of rows of 
\code{x}.

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

\item[\code{...}] [rlargFit][plot] - \\
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{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{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{data}] The data that has been fitted. For non-stationary
models, the data is standardized.

\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.
\item[\code{vals}] A matrix with three columns containing the maximum
likelihood estimates of the location, scale and shape parameters
at each data point.

\item[\code{r}] The number of order statistics used.

\end{ldescription}


For stationary models four plots are initially produced;
a probability plot, a quantile plot, a return level plot
and a histogram of data with fitted density.
Then probability and quantile plots are produced for the
largest \code{n} order statistics. For non-stationary models 
residual probability plots and residual quantile plots are 
produced for the largest \code{n} order statistics.
\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.54D-RlargFit")

## Use Venice Data:
   data(venice)
   
## Fit for the order statistic model:
   xmpExtremes("Start: Parameter Fit for Order Statistics Model > ")
   fit = rlargFit(venice[, 2:4], r = 3)
   fit
   
## Summarize Results:
   xmpExtremes("Next: Diagnostic Analysis > ")
   summary(fit) 
\end{ExampleCode}
\end{Examples}

