| Title: | Simulation and Moment Computation for Order Statistics |
|---|---|
| Description: | Provides a comprehensive set of tools for working with order statistics, including functions for simulating order statistics, censored samples (Type I and Type II), and record values from various continuous distributions. Additionally, it offers functions to compute moments (mean, variance, skewness, kurtosis) of order statistics for several continuous distributions. These tools assist researchers and statisticians in understanding and analyzing the properties of order statistics and related data. The methods and algorithms implemented in this package are based on several published works, including Ahsanullah et al (2013, ISBN:9789491216831), Arnold and Balakrishnan (2012, ISBN:1461236444), Harter and Balakrishnan (1996, ISBN:9780849394522), Balakrishnan and Sandhu (1995) <doi:10.1080/00031305.1995.10476150>, Genç (2012) <doi:10.1007/s00362-010-0320-y>, Makouei et al (2021) <doi:10.1016/j.cam.2021.113386> and Nagaraja (2013) <doi:10.1016/j.spl.2013.06.028>. |
| Authors: | Reyhaneh Arafeh [aut, cre], Mahdi Salehi [aut] (ORCID: <https://orcid.org/0000-0002-0620-0340>) |
| Maintainer: | Reyhaneh Arafeh <[email protected]> |
| License: | GPL-3 |
| Version: | 0.1.3 |
| Built: | 2026-05-12 06:26:04 UTC |
| Source: | https://github.com/cran/mos |
This function computes the kurtosis of order statistics for a given distribution.
kurtOS(r, n, dist = c("unif", "exp", "weibull", "tri"), ...)kurtOS(r, n, dist = c("unif", "exp", "weibull", "tri"), ...)
r |
rank(s) of the desired order statistic(s) (e.g., |
n |
sample size from which the order statistic is derived. |
dist |
a character string specifying the name of a distribution. Supported values are:
|
... |
further arguments to be passed to |
The kurtosis of the th order statistic is calculated using the formula:
where and are the mean and standard deviation of the th order statistic, respectively.
The kurtosis of the th order statistic.
# Compute the kurtosis of the 3rd order statistic from a sample of size 10 kurtOS(r = 3, n = 10, dist = "unif")# Compute the kurtosis of the 3rd order statistic from a sample of size 10 kurtOS(r = 3, n = 10, dist = "unif")
This function computes the moments of order statistics from the beta distribution using simulation.
mo_beta(r, n, k = 1, a, b, rep = 1e+05, seed = 42)mo_beta(r, n, k = 1, a, b, rep = 1e+05, seed = 42)
r |
rank of the desired order statistic (e.g., |
n |
sample size from which the order statistic is derived. |
k |
order of the moment to compute (default is |
a, b
|
non-negative parameters of the beta distribution. |
rep |
number of simulations (default is |
seed |
optional seed for random number generation to ensure reproducibility (default is |
This function estimates the th moment of the th order statistic in a sample of size
drawn from a beta distribution with specified shape parameters. The estimation is done via
Monte Carlo simulation using the formula:
where are the simulated order statistics from the beta distribution.
The function relies on the ros() function to generate order statistics.
The estimated th moment of the th order statistic from a beta distribution.
The accuracy of the estimated moment depends on the number of simulations (rep).
The default value rep = 1e5 provides a reasonable trade-off between speed and accuracy
for most practical cases. For higher order moments or when greater precision is required,
users are encouraged to increase rep (e.g. 1e6).
ros for generating random samples of order statistics.
# Compute the first moment of the 2nd order statistic from Beta(3, 4) with sample size 5 mo_beta(r = 2, n = 5, k = 1, a = 3, b = 4) # Compute the second moment with 10000 simulations mo_beta(r = 2, n = 5, k = 2, a = 2, b = 2.5, rep = 1e4)# Compute the first moment of the 2nd order statistic from Beta(3, 4) with sample size 5 mo_beta(r = 2, n = 5, k = 1, a = 3, b = 4) # Compute the second moment with 10000 simulations mo_beta(r = 2, n = 5, k = 2, a = 2, b = 2.5, rep = 1e4)
This function computes the moments of order statistics from the complementary beta (CB) distribution.
For small values of k and integer b, a closed-form formula is used; otherwise,
Monte Carlo simulation is applied.
mo_compbeta(r, n, k = 1, a, b, rep = 1e+05, seed = 42, verbose = TRUE)mo_compbeta(r, n, k = 1, a, b, rep = 1e+05, seed = 42, verbose = TRUE)
r |
rank of the desired order statistic (e.g., |
n |
sample size from which the order statistic is derived. |
k |
order of the moment to compute (default is |
a, b
|
positive parameters of the complementary beta distribution. |
rep |
number of simulations (used when |
seed |
optional seed for random number generation to ensure reproducibility (used when |
verbose |
logical; if |
The computation method varies depending on b and k:
For integer b and k = 1, 2: The function calculates the moments using the closed-form expression derived in Makouei et al. (2021):
Here
with the starting point
where is the beta function, is the generalized hypergeometric function,
and the upper limit of the summation stops at if b is an integer.
For non-integer b or k > 2: When b is non-integer or k is
greater than 2 the function employs Monte Carlo simulation using the following formula:
where are the simulated order statistics obtained from the complementary beta distribution.
The method relies on the ros() function to generate order statistics.
When verbose = TRUE, the function prints a message only if Monte Carlo simulation is used
(i.e., when k > 2 or b is non-integer).
The estimated or exact th moment of the th order statistic from a complementary beta distribution.
The closed-form formula is only available for small values of k and integer b.
Monte Carlo simulation is used otherwise, and results may vary slightly depending on rep.
Makouei, R., Khamnei, H. J., & Salehi, M. (2021). Moments of order statistics and k-record values arising from the complementary beta distribution with application. Journal of Computational and Applied Mathematics, 390, 113386.
ros for generating random samples of order statistics.
# Exact moment when k = 1 mo_compbeta(r = 2, n = 15, k = 1, a = 0.5, b = 2) # Simulation when k > 2 or b is non-integer mo_compbeta(r = 2, n = 15, k = 3, a = 2.5, b = 3.7, rep = 1e4)# Exact moment when k = 1 mo_compbeta(r = 2, n = 15, k = 1, a = 0.5, b = 2) # Simulation when k > 2 or b is non-integer mo_compbeta(r = 2, n = 15, k = 3, a = 2.5, b = 3.7, rep = 1e4)
This function computes the moments of order statistics from the exponential distribution.
mo_exp(r, n, k = 1, mu = 0, sigma = 1)mo_exp(r, n, k = 1, mu = 0, sigma = 1)
r |
rank(s) of the desired order statistic(s) (e.g., |
n |
sample size from which the order statistic is derived. |
k |
order of the moment to compute (default is |
mu |
location parameter of the exponential distribution (default is 0). |
sigma |
scale parameter of the exponential distribution (default is 1). |
The function calculates the th moment using the following relationship:
For non-standard exponential distributions with and parameters,
the transformation is used.
The th moment of the th order statistic from an exponential distribution.
Ahsanullah, M., Nevzorov, V. B., & Shakil, M. (2013). An introduction to order statistics (Vol. 8). Paris: Atlantis Press.
# First moment (mean) of the 2nd order statistic from a sample of size 5 mo_exp(2, 5, k = 1, mu = 0, sigma = 1) # Second moment of the 3rd order statistic from an exponential distribution # with mu = 2 and sigma = 3 mo_exp(3, 7, k = 2, mu = 2, sigma = 3)# First moment (mean) of the 2nd order statistic from a sample of size 5 mo_exp(2, 5, k = 1, mu = 0, sigma = 1) # Second moment of the 3rd order statistic from an exponential distribution # with mu = 2 and sigma = 3 mo_exp(3, 7, k = 2, mu = 2, sigma = 3)
This function computes the moments of order statistics from the gamma distribution using simulation.
mo_gamma(r, n, k = 1, shape, rate, rep = 1e+05, seed = 42)mo_gamma(r, n, k = 1, shape, rate, rep = 1e+05, seed = 42)
r |
rank of the desired order statistic (e.g., |
n |
sample size from which the order statistic is derived. |
k |
order of the moment to compute (default is |
shape |
shape parameter of the gamma distribution. |
rate |
rate parameter of the gamma distribution. |
rep |
number of simulations (default is |
seed |
optional seed for random number generation to ensure reproducibility (default is |
This function estimates the th moment of the th order statistic in a sample of size
drawn from a gamma distribution with specified shape and rate parameters. The estimation is done via
Monte Carlo simulation using the formula:
where are the simulated order statistics from the gamma distribution.
The function relies on the ros() function to generate order statistics.
The estimated th moment of the th order statistic from a gamma distribution.
The accuracy of the estimated moment depends on the number of simulations (rep).
The default value rep = 1e5 provides a reasonable trade-off between speed and accuracy
for most practical cases. For higher order moments or when greater precision is required,
users are encouraged to increase rep (e.g. 1e6).
# Compute the first moment (mean) of the 3rd order statistic from a sample of size 10 mo_gamma(r = 3, n = 10, shape = 2, rate = 1, k = 1) # Compute the second moment with 10000 simulations mo_gamma(r = 2, n = 10, shape = 2, rate = 0.5, k = 2, rep = 1e4)# Compute the first moment (mean) of the 3rd order statistic from a sample of size 10 mo_gamma(r = 3, n = 10, shape = 2, rate = 1, k = 1) # Compute the second moment with 10000 simulations mo_gamma(r = 2, n = 10, shape = 2, rate = 0.5, k = 2, rep = 1e4)
This function computes the moments of order statistics from the kumaraswamy distribution using simulation.
mo_kumar(r, n, k = 1, a, b, rep = 1e+05, seed = 42)mo_kumar(r, n, k = 1, a, b, rep = 1e+05, seed = 42)
r |
rank of the desired order statistic (e.g., |
n |
sample size from which the order statistic is derived. |
k |
order of the moment to compute (default is |
a, b
|
positive parameters of the kumaraswamy distribution. |
rep |
number of simulations (default is |
seed |
optional seed for random number generation to ensure reproducibility (default is |
This function estimates the th moment of the th order statistic in a sample of size
drawn from a kumaraswamy distribution with specified shape parameters. The estimation is done via
Monte Carlo simulation using the formula:
where are the simulated order statistics from the kumaraswamy distribution.
The function relies on the ros() function to generate order statistics.
The estimated th moment of the th order statistic from a kumaraswamy distribution.
The accuracy of the estimated moment depends on the number of simulations (rep).
The default value rep = 1e5 provides a reasonable trade-off between speed and accuracy
for most practical cases. For higher order moments or when greater precision is required,
users are encouraged to increase rep (e.g. 1e6).
ros for generating random samples of order statistics.
# Compute the 2nd moment of the 3rd order statistic from Kumaraswamy(2, 3) with sample size 10 mo_kumar(r = 3, n = 10, k = 2, a = 2, b = 3) # Compute the first moment with 10000 simulations mo_kumar(r = 2, n = 5, k = 1, a = 2, b = 2.5, rep = 1e4)# Compute the 2nd moment of the 3rd order statistic from Kumaraswamy(2, 3) with sample size 10 mo_kumar(r = 3, n = 10, k = 2, a = 2, b = 3) # Compute the first moment with 10000 simulations mo_kumar(r = 2, n = 5, k = 1, a = 2, b = 2.5, rep = 1e4)
This function computes the moments of order statistics from the normal distribution using simulation.
mo_norm(r, n, k = 1, mean = 0, sd = 1, rep = 1e+05, seed = 42)mo_norm(r, n, k = 1, mean = 0, sd = 1, rep = 1e+05, seed = 42)
r |
rank of the desired order statistic (e.g., |
n |
sample size from which the order statistic is derived. |
k |
order of the moment to compute (default is |
mean |
mean of the normal distribution (default is |
sd |
standard deviation of the normal distribution (default is |
rep |
number of simulations (default is |
seed |
optional seed for random number generation to ensure reproducibility (default is |
This function estimates the th moment of the th order statistic in a sample of size
drawn from a normal distribution with the specified mean and standard deviation.
The estimation is done via Monte Carlo simulation using the formula:
where are the simulated order statistics obtained from the normal distribution.
The function relies on the ros() function to generate order statistics.
The estimated th moment of the th order statistic from a normal distribution.
The accuracy of the estimated moment depends on the number of simulations (rep).
The default value rep = 1e5 provides a reasonable trade-off between speed and accuracy
for most practical cases. For higher order moments or when greater precision is required,
users are encouraged to increase rep (e.g. 1e6).
# Compute the first moment (mean) of the 3rd order statistic from a sample of size 10 mo_norm(r = 3, n = 10, k = 1, mean = 0, sd = 1) # Compute the second moment of the 2nd order statistic with 1 million simulations mo_norm(r = 2, n = 10, k = 2, rep = 1e6)# Compute the first moment (mean) of the 3rd order statistic from a sample of size 10 mo_norm(r = 3, n = 10, k = 1, mean = 0, sd = 1) # Compute the second moment of the 2nd order statistic with 1 million simulations mo_norm(r = 2, n = 10, k = 2, rep = 1e6)
This function computes the th moment of order statistics from the pareto distribution using simulation.
mo_pareto(r, n, k = 1, scale, shape, rep = 1e+05, seed = 42)mo_pareto(r, n, k = 1, scale, shape, rep = 1e+05, seed = 42)
r |
rank of the desired order statistic (e.g., |
n |
sample size from which the order statistic is derived. |
k |
order of the moment to compute (default is |
scale, shape
|
non-negative parameters of the pareto distribution. |
rep |
Number of simulations (default is |
seed |
Optional seed for random number generation to ensure reproducibility (default is |
This function estimates the th moment of the th order statistic in a sample of size
drawn from a pareto distribution with specified scale and shape parameters. The estimation is done via
Monte Carlo simulation using the formula:
where are the simulated order statistics from the pareto distribution.
The function relies on the ros() function to generate order statistics.
The estimated th moment of the th order statistic from a pareto distribution.
The accuracy of the estimated moment depends on the number of simulations (rep).
The default value rep = 1e5 provides a reasonable trade-off between speed and accuracy
for most practical cases. For higher order moments or when greater precision is required,
users are encouraged to increase rep (e.g. 1e6).
# Compute the first moment (mean) of the 3rd order statistic from a sample of size 10 mo_pareto(r = 3, n = 10, scale = 2, shape = 3, k = 1) # Compute the second moment with 1 million simulations mo_pareto(r = 2, n = 10, scale = 1, shape = 2, k = 2, rep = 1e6)# Compute the first moment (mean) of the 3rd order statistic from a sample of size 10 mo_pareto(r = 3, n = 10, scale = 2, shape = 3, k = 1) # Compute the second moment with 1 million simulations mo_pareto(r = 2, n = 10, scale = 1, shape = 2, k = 2, rep = 1e6)
This function computes the moments of order statistics from the student's t-distribution using simulation.
mo_t(r, n, k = 1, df, rep = 1e+05, seed = 42)mo_t(r, n, k = 1, df, rep = 1e+05, seed = 42)
r |
rank of the desired order statistic (e.g., |
n |
sample size from which the order statistic is derived. |
k |
order of the moment to compute (default is |
df |
degrees of freedom for the student's t-distribution. |
rep |
number of simulations (default is |
seed |
optional seed for random number generation to ensure reproducibility (default is |
This function estimates the th moment of the th order statistic in a sample of size
drawn from a student's t-distribution with the specified degrees of freedom (df).
The estimation is done via Monte Carlo simulation using the formula:
where are the simulated order statistics obtained from the student's t-distribution.
The function relies on the ros() function to generate order statistics.
The estimated th moment of the th order statistic from a student's t-distribution.
The accuracy of the estimated moment depends on the number of simulations (rep).
The default value rep = 1e5 provides a reasonable trade-off between speed and accuracy
for most practical cases. For higher order moments or when greater precision is required,
users are encouraged to increase rep (e.g. 1e6).
# Compute the first moment (mean) of the 3rd order statistic from a sample of size 10 mo_t(r = 3, n = 10, df = 5, k = 1) # Compute the second moment of the 2nd order statistic with 10000 simulations mo_t(r = 2, n = 10, df = 10, k = 2, rep = 1e4)# Compute the first moment (mean) of the 3rd order statistic from a sample of size 10 mo_t(r = 3, n = 10, df = 5, k = 1) # Compute the second moment of the 2nd order statistic with 10000 simulations mo_t(r = 2, n = 10, df = 10, k = 2, rep = 1e4)
This function computes the moments of order statistic from the topp-leone distribution, based on the formula presented in Genç, A. İ. (2012).
mo_topple(r, n, k = 1, a, b = 1)mo_topple(r, n, k = 1, a, b = 1)
r |
rank(s) of the desired order statistic(s) (e.g., |
n |
sample size from which the order statistic is derived. |
k |
order of the moment to compute (default is |
a |
shape parameter of the topp-leone distribution ( |
b |
scale parameter of the topp-leone distribution (default is |
This function implements the exact formula for moments of order statistics from the topp-leone distribution as provided in Genç, A. İ. (2012):
Here, is the incomplete Beta function.
The th moment of the th order statistic from a topp-leone distribution.
Genç, A. İ. (2012). Moments of order statistics of Topp–Leone distribution. Statistical Papers, 53, 117-131.
# Compute the first moment of the first order statistic for n=5, a=2, b=1 mo_topple(1, 5, 1, 2) # Compute the second moment of the second order statistic for n=10, a=1.5, b=2 mo_topple(2, 10, 2, 1.5, 2)# Compute the first moment of the first order statistic for n=5, a=2, b=1 mo_topple(1, 5, 1, 2) # Compute the second moment of the second order statistic for n=10, a=1.5, b=2 mo_topple(2, 10, 2, 1.5, 2)
This function computes the moments of order statistics from the symmetric triangular distribution.
mo_tri(r, n, k = 1)mo_tri(r, n, k = 1)
r |
rank(s) of the desired order statistic(s) (e.g., |
n |
sample size from which the order statistic is derived. |
k |
order of the moment to compute (default is |
The function implements the following relationship from Nagaraja (2013) for the symmetric triangular distribution:
Here, is the incomplete Beta function.
The th moment of the th order statistic from a symmetric triangular distribution.
Nagaraja, H. N. (2013). Moments of order statistics and L-moments for the symmetric triangular distribution. Statistics & Probability Letters, 83(10), 2357-2363.
# Compute the 2nd moment of the 3rd order statistic for n=5 mo_tri(3, 5, 2)# Compute the 2nd moment of the 3rd order statistic for n=5 mo_tri(3, 5, 2)
This function computes the moments of order statistics for the uniform distribution based on the relationship described by Arnold and Balakrishnan (2012).
mo_unif(r, n, k = 1, a = 0, b = 1)mo_unif(r, n, k = 1, a = 0, b = 1)
r |
rank(s) of the desired order statistic(s) (e.g., |
n |
sample size from which the order statistic is derived. |
k |
order of the moment to compute (default is |
a, b
|
lower and upper limits of the distribution. Must be finite. |
The function calculates the th moment based on the formula:
where is the complete beta function. When or ,
the transformation is used.
The th moment of the th order statistic from a uniform distribution.
Arnold, B. C., & Balakrishnan, N. (2012). Relations, bounds and approximations for order statistics (Vol. 53). Springer Science & Business Media.
# Example 1: First moment (mean) of the 2nd order statistic from a sample of size 5 mo_unif(2, 5, k = 1, a = 0, b = 1) # Example 2: Second moment of the 3rd order statistic from a uniform distribution on [2, 5] mo_unif(3, 7, k = 2, a = 2, b = 5)# Example 1: First moment (mean) of the 2nd order statistic from a sample of size 5 mo_unif(2, 5, k = 1, a = 0, b = 1) # Example 2: Second moment of the 3rd order statistic from a uniform distribution on [2, 5] mo_unif(3, 7, k = 2, a = 2, b = 5)
This function computes the moments of order statistics from the weibull distribution.
mo_weibull(r, n, k = 1, shape, scale = 1)mo_weibull(r, n, k = 1, shape, scale = 1)
r |
rank(s) of the desired order statistic(s) (e.g., |
n |
sample size from which the order statistic is derived. |
k |
order of the moment to compute (default is |
shape |
shape parameter of the weibull distribution. |
scale |
scale parameter of the weibull distribution (default is |
The function calculates the th moment using the formula:
For non-standard weibull distributions (scale not equal to 1), the relationship
is used.
The th moment of the th order statistic from a weibull distribution.
Harter, H. L., & Balakrishnan, N. (1996). CRC handbook of tables for the use of order statistics in estimation. CRC press.
# Example 1: Standard weibull distribution (shape = 2, scale = 1) mo_weibull(r = 2, n = 5, k = 1, shape = 2) # Example 2: Non-standard weibull distribution (shape = 2, scale = 3) mo_weibull(r = 3, n = 6, k = 2, shape = 2, scale = 3)# Example 1: Standard weibull distribution (shape = 2, scale = 1) mo_weibull(r = 2, n = 5, k = 1, shape = 2) # Example 2: Non-standard weibull distribution (shape = 2, scale = 3) mo_weibull(r = 3, n = 6, k = 2, shape = 2, scale = 3)
This function generates censored samples from a specified distribution, using Type I (time-based) or Type II (failure-based) censoring schemes.
rcens(n, r = NULL, dist, type = c("I", "II"), cens.time = NULL, ...)rcens(n, r = NULL, dist, type = c("I", "II"), cens.time = NULL, ...)
n |
total number of items in the sample |
r |
number of uncensored observations (only for Type II censoring). |
dist |
a character string specifying the name of the distribution
(e.g., |
type |
type of censoring: |
cens.time |
censoring time for Type I censoring. |
... |
further arguments to be passed to |
This function implements two types of censoring schemes:
Type I censoring: Observations are censored if they exceed a specified cens.time.
The function returns all observations less than cens.time.
Type II censoring: The smallest r observations are returned, simulating
a situation where the experiment stops after r failures.
A numeric vector of censored samples.
# Type I censoring: Exponential distribution with rate = 1, censored at time 2 rcens(n = 10, dist = "exp", type = "I", cens.time = 2, rate = 1) # Type II censoring: Normal distribution, smallest 5 values rcens(n = 10, r = 5, dist = "norm", type = "II", mean = 0, sd = 1)# Type I censoring: Exponential distribution with rate = 1, censored at time 2 rcens(n = 10, dist = "exp", type = "I", cens.time = 2, rate = 1) # Type II censoring: Normal distribution, smallest 5 values rcens(n = 10, r = 5, dist = "norm", type = "II", mean = 0, sd = 1)
This function generates -records (upper or lower) from a specified continuous distribution.
rkrec(size, k, record = c("upper", "lower"), dist, ...)rkrec(size, k, record = c("upper", "lower"), dist, ...)
size |
number of k-records to generate. |
k |
the rank of the record to generate ( |
record |
the type of record to generate: |
dist |
a character string specifying the name of the continuous distribution
(e.g., |
... |
further arguments to be passed to |
Note: Setting k = 1 generates standard (1-)records.
A numeric vector of size size, representing the simulated k-records.
# Generate 5 upper 2-records from the normal distribution rkrec(size = 5, k = 2, record = "upper", dist = "norm", mean = 0, sd = 1) # Generate 5 lower 3-records from the exponential distribution rkrec(size = 5, k = 3, record = "lower", dist = "exp", rate = 1)# Generate 5 upper 2-records from the normal distribution rkrec(size = 5, k = 2, record = "upper", dist = "norm", mean = 0, sd = 1) # Generate 5 lower 3-records from the exponential distribution rkrec(size = 5, k = 3, record = "lower", dist = "exp", rate = 1)
This function generates random data from the order statistics of a specified distribution. The user can specify a known distribution in R or provide a custom quantile function.
ros(size, r, n, dist = NULL, qf = NULL, ...)ros(size, r, n, dist = NULL, qf = NULL, ...)
size |
number of observations. |
r |
rank(s) of the desired order statistic(s) (e.g., |
n |
sample size from which the order statistic is derived. |
dist |
a character string specifying the name of a known distribution in R (e.g. |
qf |
a custom quantile function, either as a name (string) or directly as a function. Default is |
... |
further arguments to be passed to |
The ros function generates random data from order statistics using two approaches:
Using a Known Distribution: When dist is provided, random data is generated from a known distribution in R.
Using a Custom Quantile Function: When qf is provided, ros applies
the user-provided quantile function to generate random data.
A numeric vector or matrix containing the generated random data from the specified order statistics.
If a single rank is provided (i.e., scalar r), a numeric vector of size size is returned.
If multiple ranks are provided (i.e., vector r), a matrix is returned with size rows and
length(r) columns, where each row corresponds to a simulation and each column to an order statistic.
# Example 1: Generate from the normal distribution ros(5, 3, 15, "norm", mean = 4, sd = 2) # Example 2: Using a custom quantile function for the Pareto distribution ros(3, 2, 10, qf = function(p, scale, shape) scale * (1 - p)^(-1 / shape), scale = 3, shape = 2) # Example 3: Generate multiple order statistics from the uniform distribution # In this example, first through 5th order statistics are generated from a sample size of 5. ros(3, 1:5, 5, dist = "unif")# Example 1: Generate from the normal distribution ros(5, 3, 15, "norm", mean = 4, sd = 2) # Example 2: Using a custom quantile function for the Pareto distribution ros(3, 2, 10, qf = function(p, scale, shape) scale * (1 - p)^(-1 / shape), scale = 3, shape = 2) # Example 3: Generate multiple order statistics from the uniform distribution # In this example, first through 5th order statistics are generated from a sample size of 5. ros(3, 1:5, 5, dist = "unif")
This function generates progressive Type-II censored samples based on the algorithm provided by Balakrishnan and Sandhu (1995).
rpcens2(n, R, dist, ...)rpcens2(n, R, dist, ...)
n |
total number of items in the sample. |
R |
a vector of non-negative integers representing the number of items
censored at each stage of the experiment. The length of |
dist |
a character string specifying the name of the distribution
(e.g., |
... |
further arguments to be passed to |
This function implements the algorithm described by Balakrishnan and Sandhu (1995) to simulate progressive Type-II censored samples. Progressive Type-II censoring is a common scheme in reliability and life-testing experiments, where items are progressively removed (censored) during the testing process.
A numeric vector of size m, representing the failure times of the observed items.
Balakrishnan, N., & Sandhu, R. A. (1995). A simple simulational algorithm for generating progressive Type-II censored samples. The American Statistician, 49(2), 229-230.
# Generate a progressive Type-II censored sample from the normal distribution n <- 10 R <- c(2, 1, 2, 0, 0) rpcens2(n, R, dist = "norm", mean = 0, sd = 1) # Generate a progressive Type-II censored sample from the exponential distribution rpcens2(n = 10, R = c(2, 2, 1, 0, 0), dist = "exp", rate = 1)# Generate a progressive Type-II censored sample from the normal distribution n <- 10 R <- c(2, 1, 2, 0, 0) rpcens2(n, R, dist = "norm", mean = 0, sd = 1) # Generate a progressive Type-II censored sample from the exponential distribution rpcens2(n = 10, R = c(2, 2, 1, 0, 0), dist = "exp", rate = 1)
This function computes the skewness of the order statistics for a given distribution.
skewOS(r, n, dist = c("unif", "exp", "weibull", "tri"), ...)skewOS(r, n, dist = c("unif", "exp", "weibull", "tri"), ...)
r |
rank(s) of the desired order statistic(s) (e.g., |
n |
sample size from which the order statistic is derived. |
dist |
a character string specifying the name of a distribution. Supported values are:
|
... |
further arguments to be passed to |
The skewness of the th order statistic is calculated using the formula:
where and are the mean and standard deviation of the th order statistic, respectively.
The skewness of the th order statistic.
# Skewness of the 3rd order statistic for a uniform distribution skewOS(3, 10, "unif")# Skewness of the 3rd order statistic for a uniform distribution skewOS(3, 10, "unif")
This function computes the variance of order statistics for a given distribution.
varOS(r, n, dist = c("unif", "exp", "weibull", "tri", "topple"), ...)varOS(r, n, dist = c("unif", "exp", "weibull", "tri", "topple"), ...)
r |
rank(s) of the desired order statistic(s) (e.g., |
n |
sample size from which the order statistic is derived. |
dist |
a character string specifying the name of a distribution. Supported values are:
|
... |
further arguments to be passed to |
This function computes the variance of the th order statistic ()
for a given sample size (n) and distribution (dist). The variance is calculated using:
The variance of the th order statistic.
# Variance of the 3rd order statistic in a sample of size 10 from a uniform distribution varOS(r = 3, n = 10, dist = "unif")# Variance of the 3rd order statistic in a sample of size 10 from a uniform distribution varOS(r = 3, n = 10, dist = "unif")