pub struct LaggedFrame { /* private fields */ }Expand description
Pre-materialized lagged frame: one contiguous column per (variable, lag).
Layout is column-major over slots variable_slot * (max_lag + 1) + lag.
Per-column ValidityBitmaps record whether each effective row’s source
sample passed analysis-mask ∩ column-validity (under the build options).
Implementations§
Source§impl LaggedFrame
impl LaggedFrame
Sourcepub fn from_series(
data: &TimeSeriesData,
variables: &[VariableId],
max_lag: u32,
policy: &KernelPolicy,
) -> Result<Self, DataError>
pub fn from_series( data: &TimeSeriesData, variables: &[VariableId], max_lag: u32, policy: &KernelPolicy, ) -> Result<Self, DataError>
Materialize all lags 0..=max_lag for variables from data.
Uses LaggedFrameOptions::default (Honor analysis mask + CompleteCase).
§Errors
Empty variable list, invalid lag map, missing/non-float64 columns, or
ErrorOnMissing when a source column has nulls.
Sourcepub fn from_series_with_reference(
data: &TimeSeriesData,
variables: &[VariableId],
max_lag: u32,
reference: ReferencePointPolicy,
policy: &KernelPolicy,
) -> Result<Self, DataError>
pub fn from_series_with_reference( data: &TimeSeriesData, variables: &[VariableId], max_lag: u32, reference: ReferencePointPolicy, policy: &KernelPolicy, ) -> Result<Self, DataError>
Materialize lagged columns under an explicit reference-point policy.
§Errors
Empty variable list, invalid lag map, missing/non-float64 columns, or
ErrorOnMissing when a source column has nulls.
Sourcepub fn from_series_with_options(
data: &TimeSeriesData,
variables: &[VariableId],
max_lag: u32,
reference: ReferencePointPolicy,
options: LaggedFrameOptions,
policy: &KernelPolicy,
) -> Result<Self, DataError>
pub fn from_series_with_options( data: &TimeSeriesData, variables: &[VariableId], max_lag: u32, reference: ReferencePointPolicy, options: LaggedFrameOptions, policy: &KernelPolicy, ) -> Result<Self, DataError>
Materialize lagged columns with explicit mask / missingness policies.
§Errors
Empty variable list, invalid lag map, missing/non-float64 columns, or
ErrorOnMissing when a source column has nulls.
Sourcepub fn variables(&self) -> &[VariableId]
pub fn variables(&self) -> &[VariableId]
Variables in slot order.
Sourcepub const fn n_effective(&self) -> usize
pub const fn n_effective(&self) -> usize
Effective aligned sample count.
Sourcepub fn is_fully_valid(&self) -> bool
pub fn is_fully_valid(&self) -> bool
Whether every lagged column is fully valid (fast path for unmasked series).
Sourcepub fn values_bytes(&self) -> u64
pub fn values_bytes(&self) -> u64
Byte size of the gathered value buffer.
Sourcepub fn column_index(&self, variable: VariableId, lag: Lag) -> Option<usize>
pub fn column_index(&self, variable: VariableId, lag: Lag) -> Option<usize>
Dense column index for (variable, lag), or None if unknown / out of range.
Sourcepub fn column_valid(&self, idx: usize) -> &ValidityBitmap
pub fn column_valid(&self, idx: usize) -> &ValidityBitmap
Sourcepub fn keep_mask_for_columns(
&self,
cols: &[usize],
) -> Result<Vec<bool>, DataError>
pub fn keep_mask_for_columns( &self, cols: &[usize], ) -> Result<Vec<bool>, DataError>
Keep-mask for a set of lagged column indexes: AND of their validity bitmaps.
§Errors
Empty column list or out-of-range index.
Sourcepub fn retain_effective(&self, keep: &[bool]) -> Result<Self, DataError>
pub fn retain_effective(&self, keep: &[bool]) -> Result<Self, DataError>
Compact to effective rows where keep[i] is true.
Used for regime-masked CI: the full series is materialized first so lag alignment is correct, then only windows wholly inside a regime are retained.
§Errors
Length mismatch or empty keep set.
Sourcepub fn stack(frames: &[Self]) -> Result<Self, DataError>
pub fn stack(frames: &[Self]) -> Result<Self, DataError>
Vertically stack frames that share the same variable list and max lag.
Used for multi-environment pooling without lag windows crossing env boundaries.
§Errors
Empty input, or mismatched variables / max_lag across frames.
Sourcepub fn append_constant_lag_columns(
&self,
columns: &[(VariableId, Vec<f64>)],
) -> Result<Self, DataError>
pub fn append_constant_lag_columns( &self, columns: &[(VariableId, Vec<f64>)], ) -> Result<Self, DataError>
Append variables whose values are constant across lags (space/time dummies).
Each entry is (variable_id, contemporaneous column) of length n_effective.
The same values are copied into every lag slot so MCI can index any lag;
link assumptions should still forbid lagged parents of space/time dummies.
Appended columns are marked all-valid.
§Errors
Length mismatch, duplicate variable id, or empty column list.
Trait Implementations§
Source§impl Clone for LaggedFrame
impl Clone for LaggedFrame
Source§fn clone(&self) -> LaggedFrame
fn clone(&self) -> LaggedFrame
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read more