ttest: Perform bootstrap or Monte Carlo t-tests on the NRMSE...

View source: R/utils.R

ttestR Documentation

Perform bootstrap or Monte Carlo t-tests on the NRMSE statistic from the CLSP estimator.

Description

This function either (a) resamples residuals via a nonparametric bootstrap to generate an empirical NRMSE sample, or (b) produces synthetic right-hand side vectors b from a user-defined or default distribution and re-estimates the model. It tests whether the observed NRMSE significantly deviates from the null distribution of resampled or simulated NRMSE values.

Usage

ttest(
  object,
  reset = FALSE,
  sample_size = 50L,
  seed = NULL,
  distribution = NULL,
  partial = FALSE,
  simulate = FALSE
)

Arguments

object

An object of class "clsp".

reset

Logical, default = FALSE. If TRUE, forces recomputation of the NRMSE null distribution.

sample_size

Integer, default = 50. Size of the Monte Carlo simulated sample under H0.

seed

Integer or NULL, default = NULL. Optional random seed to override the default.

distribution

Function or NULL, default = NULL. Distribution for generating synthetic b vectors. One of: rnorm, runif, or a custom RNG function. Defaults to standard normal.

partial

Logical, default = FALSE. If TRUE, runs the t-test on the partial NRMSE: during simulation, the C-block entries are preserved and the M-block entries are simulated.

simulate

Logical, default = FALSE. If TRUE, performs a parametric Monte Carlo simulation by generating synthetic right-hand side vectors b. If FALSE (default), executes a nonparametric bootstrap procedure on residuals without re-estimation.

Value

A named list containing test results and null distribution statistics:

p_one_left

P(nrmse \le null mean)

p_one_right

P(nrmse \ge null mean)

p_two_sided

2-sided t-test p-value

nrmse

Observed value

mean_null

Mean of null distribution

std_null

Standard deviation of null distribution


rclsp documentation built on Feb. 19, 2026, 5:07 p.m.