mcframework.stats_engine.mse_to_target#

mcframework.stats_engine.mse_to_target(x: ndarray, ctx: StatsContext) float[source]#

Mean squared error of \(\bar X\) relative to a target \(\theta\).

Estimates the MSE of the sample mean \(\bar X\) as an estimator of \(\theta\):

\[\mathrm{MSE}(\bar X) \approx \frac{s^2}{n_\text{eff}} + (\bar X - \theta)^2,\]

i.e. the variance of the sample mean plus the squared bias. When the variance cannot be estimated (\(n_\text{eff} \le \texttt{ddof}\)), only the squared-bias term is returned.

Parameters:
xndarray

Input sample.

ctxStatsContext or Mapping

Requires target.

Returns:
float

Estimated mean squared error of \(\bar X\) relative to target.