| 96 | } |
| 97 | |
| 98 | pub fn get_sadf( |
| 99 | _series: &[f64], |
| 100 | _model: &str, |
| 101 | _add_const: bool, |
| 102 | _min_length: usize, |
| 103 | _lags: SadfLags, |
| 104 | ) -> StructuralBreakResult<Vec<f64>> { |
| 105 | let (x, y, indices) = get_y_x(_series, _model, _lags, _add_const)?; |
| 106 | if y.len() <= _min_length { |
| 107 | return Ok(Vec::new()); |
| 108 | } |
| 109 | |
| 110 | let mut sadf_values = Vec::with_capacity(y.len().saturating_sub(_min_length)); |
| 111 | for (pos, _) in indices.iter().enumerate().skip(_min_length) { |
| 112 | let x_subset = x[..=pos].to_vec(); |
| 113 | let y_subset = y[..=pos].to_vec(); |
| 114 | let value = get_sadf_at_t(&x_subset, &y_subset, _min_length)?; |
| 115 | sadf_values.push(value); |
| 116 | } |
| 117 | |
| 118 | Ok(sadf_values) |
| 119 | } |
| 120 | |
| 121 | pub fn _get_values_diff( |
| 122 | test_type: &str, |