| Title: | Step-by-Step Derivation and Simulation Verification in Mathematical Statistics |
| Version: | 0.1.0 |
| 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). |
| License: | MIT + file LICENSE |
| Encoding: | UTF-8 |
| Language: | en-US |
| Depends: | R (≥ 4.0.0) |
| Imports: | grDevices, graphics, stats |
| Suggests: | knitr, rmarkdown, testthat (≥ 3.0.0) |
| RoxygenNote: | 7.3.3 |
| URL: | https://github.com/Jokhrof042/StatDeriveR |
| BugReports: | https://github.com/Jokhrof042/StatDeriveR/issues |
| NeedsCompilation: | no |
| Packaged: | 2026-04-06 16:12:14 UTC; lenovo |
| Author: | Jokhrof Ahmed Doha [aut, cre] |
| Maintainer: | Jokhrof Ahmed Doha <s-2021711817@isrt.du.ac.bd> |
| Repository: | CRAN |
| Date/Publication: | 2026-04-10 14:00:02 UTC |
Get CDF function for a distribution
Description
Get CDF function for a distribution
Usage
.cdf_eval(dist, params)
Arguments
dist |
Character name of distribution |
params |
List of distribution parameters |
Value
A function that evaluates the cdf
Compute theoretical mean of order statistic
Description
Compute theoretical mean of order statistic
Usage
.compute_orderstat_mean(dist, params, n, r)
Compute theoretical variance of order statistic
Description
Compute theoretical variance of order statistic
Usage
.compute_orderstat_var(dist, params, n, r)
Default parameters for distribution
Description
Default parameters for distribution
Usage
.default_params(dist)
Arguments
dist |
Distribution name |
Value
List of default parameters
Derive Y = exp(X)
Description
Derive Y = exp(X)
Usage
.derive_exp_x(dist, params, support)
Derive Y = 1/X
Description
Derive Y = 1/X
Usage
.derive_inv_x(dist, params, support)
Derive Y = log(X)
Description
Derive Y = log(X)
Usage
.derive_log_x(dist, params, support)
Derive Y = sqrt(X)
Description
Derive Y = sqrt(X)
Usage
.derive_sqrt_x(dist, params, support)
Derive Y = X^2
Description
Derive Y = X^2
Usage
.derive_x_squared(dist, params, support)
Format distribution for printing
Description
Format distribution for printing
Usage
.format_dist(dist, params)
Arguments
dist |
Distribution name |
params |
Parameters |
Value
Formatted string
Get PDF function for a distribution
Description
Get PDF function for a distribution
Usage
.pdf_eval(dist, params)
Arguments
dist |
Character name of distribution |
params |
List of distribution parameters |
Value
A function that evaluates the pdf
Plot order statistic with theory vs simulation
Description
Plot order statistic with theory vs simulation
Usage
.plot_orderstat(x)
Plot transformation with theory vs simulation
Description
Plot transformation with theory vs simulation
Usage
.plot_transform(x)
Print order statistic derivation
Description
Print order statistic derivation
Usage
.print_orderstat(x)
Print simulation results
Description
Print simulation results
Usage
.print_simulation(x)
Print transformation derivation
Description
Print transformation derivation
Usage
.print_transform(x)
Get random number generator
Description
Get random number generator
Usage
.rng_eval(dist, params, n)
Arguments
dist |
Character name of distribution |
params |
List of distribution parameters |
n |
Number of observations |
Value
Vector of random values
Simulate order statistic
Description
Simulate order statistic
Usage
.simulate_orderstat(object, n_sim)
Simulate transformed variable
Description
Simulate transformed variable
Usage
.simulate_transform(object, n_sim)
Get support of a distribution
Description
Get support of a distribution
Usage
.support_eval(dist, params)
Arguments
dist |
Character name of distribution |
params |
List of distribution parameters |
Value
List with lower and upper bounds
Derive the distribution of an order statistic
Description
Derive the distribution of an order statistic
Usage
derive_orderstat(dist, params, n, r)
Arguments
dist |
Character: base distribution name |
params |
List: distribution parameters |
n |
Integer: sample size |
r |
Integer: order (1 = min, n = max) |
Value
Object of class "statderive" with order statistic derivation
Examples
# 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
Description
Derive the distribution of a transformed random variable
Usage
derive_transform(dist, params, transform, support = NULL)
Arguments
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 |
Value
Object of class "statderive" with derivation steps
Examples
# Transform Y = X^2 where X ~ Uniform(0,1)
obj <- derive_transform(
dist = "uniform",
params = list(min = 0, max = 1),
transform = "x^2"
)
Imported functions
Description
Internal imports required for package checks.
Plot method for statderive objects
Description
Plot method for statderive objects
Usage
## S3 method for class 'statderive'
plot(x, y = NULL, ...)
Arguments
x |
Object of class "statderive" |
y |
Unused (required for S3 plot method) |
... |
Additional arguments |
Value
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
Description
Print method for statderive objects
Usage
## S3 method for class 'statderive'
print(x, ...)
Arguments
x |
Object of class "statderive" |
... |
Additional arguments |
Value
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
Description
Run Monte Carlo simulation and compare with theory
Usage
simulate_check(object, n_sim = 10000, seed = 123)
Arguments
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 |
Value
Updated object with simulation results added
Examples
obj <- derive_transform("uniform", list(min = 0, max = 1), "x^2")
obj_sim <- simulate_check(obj, n_sim = 5000)