pflm.fpca.utils.get_measurement_error_variance#
- get_measurement_error_variance(raw_cov: ndarray, reg_grid: ndarray, bandwidth: float, kernel_type: KernelType) float[source][source]#
Estimate measurement error variance from raw covariance near the diagonal.
Smooths the raw covariance surface along the diagonal and leverages that the theoretical covariance at zero-lag equals the process variance, while the observed raw covariance includes measurement error. The difference (or an extrapolation to zero lag) yields an estimate of the noise variance.
- Parameters:
- raw_covnp.ndarray of shape (M, 5)
Raw covariance entries (sid, t1, t2, w, cov).
- reg_gridnp.ndarray of shape (nt,)
Regular grid used to evaluate the smoothed covariance.
- bandwidthfloat
Positive bandwidth for the smoothing kernel.
- kernel_typeKernelType
Kernel used during smoothing.
- Returns:
- sigma2float
Estimated measurement error variance.
- Raises:
- ValueError
If inputs are inconsistent or bandwidth is invalid.
See also
rotate_polyfit2d2D local polynomial smoothing on rotated grids.