Last data update: 2014.03.03

R: The Logistic Distribution.
LogisticR Documentation

The Logistic Distribution.

Description

Density, distribution, and quantile, random number generation, and parameter estimation functions for the logistic distribution with parameters location and scale. Parameter estimation can be based on a weighted or unweighted i.i.d. sample and can be carried out numerically.

Usage

dLogistic(x, location = 0, scale = 1, params = list(location = 0, scale =
  1), ...)

pLogistic(q, location = 0, scale = 1, params = list(location = 0, scale =
  1), ...)

qLogistic(p, location = 0, scale = 1, params = list(location = 0, scale =
  1), ...)

rLogistic(n, location = 0, scale = 1, params = list(location = 0, scale =
  1), ...)

eLogistic(X, w, method = "numerical.MLE", ...)

lLogistic(X, w, location = 0, scale = 1, params = list(location = 0, scale
  = 1), logL = TRUE, ...)

Arguments

x,q

A vector of quantiles.

location

Location parameter.

scale

Scale parameter.

params

A list that includes all named parameters.

...

Additional parameters.

p

A vector of probabilities.

n

Number of observations.

X

Sample observations.

w

An optional vector of sample weights.

method

Parameter estimation method.

logL

logical; if TRUE, lLogistic gives the log-likelihood, otherwise the likelihood is given.

Details

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

The dLogistic(), pLogistic(), qLogistic(),and rLogistic() functions serve as wrappers of the standard dlogis, plogis, qlogis, and rlogis functions in the stats package. They allow for the parameters to be declared not only as individual numerical values, but also as a list so parameter estimation can be carried out.

The logistic distribution with location = α and scale = β is most simply defined in terms of its cumulative distribution function (Johnson et.al pp.115-116)

F(x) = 1- [1 + exp((x-α)/β)]^{-1}.

The corresponding probability density function is given by

f(x) = 1/β [exp(x-α/β][1 + exp(x-α/β)]^{-2}

Parameter estimation is only implemented numerically.

The score function and Fishers information are as given by Shi (1995) (See also Kotz & Nadarajah (2000)).

Value

dLogistic gives the density, pLogistic the distribution function, qLogistic the quantile function, rLogistic generates random deviates, and eLogistic estimates the parameters. lLogistic provides the log-likelihood function.

Author(s)

Haizhen Wu and A. Jonathan R. Godfrey.
Updates and bug fixes by Sarah Pirikahu.

References

Johnson, N. L., Kotz, S. and Balakrishnan, N. (1995) Continuous Univariate Distributions, volume 2, chapter 23. Wiley, New York.

Shi, D. (1995) Fisher information for a multivariate extreme value distribution, Biometrika, vol 82, pp.644-649.

Kotz, S. and Nadarajah (2000) Extreme Value Distributions Theory and Applications, chapter 3, Imperial Collage Press, Singapore.

See Also

ExtDist for other standard distributions.

Examples

# Parameter estimation for a distribution with known shape parameters
X <- rLogistic(n=500, location=1.5, scale=0.5)
est.par <- eLogistic(X); est.par
plot(est.par)
#  Fitted density curve and histogram
den.x <- seq(min(X),max(X),length=100)
den.y <- dLogistic(den.x,location=est.par$location,scale=est.par$scale)
hist(X, breaks=10, probability=TRUE, ylim = c(0,1.2*max(den.y)))
lines(den.x, den.y, col="blue")
lines(density(X), lty=2)

# Extracting location or scale parameters
est.par[attributes(est.par)$par.type=="location"]
est.par[attributes(est.par)$par.type=="scale"]

# log-likelihood function
lLogistic(X,param = est.par)

# Evaluation of the precision of the parameter estimates by the Hessian matrix
H <- attributes(est.par)$nll.hessian
fisher_info <- solve(H)
var <- sqrt(diag(fisher_info));var

# Example of parameter estimation for a distribution with
# unknown parameters currently been sought after.

Results


R version 3.3.1 (2016-06-21) -- "Bug in Your Hair"
Copyright (C) 2016 The R Foundation for Statistical Computing
Platform: x86_64-pc-linux-gnu (64-bit)

R is free software and comes with ABSOLUTELY NO WARRANTY.
You are welcome to redistribute it under certain conditions.
Type 'license()' or 'licence()' for distribution details.

R is a collaborative project with many contributors.
Type 'contributors()' for more information and
'citation()' on how to cite R or R packages in publications.

Type 'demo()' for some demos, 'help()' for on-line help, or
'help.start()' for an HTML browser interface to help.
Type 'q()' to quit R.

> library(ExtDist)

Attaching package: 'ExtDist'

The following object is masked from 'package:stats':

    BIC

> png(filename="/home/ddbj/snapshot/RGM3/R_CC/result/ExtDist/Logistic.Rd_%03d_medium.png", width=480, height=480)
> ### Name: Logistic
> ### Title: The Logistic Distribution.
> ### Aliases: Logistic dLogistic eLogistic lLogistic pLogistic qLogistic
> ###   rLogistic
> 
> ### ** Examples
> 
> # Parameter estimation for a distribution with known shape parameters
> X <- rLogistic(n=500, location=1.5, scale=0.5)
> est.par <- eLogistic(X); est.par

Parameters for the Logistic distribution. 
(found using the  numerical.MLE method.)

 Parameter     Type  Estimate       S.E.
  location location 1.5025650 0.03819408
     scale    scale 0.4912822 0.01831383


> plot(est.par)
> #  Fitted density curve and histogram
> den.x <- seq(min(X),max(X),length=100)
> den.y <- dLogistic(den.x,location=est.par$location,scale=est.par$scale)
> hist(X, breaks=10, probability=TRUE, ylim = c(0,1.2*max(den.y)))
> lines(den.x, den.y, col="blue")
> lines(density(X), lty=2)
> 
> # Extracting location or scale parameters
> est.par[attributes(est.par)$par.type=="location"]
$location
[1] 1.502565

> est.par[attributes(est.par)$par.type=="scale"]
$scale
[1] 0.4912822

> 
> # log-likelihood function
> lLogistic(X,param = est.par)
[1] -642.0165
> 
> # Evaluation of the precision of the parameter estimates by the Hessian matrix
> H <- attributes(est.par)$nll.hessian
> fisher_info <- solve(H)
> var <- sqrt(diag(fisher_info));var
  location      scale 
0.03819408 0.01831383 
> 
> # Example of parameter estimation for a distribution with
> # unknown parameters currently been sought after.
> 
> 
> 
> 
> 
> dev.off()
null device 
          1 
>