Learn R Programming

refund (version 0.1-40)

make_random_truth_generator: Create random truth generator with P-spline prior

Description

Generates reproducible random truth functions by sampling from P-spline priors. Uses the same penalty structure as mgcv, so wiggliness maps to effective degrees of freedom. Truth is in the B-spline span, avoiding approximation bias.

Usage

make_random_truth_generator(
  yind,
  xind,
  z_ref = NULL,
  wiggliness = 1,
  k_truth = list()
)

Value

List with generator functions for each term type.

Arguments

yind

Response grid points.

xind

Functional covariate grid points.

z_ref

Reference z values for smooth terms.

wiggliness

Controls smoothness (default: 1). Higher = more wiggly. Typical range: 0.001 (very smooth) to 10 (very wiggly).

k_truth

List with basis dimensions per term type. Defaults: ff_s = 8, ff_t = 8, smooth_z = 8, smooth_t = 8, linear = 8, intercept = 8, concurrent = 8.