| Title: | Step-by-Step Derivation and Simulation Verification in Mathematical Statistics |
|---|---|
| Description: | Provides step-by-step derivations of key results in mathematical statistics, including transformations of random variables, order statistics, and sampling distributions. The package combines analytical derivation with Monte Carlo simulation to compare theoretical and empirical results, facilitating deeper understanding of statistical theory and its computational implementation. The methods are motivated by standard treatments in mathematical statistics (Hogg, McKean, and Craig, 2019, ISBN: 9780134686991). |
| Authors: | Jokhrof Ahmed Doha [aut, cre] |
| Maintainer: | Jokhrof Ahmed Doha <[email protected]> |
| License: | MIT + file LICENSE |
| Version: | 0.1.0 |
| Built: | 2026-06-10 07:29:38 UTC |
| Source: | https://github.com/cran/StatDeriveR |
Derive the distribution of an order statistic
derive_orderstat(dist, params, n, r)derive_orderstat(dist, params, n, r)
dist |
Character: base distribution name |
params |
List: distribution parameters |
n |
Integer: sample size |
r |
Integer: order (1 = min, n = max) |
Object of class "statderive" with order statistic derivation
# Minimum of 5 exponential(rate=2) samples obj <- derive_orderstat( dist = "exponential", params = list(rate = 2), n = 5, r = 1 )# Minimum of 5 exponential(rate=2) samples obj <- derive_orderstat( dist = "exponential", params = list(rate = 2), n = 5, r = 1 )
Derive the distribution of a transformed random variable
derive_transform(dist, params, transform, support = NULL)derive_transform(dist, params, transform, support = NULL)
dist |
Character: base distribution name |
params |
List: distribution parameters |
transform |
Character: transformation (e.g., "x^2", "sqrt(x)", "1/x") |
support |
Optional vector c(lower, upper) for original support |
Object of class "statderive" with derivation steps
# Transform Y = X^2 where X ~ Uniform(0,1) obj <- derive_transform( dist = "uniform", params = list(min = 0, max = 1), transform = "x^2" )# Transform Y = X^2 where X ~ Uniform(0,1) obj <- derive_transform( dist = "uniform", params = list(min = 0, max = 1), transform = "x^2" )
Plot method for statderive objects
## S3 method for class 'statderive' plot(x, y = NULL, ...)## S3 method for class 'statderive' plot(x, y = NULL, ...)
x |
Object of class "statderive" |
y |
Unused (required for S3 plot method) |
... |
Additional arguments |
Invisibly returns the input object x (of class
statderive). This function is called primarily for its side effect
of producing plots that compare simulated data with theoretical
probability density functions.
Print method for statderive objects
## S3 method for class 'statderive' print(x, ...)## S3 method for class 'statderive' print(x, ...)
x |
Object of class "statderive" |
... |
Additional arguments |
Invisibly returns the input object x (of class
statderive). This function is called primarily for its side effect
of printing a formatted summary of the statistical derivation and optional
simulation results.
Run Monte Carlo simulation and compare with theory
simulate_check(object, n_sim = 10000, seed = 123)simulate_check(object, n_sim = 10000, seed = 123)
object |
Object of class "statderive" from derive_transform or derive_orderstat |
n_sim |
Integer: number of simulations (default 10000) |
seed |
Integer: random seed for reproducibility |
Updated object with simulation results added
obj <- derive_transform("uniform", list(min = 0, max = 1), "x^2") obj_sim <- simulate_check(obj, n_sim = 5000)obj <- derive_transform("uniform", list(min = 0, max = 1), "x^2") obj_sim <- simulate_check(obj, n_sim = 5000)