Functions to calculate contributions to the score vector from individual observations for a fitted model object.

# S3 method for Bernoulli
estfun(x, ...)

# S3 method for GP
estfun(x, eps = 1e-05, m = 3, ...)

Arguments

x

A fitted model object.

...

Further arguments. None are used for estfun.Bernoulli or estfun.GP.

eps, m

These control the estimation of the observed information in gpObsInfo when the GP shape parameter \(\xi\) is very close to zero. In these cases, direct calculation is unreliable. eps is a (small, positive) numeric scalar. If the absolute value of the input value of \(\xi\), that is, pars[2], is smaller than eps then we approximate the [2, 2] element using a Taylor series expansion in \(\xi\), evaluated up to and including the mth term.

Value

An \(n \times k\) matrix containing contributions to the score function from \(n\) observations for each of the \(k\)

parameters.

estfun.Bernoulli: an \(n \times 2\) matrix, where

\(n\) is the sample size, the length of the input data to

fitBernoulli. The column is named prob.

estfun.GP: an \(n \times 2\) matrix, where \(n\) is the sample size, the length of the input data to fitGP. The columns are named sigma[u] and xi.

Details

An estfun method is used by meatCL to calculate the meat in the sandwich covariance estimator on which the log-likelihood adjustments in flite are based. Specifically, meatCL is used to calculate the argument V passed to adjust_loglik.

See also

Bernoulli for maximum likelihood inference for the Bernoulli distribution.

generalisedPareto for maximum likelihood inference for the generalised Pareto distribution.

Examples

library(sandwich)

# estfun.Bernoulli
bfit <- fitBernoulli(c(exdex::cheeseboro) > 45)
head(estfun(bfit))
#>         prob
#> [1,] -1.0285
#> [2,] -1.0285
#> [3,] -1.0285
#> [4,] -1.0285
#> [5,] -1.0285
#> [6,] -1.0285

# estfun.generalisedPareto
gpfit <- fitGP(c(exdex::cheeseboro), u = 45)
head(estfun(gpfit))
#>          sigma[u]         xi
#> [1,] -0.063902582 -0.3512112
#> [2,] -0.086318699 -0.1962096
#> [3,] -0.075227392 -0.2790858
#> [4,] -0.063902582 -0.3512112
#> [5,] -0.003503566 -0.5330688
#> [6,] -0.075227392 -0.2790858