order_glg: Random Sampling of K-th Order Statistics from a Generalized...

View source: R/order_glg.R

order_glgR Documentation

Random Sampling of K-th Order Statistics from a Generalized Log-gamma Distribution

Description

order_glg is used to obtain a random sample of the K-th order statistics from a generalized log-gamma distribution.

Usage

order_glg(size, mu, sigma, lambda, k, n, alpha = 0.05)

Arguments

size

numeric, represents the size of the sample.

mu

numeric, represents the location parameter. Default value is 0.

sigma

numeric, represents the scale parameter. Default value is 1.

lambda

numeric, represents the shape parameter. Default value is 1.

k

numeric, represents the K-th smallest value from a sample.

n

numeric, represents the size of the sample to compute the order statistic from.

alpha

numeric, (1 - alpha) represents the confidence of an interval for the population median of the distribution of the k-th order statistic. Default value is 0.05.

Value

A list with a random sample of order statistics from a generalized log-gamma distribution, the value of its join probability density function evaluated in the random sample and a (1 - alpha) confidence interval for the population median of the distribution of the k-th order statistic.

Author(s)

Carlos Alberto Cardozo Delgado <cardozorpackages@gmail.com>.

References

Gentle, J, Computational Statistics, First Edition. Springer - Verlag, 2009.

Naradajah, S. and Rocha, R. (2016) Newdistns: An R Package for New Families of Distributions, Journal of Statistical Software.

Examples

# A random sample of size 10 of order statistics from a Extreme Value Distribution.
order_glg(10,0,1,1,1,50)
## Not run:  # A small comparison between two random sampling methods of order statistics
# Method 1
m <- 10
output <- rep(0,m)
order_sample <- function(m,n,k){
for(i in 1:m){
sample <- rglg(n)
order_sample <- sort(sample)
output[i] <- order_sample[k]
}
return(output)
}
N <- 10000
n <- 200
k <- 100
system.time(order_sample(N,n,k))
sample_1 <- order_sample(N,n,k)
hist(sample_1)
summary(sample_1)
# Method 2
system.time(order_glg(N,0,1,1,k,n))
sample_2 <- order_glg(N,0,1,1,k,n)$sample
hist(sample_2)
summary(sample_2)

## End(Not run)

sglg documentation built on Sept. 4, 2022, 9:05 a.m.

Related to order_glg in sglg...