small_metrics: Small Sample Metrics

View source: R/03_metrics.R

small_metricsR Documentation

Small Sample Metrics


This function performs Monte Carlo simulations to estimate the main metrics (bias, variance, and RMSE) characterizing the small sample behavior of an estimator. The function evaluates the metrics as a function of a single parameter, keeping the other ones constant. See Details.


  est = c("same", "me", "mle"),
  obs = c(20, 50, 100),
  sam = 10000,
  seed = 1,



A subclass of Distribution. The distribution family of interest.


A list containing three elements (name, pos, val). See Details.


character. The estimator of interest. Can be a vector.


numeric. The size of each sample. Can be a vector.


numeric. The number of Monte Carlo samples used to estimate the metrics.


numeric. Passed to set.seed() for reproducibility.


extra arguments.


The distribution D is used to specify an initial distribution. The list prm contains details concerning a single parameter that is allowed to change values. The quantity of interest is evaluated as a function of this parameter.

Specifically, prm includes three elements named "name", "pos", and "val". The first two elements determine the exact parameter that changes, while the third one is a numeric vector holding the values it takes. For example, in the case of the Multivariate Gamma distribution, D <- MGamma(shape = c(1, 2), scale = 3) and prm <- list(name = "shape", pos = 2, val = seq(1, 1.5, by = 0.1)) means that the evaluation will be performed for the MGamma distributions with shape parameters ⁠(1, 1)⁠, ⁠(1, 1.1)⁠, ..., ⁠(1, 1.5)⁠ and scale 3. Notice that the initial shape parameter 2 in D is not utilized in the function.


For the small sample, a data.frame with columns named "Parameter", "Observations", "Estimator", "Metric", and "Value". For the large sample, a data.frame with columns "Row", "Col", "Parameter", "Estimator", and "Value".

See Also

plot_small_metrics large_metrics, plot_large_metrics


D <- Beta(shape1 = 1, shape2 = 2)

prm <- list(name = "shape1",
            pos = NULL,
            val = seq(0.5, 2, by = 0.5))

x <- small_metrics(D, prm,
                   est = c("mle", "me", "same"),
                   obs = c(20, 50),
                   sam = 1e2,
                   seed = 1)


estimators documentation built on May 29, 2024, 8:57 a.m.