Learn R Programming

mos (version 0.1.3)

mo_norm: Moments of Order Statistics from the Normal Distribution (Simulated)

Description

This function computes the moments of order statistics from the normal distribution using simulation.

Usage

mo_norm(r, n, k = 1, mean = 0, sd = 1, rep = 1e+05, seed = 42)

Value

The estimated \(k\)th moment of the \(r\)th order statistic from a normal distribution.

Arguments

r

rank of the desired order statistic (e.g., 1 for the smallest order statistic).

n

sample size from which the order statistic is derived.

k

order of the moment to compute (default is 1).

mean

mean of the normal distribution (default is 0).

sd

standard deviation of the normal distribution (default is 1).

rep

number of simulations (default is 1e5).

seed

optional seed for random number generation to ensure reproducibility (default is 42).

Details

This function estimates the \(k\)th moment of the \(r\)th order statistic in a sample of size \(n\) drawn from a normal distribution with the specified mean and standard deviation. The estimation is done via Monte Carlo simulation using the formula:

$$\text{E}[X^k] \approx \frac{1}{\mathrm{rep}} \sum_{i=1}^{\mathrm{rep}} X_i^k,$$ where \(X_i\) are the simulated order statistics obtained from the normal distribution.

The function relies on the ros() function to generate order statistics.

See Also

ros

Examples

Run this code
# 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)

Run the code above in your browser using DataLab