Learn R Programming

cpd (version 0.1.0)

fitctp: Maximum-likelihood fitting of the Complex Triparametric Pearson (CTP) distribution

Description

Maximum-likelihood fitting of the Complex Triparametric Pearson (CTP) distribution with parameters \(a\), \(b\) and \(\gamma\).

Usage

fitctp(x, astart = 0, bstart = 1, gammastart = 1.1, method = "L-BFGS-B", 
       moments = FALSE, hessian = TRUE, control = list(), ...)

Arguments

x

A numeric vector of length at least one containing only finite values.

astart

An starting value for the parameter \(a\); by default 0.

bstart

An starting value for the parameter \(b\); by default 1.

gammastart

An starting value for the parameter \(\gamma\); by default 1.1.

method

The method to be used in fitting the model. The default method is "L-BFGS-B" (optim).

moments

If TRUE the estimates of \(a\), \(b\) and \(\gamma\) by the method of moments are used as starting values (if it is posible). By default this argument is FALSE.

hessian

If TRUE the hessian of the objective function at the minimum is returned.

control

A list of parameters for controlling the fitting process.

...

Additional parameters.

Value

An object of class "fitctp" is a list containing the following components:

  • n, the number of observations,

  • initialValues, a vector with the starting values used,

  • coefficients, the parameter ML estimates of the CTP distribution,

  • se, a vector of the standard error estimates,

  • hessian, a symmetric matrix giving an estimate of the Hessian at the solution found in the optimization of the log-likelihood function,

  • cov, an estimate of the covariance matrix of the model coefficients,

  • corr, an estimate of the correlation matrix of the model estimates,

  • loglik, the maximized log-likelihood,

  • aic, Akaike Information Criterion, minus twice the maximized log-likelihood plus twice the number of parameters,

  • bic, Bayesian Information Criterion, minus twice the maximized log-likelihood plus twice the number of parameters,

  • code, a code that indicates successful convergence of the fitter function used (see nlm and optim helps),

  • converged, logical value that indicates if the optimization algorithms succesfull,

  • method, the name of the fitter function used.

References

RCSO2004cpd

ROC2018cpd

See Also

Maximum-likelihood fitting for the CBP distribution: fitcbp.

Examples

Run this code
# NOT RUN {
set.seed(123)
x <- rctp(500, -0.5, 1, 2)
fitctp(x)
fitctp(x, astart = 1, bstart = 1.1, gammastart = 3)
fitctp(x, moments = TRUE)
# }

Run the code above in your browser using DataLab