CovariatesResult

class CovariatesResult(*args)

Estimation result class for a GEV or GPD model depending on covariates.

Parameters:
factoryDistributionFactory

Parent distribution factory.

parameterFunctionFunction

The function \vect{\theta}.

covariates2-d sequence of float

Values of \vect{y}.

parameterDistributionDistribution

The distribution of \vect{\beta}.

llhfloat

Maximum log-likelihood.

Notes

This class is created by the method buildCovariates() of the classes GeneralizedExtremeValueFactory and GeneralizedParetoFactory.

Let Z_{\vect{y}} be a random variable which follows a GEV distribution or whose excesses above u follow a GPD. We assume that the parameters of the GEV model or the GPD (except for the threshold of the GPD which is assumed to be known) depend on d covariates denoted by \vect{y} = \Tr{(y_1, \dots, y_d)}:

Z_{\vect{y}} & \sim \mbox{GEV}(\mu(\vect{y}), \sigma(\vect{y}), \xi(\vect{y}))\\
Z_{\vect{y}} & \sim \mbox{GPD}(\sigma(\vect{y}), \xi(\vect{y}), u)

We denote by (z_{\vect{y}_1}, \dots, z_{\vect{y}_n}) the values of Z_{\vect{y}} associated to the values of the covariates (\vect{y}_1, \dots, \vect{y}_n).

For numerical reasons, the covariates have been normalized. Each covariate y_k has its own normalization:

\tilde{y}_k = \tau_k(y_k) = \dfrac{y_k-c_k}{d_k}

Let \vect{\theta} = (\theta_1, \dots, \theta_p) be the set of parameters (\mu, \sigma, \xi) for the GEV model and (\sigma, \xi) for the GPD model. Then, \vect{\theta} depends on all the d covariates even if each component of \vect{\theta} only depends on a subset of the covariates. We denote by (y_1^q, \dots, y_{d_q}^q) the d_q covariates involved in the modelling of the component \theta_q.

Each component \theta_q can be written as a function of the covariates:

\theta_q(y_1^q, \dots, y_{d_q}^q)  & = h_q\left(\sum_{i=1}^{d_q} \beta_i^qy_i^q +
\beta_{d_q+1}^q \right)

where:

  • h_q: \Rset \mapsto \Rset is usually referred to as the inverse-link function of the component \theta_q,

  • each \beta_i^{q} \in \Rset.

