pflm.fpca.utils.get_raw_cov#
- get_raw_cov(flatten_func_data: FlattenFunctionalData, mu: ndarray) ndarray[source][source]#
Compute per-subject raw covariance entries on the observation grid.
For each subject, this function forms all within-subject pairs and computes raw covariance entries (y_i(t1) - mu(t1)) * (y_i(t2) - mu(t2)) with the associated subject id and per-subject weight, returning a compact table suitable for later binning/aggregation.
- Parameters:
- flatten_func_dataFlattenFunctionalData
Flattened dataset with fields y, t, w, tid, unique_sid, and sid_cnt. The unique_tid field defines the observation grid ordering.
- munp.ndarray of shape (nt,)
Mean evaluated on the observation grid flatten_func_data.unique_tid.
- Returns:
- raw_covnp.ndarray of shape (M, 5)
Columns ordered as (sid, t1, t2, w, cov), where M is the total number of within-subject pairs across all subjects.
- Raises:
- ValueError
If the length of mu does not match the number of unique time points.
See also
get_covariance_matrixMap raw covariance entries to a dense matrix.
Notes
The output is not yet symmetrized nor aggregated; use get_covariance_matrix to map these entries to a dense symmetric matrix.
The weight column w typically reflects subject-level weights expanded to pairwise entries.