glogis: The Generalized Logistic Distribution (Type I: Skew-Logitic)

Description Usage Arguments Details Value References Examples

Description

Density, distribution function, quantile function and random generation for the logistic distribution with parameters location and scale.

Usage

1
2
3
4
5
dglogis(x, location = 0, scale = 1, shape = 1, log = FALSE)
pglogis(q, location = 0, scale = 1, shape = 1, lower.tail = TRUE, log.p = FALSE)
qglogis(p, location = 0, scale = 1, shape = 1, lower.tail = TRUE, log.p = FALSE)
rglogis(n, location = 0, scale = 1, shape = 1)
sglogis(x, location = 0, scale = 1, shape = 1)

Arguments

x, q

vector of quantiles.

p

vector of probabilities.

n

number of observations. If length(n) > 1, the length is taken to be the number required.

location, scale, shape

location, scale, and shape parameters (see below).

log, log.p

logical; if TRUE, probabilities p are given as log(p).

lower.tail

logical; if TRUE (default), probabilities are P[X ≤ x], otherwise, P[X > x].

Details

If location, scale, or shape are omitted, they assume the default values of 0, 1, and 1, respectively.

The generalized logistic distribution with location = m, scale = s, and shape = g has distribution function

F(x) = 1 / (1 + exp(-(x-m)/s))^g

.

The mean is given by location + (digamma(shape) - digamma(1)) * scale, the variance by (psigamma(shape, deriv = 1) + psigamma(1, deriv = 1)) * scale^2) and the skewness by (psigamma(shape, deriv = 2) - psigamma(1, deriv = 2)) / (psigamma(shape, deriv = 1) + psigamma(1, deriv = 1))^(3/2)).

[dpq]glogis are calculated by leveraging the [dpq]logis and adding the shape parameter. rglogis uses inversion.

Value

dglogis gives the probability density function, pglogis gives the cumulative distribution function, qglogis gives the quantile function, and rglogis generates random deviates. sglogis gives the score function (gradient of the log-density with respect to the parameter vector).

References

Johnson NL, Kotz S, Balakrishnan N (1995) Continuous Univariate Distributions, volume 2. John Wiley \& Sons, New York.

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.

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
## PDF and CDF
par(mfrow = c(1, 2))
x <- -100:100/10
plot(x, dglogis(x, shape = 2), type = "l", col = 4, main = "PDF", ylab = "f(x)")
lines(x, dglogis(x, shape = 1))
lines(x, dglogis(x, shape = 0.5), col = 2)
legend("topleft", c("generalized (0, 1, 2)", "standard (0, 1, 1)",
  "generalized (0, 1, 0.5)"), lty = 1, col = c(4, 1, 2), bty = "n")
plot(x, pglogis(x, shape = 2), type = "l", col = 4, main = "CDF", ylab = "F(x)")
lines(x, pglogis(x, shape = 1))
lines(x, pglogis(x, shape = 0.5), col = 2)

## artifical empirical example
set.seed(2)
x <- rglogis(1000, -1, scale = 0.5, shape = 3)
gf <- glogisfit(x)
plot(gf)
summary(gf)

Example output

Loading required package: zoo

Attaching package: 'zoo'

The following objects are masked from 'package:base':

    as.Date, as.Date.numeric


Call:
glogisfit(x = x)


Coefficients:
           Estimate Std. Error z value Pr(>|z|)    
location   -1.16961    0.18840  -6.208 5.36e-10 ***
log(scale) -0.63017    0.04323 -14.578  < 2e-16 ***
log(shape)  1.29581    0.25916   5.000 5.73e-07 ***
---
Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1

Log-likelihood: -1074 on 12 Df
Goodness-of-fit statistic: 39.11 on 58 DF,  p-value: 0.9731
Number of iterations in BFGS optimization: 15 

glogis documentation built on May 2, 2019, 4:47 p.m.

Related to glogis in glogis...