To allow one of the parameters to remain constant, i.e. independent of the covariates (this will generally be the case for the parameter \xi, the library systematically adds the constant covariate to the list specified by the user, even if it means duplicating it if the user has already put it in his list.

The complete vector of parameters is defined by:

\Tr{\vect{b}} & = \Tr{( \Tr{\vect{b}_1}, \dots,  \Tr{\vect{b}_p} )} \in  \Rset^{d_t}\\
\Tr{\vect{b}_q} & =  (\beta_1^q, \dots, \beta_{d_q}^q)\in \Rset^{d_q}

where d_t = \sum_{i=1}^p d_i.

The estimator of \Tr{\vect{b}} maximizes the likelihood of the Parent distribution.

Methods

drawParameterFunction1D(*args)

Draw the parameter function.

drawParameterFunction2D(*args)

Draw the parameter function.

drawQuantileFunction1D(*args)

Draw the quantile function.

drawQuantileFunction2D(*args)

Draw the quantile function.

getClassName()

Accessor to the object's name.

getCovariates()

Covariates accessor.

getDistribution(covariates)

Accessor to the Parent distribution at a given covariate vector.

getLogLikelihood()

Optimal likelihood value accessor.

getName()

Accessor to the object's name.

getNormalizationFunction()

Normalizing function accessor.

getOptimalParameter()

Optimal parameter accessor.

getParameterDistribution()

Accessor to the distribution of \vect{\beta}.

getParameterFunction()

Parameter function accessor.

hasName()

Test if the object is named.

setLogLikelihood(logLikelihood)

Optimal likelihood value accessor.

setName(name)

Accessor to the object's name.

setParameterDistribution(parameterDistribution)

Accessor to the distribution of of \vect{\beta}.

__init__(*args)
drawParameterFunction1D(*args)

Draw the parameter function.

Parameters:
parameterIndexint in [0, 2]

The index specifying the component \theta_q.

referencePointsequence of float, optional

Reference values for the frozen covariates. If not provided the mean of covariates is used.

Returns:
gridGridLayout

Graphs of y_k \mapsto \theta_q(\vect{y}) for 1 \leq k \leq d.

Notes

Once the index q has been chosen, the method draws all the graphs y_k \mapsto \theta_q(\vect{y}), where all the components of \vect{y} are fixed to a reference value excepted for y_k, for each 1 \leq k \leq d.

Each component of \vect{\theta} potentially depends only on a subset of the covariates. Hence, when the component \theta_q does not depend on y_k, the graph is reduced to one horizontal line.

drawParameterFunction2D(*args)

Draw the parameter function.

Parameters:
parameterIndexint in [0, 2]

The index specifying the component \theta_q.

referencePointsequence of float, optional

Reference values for the frozen covariates. If not provided the mean of covariates is used.

Returns:
gridGridLayout

Graphs of (y_k, y_\ell) \mapsto \theta_q(\vect{y}) for 1 \leq k, \ell \leq d.

Notes

Once the index q has been chosen, the method draws all the graphs (y_k, y_\ell) \mapsto \theta_q(\vect{y}), where all the components of \vect{y} are fixed to a reference value excepted for (y_k, y_\ell), for each 1 \leq k, \ell \leq d.

Each component of \vect{\theta} potentially depends only on a subset of the covariates. Hence, when the component \theta_q does not depend on (y_k, y_\ell), the graph is reduced to one point. If it does not depend on one of the two, the graph is reduced to one line.

drawQuantileFunction1D(*args)

Draw the quantile function.

Parameters:
pfloat

The quantile level.

referencePointsequence of float, optional

Reference values for the frozen covariates. If not provided the mean of covariates is used.

Returns:
gridGridLayout

Graphs of y_k \mapsto q_p(Z_{\vect{y}}) for 1 \leq k \leq d.

Notes

The method plots all the graphs of the quantile functions of order p: of Z_{\vect{y}}: y_k \mapsto q_p(Z_{\vect{y}}) where all the components of \vect{y} are fixed to a reference value excepted for y_k, for each 1 \leq k \leq d.

Each component of \vect{\theta} potentially depends only on a subset of the covariates. Hence, when the component \theta_q does not depend on y_k, the graph is reduced to one horizontal line.

drawQuantileFunction2D(*args)

Draw the quantile function.

Parameters:
pfloat

The quantile level.

referencePointsequence of float, optional

Reference values for the frozen covariates. If not provided the mean of covariates is used.

Returns:
gridGridLayout

Graphs of (y_k, y_\ell) \mapsto q_p(Z_{\vect{y}}) for 1 \leq k, \ell \leq d.

Notes

The method plots all the graphs of the quantile functions of order p: of Z_{\vect{y}}: (y_k, y_\ell) \mapsto q_p(Z_{\vect{y}}) where all the components of \vect{y} are fixed to a reference value excepted for (y_k, y_\ell), for each 1 \leq k, \ell \leq d.

Each component of \vect{\theta} potentially depends only on a subset of the covariates. Hence, when the component \theta_q does not depend on (y_k, y_\ell), the graph is reduced to one point. If it does not depend on one of the two, the graph is reduced to one line.

getClassName()

Accessor to the object’s name.

Returns:
class_namestr

The object class name (object.__class__.__name__).

getCovariates()

Covariates accessor.

Returns:
covariatesSample

The sample of covariates.

Notes

If the constant covariate was not specified, a last column has been automatically added which contains the value 1.

getDistribution(covariates)

Accessor to the Parent distribution at a given covariate vector.

Parameters:
covariatesequence of float, 2-d sequence of float

Covariates value \vect{y} \in \Rset^d.

Returns:
distributionDistribution

The Parent distribution at covariate.

getLogLikelihood()

Optimal likelihood value accessor.

Returns:
llhfloat

Maximum log-likelihood.

getName()

Accessor to the object’s name.

Returns:
namestr

The name of the object.

getNormalizationFunction()

Normalizing function accessor.

Returns:
normalizeFunctionFunction

The function \vect{y} \mapsto (\tau_1(y_1), \dots, \tau_d(y_d)).

getOptimalParameter()

Optimal parameter accessor.

Returns:
optimalParameterPoint

Optimal vector of parameters \vect{\beta}.

getParameterDistribution()

Accessor to the distribution of \vect{\beta}.

Returns:
parameterDistributionDistribution

The distribution of the estimator of \vect{\beta}.

getParameterFunction()

Parameter function accessor.

Returns:
parameterFunctionFunction

The function (\vect{\beta}, \vect{y}) \mapsto \vect{\theta}(\vect{\beta},\vect{y}).

hasName()

Test if the object is named.

Returns:
hasNamebool

True if the name is not empty.

setLogLikelihood(logLikelihood)

Optimal likelihood value accessor.

Parameters:
llhfloat

Maximum log-likelihood.

setName(name)

Accessor to the object’s name.

Parameters:
namestr

The name of the object.

setParameterDistribution(parameterDistribution)

Accessor to the distribution of of \vect{\beta}.

Parameters:
parameterDistributionDistribution

The distribution of the estimator of \vect{\beta}.

Examples using the class

Estimate a GEV on the Fremantle sea-levels data

Estimate a GEV on the Fremantle sea-levels data