glogisfit | R Documentation |
Fit a univariate generalized logisitc distribution (Type I: skew-logistic with location, scale, and shape parameters) to a sample of observations.
glogisfit(x, ...) ## Default S3 method: glogisfit(x, weights = NULL, start = NULL, fixed = c(NA, NA, NA), method = "BFGS", hessian = TRUE, ...) ## S3 method for class 'formula' glogisfit(formula, data, subset, na.action, weights, x = TRUE, ...) ## S3 method for class 'glogisfit' plot(x, main = "", xlab = NULL, fill = "lightgray", col = "blue", lwd = 1, lty = 1, xlim = NULL, ylim = NULL, legend = "topright", moments = FALSE, ...) ## S3 method for class 'glogisfit' summary(object, log = TRUE, breaks = NULL, ...) ## S3 method for class 'glogisfit' coef(object, log = TRUE, ...) ## S3 method for class 'glogisfit' vcov(object, log = TRUE, ...)
x |
a vector of observation (may be a |
weights |
optional numeric vector of weights. |
start |
optional vector of starting values. The parametrization has to be
in terms of |
fixed |
specification of fixed parameters (see description of |
method |
character string specifying optimization method, see |
hessian |
logical. Should the Hessian be used to compute the variance/covariance
matrix? If |
formula |
symbolic description of the model, currently only |
data, subset, na.action |
arguments controlling formula processing
via |
main, xlab, fill, col, lwd, lty, xlim, ylim |
standard graphical parameters, see
|
legend |
logical or character specification where to place a legend.
|
moments |
logical. If a legend is produced, it can either show the parameter
estimates ( |
object |
a fitted |
log |
logical option in some extractor methods indicating whether scale and shape parameters should be reported in logs (default) or the original levels. |
breaks |
interval breaks for the chi-squared goodness-of-fit test. Either a numeric vector of two or more cutpoints or a single number (greater than or equal to 2) giving the number of intervals. |
... |
arguments passed to methods. |
glogisfit
estimates the generalized logistic distribution (Type I: skew-logistic)
as given by dglogis
. Optimization is performed numerically by
optim
using analytical gradients. For obtaining numerically more
stable results the scale and shape parameters are specified in logs. Starting values
are chosen as c(0, 0, 0)
, i.e., corresponding to a standard (symmetric) logistic
distribution. If these fail, better starting values are obtained by running a Nelder-Mead
optimization on the original problem (without logs) first.
A large list of standard extractor methods is supplied to conveniently compute
with the fitted objects, including methods to the generic functions
print
, summary
, plot
(reusing hist
and lines
), coef
,
vcov
, logLik
, residuals
,
and estfun
and
bread
(from the sandwich package).
The methods for coef
, vcov
, summary
, and bread
report computations
pertaining to the scale/shape parameters in logs by default, but allow for switching back to
the original levels (employing the delta method).
Visualization employs a histogramm of the original data along with lines for the estimated density.
Further structural change methods for "glogisfit"
objects are described in
breakpoints.glogisfit
.
glogisfit
returns an object of class "glogisfit"
, i.e., a list with components as follows.
coefficients |
estimated parameters from the model (with scale/shape in logs, if included), |
vcov |
associated estimated covariance matrix, |
loglik |
log-likelihood of the fitted model, |
df |
number of estimated parameters, |
n |
number of observations, |
nobs |
number of observations with non-zero weights, |
weights |
the weights used (if any), |
optim |
output from the |
method |
the method argument passed to the |
parameters |
the full set of model parameters (location/scale/shape), including estimated and fixed parameters, all in original levels (without logs), |
moments |
associated mean/variance/skewness, |
start |
the starting values for the parameters passed to the |
fixed |
the original specification of fixed parameters, |
call |
the original function call, |
x |
the original data, |
converged |
logical indicating successful convergence of |
terms |
the terms objects for the model (if the |
Shao Q (2002). Maximum Likelihood Estimation for Generalised Logistic Distributions. Communications in Statistics – Theory and Methods, 31(10), 1687–1700.
Windberger T, Zeileis A (2014). Structural Breaks in Inflation Dynamics within the European Monetary Union. Eastern European Economics, 52(3), 66–88.
dglogis
, dlogis
, breakpoints.glogisfit
## simple artificial example set.seed(2) x <- rglogis(1000, -1, scale = 0.5, shape = 3) gf <- glogisfit(x) plot(gf) summary(gf) ## query parameters and associated moments coef(gf) coef(gf, log = FALSE) gf$parameters gf$moments
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.