ros | R Documentation |
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, ...)
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")
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.