The hardware and bandwidth for this mirror is donated by METANET, the Webhosting and Full Service-Cloud Provider.
If you wish to report a bug, or if you are interested in having us mirror your free-software or open-source project, please feel free to contact us at mirror[@]metanet.ch.
The mos
package provides a suite of tools to work with
order statistics, including:
These tools are useful for researchers in statistics, reliability, and simulation studies.
You can simulate order statistics from continuous distributions using
the ros()
function. This function accepts either:
qf
argument.ros(3, 1:5, 5, dist = "unif", min = 1, max = 5)
#> r1 r2 r3 r4 r5
#> [1,] 2.732895 3.152392 3.458109 4.788939 4.999965
#> [2,] 1.058484 2.108461 2.692568 2.955375 3.435296
#> [3,] 2.379856 3.149699 3.490129 4.195683 4.877305
The package provides two categories of moment computation:
The following distributions have closed-form expressions for moments:
b
and
k <= 2
)b
or
k > 2
)In all simulation-based cases, the ros()
function is
used internally to generate the order statistics.
The mos
package supports simulation of censored data
using several standard censoring schemes:
Observations are censored beyond a fixed time limit.
The smallest r
values are observed (i.e., censoring
after a fixed number of failures).
Implements progressive removal of remaining items based on a censoring scheme.
rpcens2(n = 10, R = c(2, 1, 2, 0, 0), dist = "exp", rate = 1)
#> [1] 0.02910825 0.15546476 0.31029202 0.47766020 0.86184076
This is useful in reliability experiments where censoring occurs at each failure stage.
The rkrec()
function generates upper and lower k-records
from continuous distributions.
This section compares analytical and simulated values of the second moment, variance, skewness, and kurtosis of order statistics from the Uniform(0,1) distribution:
if (requireNamespace("moments", quietly = TRUE)) {
library(moments)
set.seed(123)
x <- ros(1e4, r = 1:25, n = 25, dist = "unif")
observed <- colMeans(x^2)
expected <- mo_unif(r = 1:25, n = 25, k = 2, a = 0, b = 1)
oldpar <- par(mfrow = c(2, 2))
on.exit(par(oldpar))
plot(observed, expected, main = "2nd Moment of U(0,1)", xlab = "Observed", ylab = "Expected")
abline(0, 1, col = 2)
var_obs <- apply(x, 2, var)
var_expc <- varOS(1:25, 25, dist = "unif", a = 0, b = 1)
plot(var_obs, var_expc, main = "Variance of Order Statistics from U(0,1)",
xlab = "Observed", ylab = "Expected")
abline(0, 1, col = 2)
skew_obs <- apply(x, 2, moments::skewness)
skew_expc <- skewOS(1:25, 25, dist = "unif", a = 0, b = 1)
plot(skew_obs, skew_expc, main = "Skewness of Order Statistics from U(0,1)",
xlab = "Observed", ylab = "Expected")
abline(0, 1, col = 2)
kurt_obs <- apply(x, 2, moments::kurtosis)
kurt_expc <- kurtOS(1:25, 25, dist = "unif", a = 0, b = 1)
plot(kurt_obs, kurt_expc, main = "Kurtosis of Order Statistics from U(0,1)",
xlab = "Observed", ylab = "Expected")
abline(0, 1, col = 2)
}
The plots show a strong alignment between the observed and expected
values along the identity line. This suggests that the order statistics
simulated from the Uniform(0,1) distribution closely follow their
theoretical moments. Such alignment in graphical comparisons is often
taken as visual evidence of a good fit between observed data and the
theoretical model.
The mos
package integrates analytical and
simulation-based methods for working with order statistics, censored
data, and record values. It serves as a powerful and flexible toolkit
for statisticians, particularly those involved in reliability analysis
and the study of ordered data.
These binaries (installable software) and packages are in development.
They may not be fully stable and should be used with caution. We make no claims about them.