diff --git a/CHANGELOG.md b/CHANGELOG.md index 062a69412..7886cd19c 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -13,6 +13,7 @@ All notable changes to TEPP are documented here. The format follows Keep a Chang - **TDT/CHRONOS durable result contract**: canonical typed JSON and deterministic GraphML now export the actual bounded Allen reasoner result, observed/derived status, and conservative accepted-assertion support; canonical payload digest and `tdt_chronos_interval_consistency_v1` type bind the immutable bytes into ADR 0013's append-only `model_artifact` chain. - **Analysis engine**: deterministic end-to-end analysis-run execution with cutoff-safe eligibility, immutable evidence binding, and reproducibility manifests (`analysis_engine` crate). - **Restore Driver p.16 `MANIFESTVARstd`**: `recover_standardised_manifest_variance` maps `θ / θ = 1` with strictly positive `MANIFESTVAR`, refusing unstandardised manifest-variance, `MANIFESTTRAITVARstd`, and Equation 5 `Var(y)` substitutions (`psychometric_core`). +- **Restore Driver p.16 `TIPREDEFFECTstd`**: `recover_standardised_time_independent_predictor_effect` maps `B · √v / √p` after strictly positive `asymDIFFUSION` and `TIPREDVAR`, refusing unstandardised `B`, `asymTIPREDEFFECTstd`, finite-interval `A^{-1}[e^{A Δt} − I] B · √v / √p`, and trait-contaminated total-variance substitutions (`psychometric_core`). - **Posterior network estimator**: cross-draw Pearson correlations in ILR space, jackknife SE and CI, Benjamini–Hochberg FDR edge admission, nonparametric bootstrap stability, greedy modularity consensus clustering (`network_analysis` crate). - **Topic measurement reference estimator**: bounded deterministic CPU `f64` TRSL-TM fitting with ALR/ILR coordinates, Aitchison distance, and lexical-inferential-weight refusal gates (`topic_measurement` crate). - **Psychometric core**: Driver et al. (2017) SDE discrete-time recovery suite including drift, diffusion, T0VAR, TIPRED/TDPRED effects, standardised parameters, trait/state variance decomposition, and observed-indicator mapping — 18 K lines of production Rust with true-parameter RMSE tests. @@ -40,6 +41,7 @@ All notable changes to TEPP are documented here. The format follows Keep a Chang - `event_core` adds bounded Allen interval-consistency classification, atomic path-consistency closure, contradiction/resource refusals, and an explicit dependency-error fallback without claiming unrestricted global satisfiability. +- `psychometric_core` recovers the Driver, Oud, and Voelkle (2017, p. 16 `TIPREDEFFECTstd`; §7.2, pp. 20–21; Eq. 3, p. 5; Table 2, p. 12; footnote 4; 2017-era ctsem `summary.ctsemFit.R`; JSS PDF re-opened 2026-08-29T14:20Z from https://www.jstatsoft.org/index.php/jss/article/download/v077i05/1104) scalar standardised continuous time-independent predictor effect rebased onto protected `main` `6444a81` after `0ce16e8` dropped the pre-consolidation code while research notes already named the map (register items 65–66). Page 16 prints continuous-time parameters and, when appropriate, standardised matrices with the suffix `std`. The printed example on p. 16 is `discreteDRIFTstd`, not `TIPREDEFFECTstd`. Footnote 4 standardises using only the relevant variance, not the total. Table 2 names `B` `TIPREDEFFECT`. The affecting variance is predictor variance `TIPREDVAR` `v`. The affected variance is within-subject `asymDIFFUSION` `p = −q / (2 a)`, because the process dynamics are individual, or average individual, temporal dynamics. The 2017-era source forms the standardiser `sqrt(diag(TIPREDVAR)) / sqrt(diag(asymDIFFUSION))` (comment: "sqrt of affecting latent variance divided by sqrt of affected") and uses it for `asymTIPREDEFFECTstd` whenever `verbose = TRUE`. That source does not form a `TIPREDEFFECTstd` matrix; the scalar map here is the footnote 4 standardisation of the named Table 2 coefficient: `B · √v / √p`. Form strictly positive `p` first, then strictly positive `v`, then the continuous coefficient, then the SD ratio. A zero coefficient with positive `v` and `p` is exactly zero. Unstandardised `B` is defined for a zero coefficient and for zero predictor variance; standardised `TIPREDEFFECT` is not. Zero `v` has no positive predictor SD and fails closed. Zero `q` has no positive process SD and fails closed. Lasting `p` requires stable `a < 0`. `TIPREDEFFECT` is an event-time process-dynamics quantity, so a non-event clock fails closed. A larger positive `q` yields a smaller `|std|`. The asymptotic standardisation `(-B / a) · √v / √p` is the `Δt → ∞` total-change map and is not this continuous coefficient. The finite-interval standardisation `A^{-1}[e^{A Δt} − I] B · √v / √p` depends on the event interval and is not this continuous map. `B · √v / √(trait + p + added)` uses the total, not `asymDIFFUSION`, and is not `TIPREDEFFECTstd` when `TRAITVAR` is nonzero. `TRAITVAR` is not the standardisation variance. Independent of open `#299` `asymTIPREDEFFECTstd`, `#298` `DRIFTstd`, `#280` `discreteDRIFTstd`, `#296` `discreteDIFFUSIONstd`, `#297` `DIFFUSIONstd`, and `#272` `TIPREDVARstd`. Meredith (1993) remains unread (web search 2026-08-29T14:20Z: Springer/Cambridge Core paywalled; Unpaywall this cycle `is_oa: false`; Springer `content/pdf` is an HTML stub). Mislevy (1991, *Psychometrika, 56*, 177–196) remains unread on the same terms (DOI `10.1007/bf02294457`; Unpaywall this cycle `is_oa: false`). Still not a Kalman filter, not a matrix `expm`, not ESEM estimation, not DSEM, and not ctsem estimation. - `psychometric_core` recovers the Driver, Oud, and Voelkle (2017, Table 2, p. 12 `MANIFESTTRAITVAR`; §7.1, p. 19; p. 16 `MANIFESTTRAITVARstd`; footnote 4; 2017-era ctsem `summary.ctsemFit.R`; JSS PDF re-opened 2026-08-27T14:20Z from https://www.jstatsoft.org/index.php/jss/article/download/v077i05/1104) scalar standardised manifest-trait variance on current main after `0ce16e8` dropped the pre-consolidation code while research notes already named the map (register items 83–84). Table 2 names `MANIFESTTRAITVAR` `Ψ_τ` the additional time-invariant variance-covariance on the measurement level and sets it `NULL` when there is no manifest trait. Equation 5 writes `Γ ~ N(τ, Ψ)` and names that covariance the manifest traits. Section 7.1 names manifest traits stable individual differences in indicator levels, distinct from process-level `TRAITVAR` `φ_ξ`. Page 16 prints standardised matrices with the suffix `std` when appropriate. The printed example on p. 16 is `discreteDRIFTstd`, not `MANIFESTTRAITVARstd`. Footnote 4 standardises using only the relevant variance, not the total. The relevant variance for that named indicator-level correlation is `MANIFESTTRAITVAR`, not process-level `TRAITVAR` and not residual `MANIFESTVAR` `θ`. The 2017-era source forms `MANIFESTTRAITVARstd` only when `MANIFESTTRAITVAR != 0`, as `solve(sqrt(diag(MANIFESTTRAITVAR) + ridging)) %&% MANIFESTTRAITVAR` when `verbose = TRUE`. OpenMx `%&%` is `t(A) %*% B %*% A`. Unlike `TRAITVARstd`, that formation adds `diag(c(ridging), n.manifest)`. The default `ridging = FALSE` adds 0, not `0.0001`; that ridge is a numerical hack and is not this exact map. The scalar correlation is `ψ / ψ = 1` after strictly positive `MANIFESTTRAITVAR`. Form strictly positive `ψ` first, then `1 / √ψ`, then `(1 / √ψ) ψ (1 / √ψ)`. Unstandardised `MANIFESTTRAITVAR` is defined for a zero trait; standardised `MANIFESTTRAITVAR` is not. Zero `MANIFESTTRAITVAR` skips forming `MANIFESTTRAITVARstd` in the 2017-era source and fails closed here. Indicator-level trait variance is an event-time structural quantity, so a non-event clock fails closed. `MANIFESTTRAITVAR` does not require stable `a < 0`. Distinct positive `ψ` recover the same 1. `trait / trait = 1` is `TRAITVARstd` and recovers the same number and remains a distinct named quantity. `θ` is `MANIFESTVAR` and is measurement error, not this correlation. Meredith (1993) remains unread (web search 2026-08-27T14:20Z: Springer/Cambridge Core paywalled; Unpaywall historically `is_oa: false`; Springer `content/pdf` is an HTML stub). Mislevy (1991, *Psychometrika, 56*, 177–196) remains unread on the same terms (DOI `10.1007/bf02294457`). Still not a Kalman filter, not a matrix `expm`, not ESEM estimation, not DSEM, and not ctsem estimation. - `psychometric_core` recovers the Driver, Oud, and Voelkle (2017, Table 2, p. 12 `TRAITVAR`; §7.1, pp. 18–19; p. 16 `TRAITVARstd`; footnote 4; 2017-era ctsem `summary.ctsemFit.R`; JSS PDF re-opened 2026-08-26T17:45Z from https://www.jstatsoft.org/index.php/jss/article/download/v077i05/1104) scalar standardised trait variance on current main after `0ce16e8` dropped the pre-consolidation code while research notes already named the map (register items 81–82). Table 2 names `TRAITVAR` `φ_ξ` the latent trait variance/covariance and sets it `NULL` when there is no trait. Section 7.1 names traits the stable between-subject differences (unit-level unobserved heterogeneity). Page 16 prints standardised matrices with the suffix `std` when appropriate. The printed example on p. 16 is `discreteDRIFTstd`, not `TRAITVARstd`. Footnote 4 standardises using only the relevant variance, not the total. The relevant variance for that named between-subject correlation is `TRAITVAR`, not free first-occasion `T0VAR` and not process-dynamics `asymDIFFUSION`. The 2017-era source forms `TRAITVARstd` only when `TRAITVAR != 0`, as `solve(sqrt(diag(TRAITVAR))) %&% TRAITVAR` when `verbose = TRUE`. OpenMx `%&%` is `t(A) %*% B %*% A`. Unlike `T0VARstd`, that formation uses `diag(diag(TRAITVAR))` and does not add `diag(c(ridging))`. The ridge is a `T0VAR` numerical hack and is not this exact map. The scalar correlation is `trait / trait = 1` after strictly positive `TRAITVAR`. Form strictly positive `trait` first, then `1 / √trait`, then `(1 / √trait) trait (1 / √trait)`. Unstandardised `TRAITVAR` is defined for a zero trait; standardised `TRAITVAR` is not. Zero `TRAITVAR` skips forming `TRAITVARstd` in the 2017-era source and fails closed here. Between-subject variance is an event-time structural quantity, so a non-event clock fails closed. `TRAITVAR` does not require stable `a < 0`. Distinct positive `trait` recover the same 1. `p_0 / p_0 = 1` is `T0VARstd` and recovers the same number and remains a distinct named quantity. `t0_b² v` is `addedT0TIPREDVAR` and is extra first-occasion TI variance, not this correlation. Meredith (1993) remains unread (Unpaywall 2026-08-26T17:20Z: `is_oa: false`; OpenAlex closed; Springer `content/pdf` is an HTML stub). Mislevy (1991, *Psychometrika, 56*, 177–196) remains unread on the same terms (DOI `10.1007/bf02294457`; Unpaywall `is_oa: false`). Still not a Kalman filter, not a matrix `expm`, not ESEM estimation, not DSEM, and not ctsem estimation. diff --git a/crates/psychometric_core/src/error.rs b/crates/psychometric_core/src/error.rs index 4ab2695e0..b653f3e15 100644 --- a/crates/psychometric_core/src/error.rs +++ b/crates/psychometric_core/src/error.rs @@ -710,6 +710,35 @@ pub enum PsychometricError { /// `MANIFESTVARstd`. `λ² Var(η) + θ` is `Var(y)`, not the /// correlation form of `Θ`. ObservedVarianceIsNotStandardisedManifestVariance, + /// Driver p. 16 `TIPREDEFFECTstd` was requested without a + /// strictly positive `asymDIFFUSION`. Footnote 4 standardises + /// using only the relevant within-subject variance; zero `q` + /// has no positive process SD. + StandardisedTimeIndependentEffectRequiresPositiveWithinSubjectVariance, + /// Driver p. 16 `TIPREDEFFECTstd` was requested without a + /// strictly positive `TIPREDVAR`. Footnote 4 standardises using + /// the affecting predictor variance; zero `v` has no positive + /// predictor SD. + StandardisedTimeIndependentEffectRequiresPositivePredictorVariance, + /// Driver Table 2 unstandardised `TIPREDEFFECT` `B` was treated + /// as `TIPREDEFFECTstd`. Unstandardised `B` is defined for a + /// zero coefficient and for zero predictor variance; + /// standardised `TIPREDEFFECT` is not. + UnstandardisedTimeIndependentEffectIsNotStandardisedTimeIndependentEffect, + /// Driver p. 16 `asymTIPREDEFFECTstd` `(-B / a) · √v / √p` was + /// treated as `TIPREDEFFECTstd`. The asymptotic map is the + /// `Δt → ∞` total change and is not the continuous coefficient. + AsymptoticStandardisedTimeIndependentEffectIsNotStandardisedTimeIndependentEffect, + /// Driver p. 16 finite-interval + /// `A^{-1}[e^{A Δt} − I] B · √v / √p` was treated as + /// `TIPREDEFFECTstd`. The finite-interval map depends on `Δt` + /// and is not the continuous standardisation. + DiscreteStandardisedTimeIndependentEffectIsNotStandardisedTimeIndependentEffect, + /// `B · √v / √(trait + p + added)` was treated as + /// `TIPREDEFFECTstd`. Footnote 4 uses only `asymDIFFUSION`, + /// not total variance. `TRAITVAR` is not the standardisation + /// variance. + TraitContaminatedTimeIndependentEffectIsNotStandardisedTimeIndependentEffect, } impl fmt::Display for PsychometricError { @@ -1235,6 +1264,24 @@ impl fmt::Display for PsychometricError { Self::ObservedVarianceIsNotStandardisedManifestVariance => { "observed-indicator variance is not standardised measurement-error variance" } + Self::StandardisedTimeIndependentEffectRequiresPositiveWithinSubjectVariance => { + "standardised time-independent predictor effect requires strictly positive stationary within-subject variance" + } + Self::StandardisedTimeIndependentEffectRequiresPositivePredictorVariance => { + "standardised time-independent predictor effect requires strictly positive predictor variance" + } + Self::UnstandardisedTimeIndependentEffectIsNotStandardisedTimeIndependentEffect => { + "unstandardised time-independent predictor effect is not standardised time-independent predictor effect" + } + Self::AsymptoticStandardisedTimeIndependentEffectIsNotStandardisedTimeIndependentEffect => { + "asymptotic standardised time-independent predictor effect is not standardised time-independent predictor effect" + } + Self::DiscreteStandardisedTimeIndependentEffectIsNotStandardisedTimeIndependentEffect => { + "finite-interval standardised time-independent predictor effect is not standardised time-independent predictor effect" + } + Self::TraitContaminatedTimeIndependentEffectIsNotStandardisedTimeIndependentEffect => { + "trait-contaminated time-independent predictor effect is not standardised time-independent predictor effect" + } }; formatter.write_str(message) } @@ -2073,4 +2120,38 @@ mod tests { "measurement error is not standardised manifest-trait variance" ); } + + #[test] + fn standardised_time_independent_effect_boundary_messages_are_stable() { + assert_eq!( + PsychometricError::StandardisedTimeIndependentEffectRequiresPositiveWithinSubjectVariance + .to_string(), + "standardised time-independent predictor effect requires strictly positive stationary within-subject variance" + ); + assert_eq!( + PsychometricError::StandardisedTimeIndependentEffectRequiresPositivePredictorVariance + .to_string(), + "standardised time-independent predictor effect requires strictly positive predictor variance" + ); + assert_eq!( + PsychometricError::UnstandardisedTimeIndependentEffectIsNotStandardisedTimeIndependentEffect + .to_string(), + "unstandardised time-independent predictor effect is not standardised time-independent predictor effect" + ); + assert_eq!( + PsychometricError::AsymptoticStandardisedTimeIndependentEffectIsNotStandardisedTimeIndependentEffect + .to_string(), + "asymptotic standardised time-independent predictor effect is not standardised time-independent predictor effect" + ); + assert_eq!( + PsychometricError::DiscreteStandardisedTimeIndependentEffectIsNotStandardisedTimeIndependentEffect + .to_string(), + "finite-interval standardised time-independent predictor effect is not standardised time-independent predictor effect" + ); + assert_eq!( + PsychometricError::TraitContaminatedTimeIndependentEffectIsNotStandardisedTimeIndependentEffect + .to_string(), + "trait-contaminated time-independent predictor effect is not standardised time-independent predictor effect" + ); + } } diff --git a/crates/psychometric_core/src/event_time.rs b/crates/psychometric_core/src/event_time.rs index a29bc5c18..5522583ba 100644 --- a/crates/psychometric_core/src/event_time.rs +++ b/crates/psychometric_core/src/event_time.rs @@ -4052,6 +4052,181 @@ pub fn refuse_asymptotic_time_independent_effect_as_time_dependent_impulse( Err(PsychometricError::AsymptoticTimeIndependentEffectIsNotTimeDependentImpulse) } +/// Exact scalar p. 16 `TIPREDEFFECTstd` after strictly positive +/// `asymDIFFUSION` and `TIPREDVAR`. +/// +/// Driver, Oud, and Voelkle (2017, p. 16 `TIPREDEFFECTstd`; §7.2, +/// pp. 20–21; Eq. 3, p. 5; Table 2, p. 12; footnote 4; 2017-era +/// ctsem `summary.ctsemFit.R`; JSS PDF re-opened 2026-08-29T14:20Z +/// from +/// ) +/// print continuous-time parameters and, when appropriate, +/// standardised matrices with the suffix `std`. The printed example +/// on p. 16 is `discreteDRIFTstd`, not `TIPREDEFFECTstd`. Footnote 4 +/// standardises using only the relevant variance, not the total. +/// Table 2 names `B` `TIPREDEFFECT`. The affecting variance is +/// predictor variance `TIPREDVAR` `v`. The affected variance is +/// within-subject `asymDIFFUSION` `p = −q / (2 a)`, because the +/// process dynamics are individual, or average individual, temporal +/// dynamics. The 2017-era `summary.ctsemFit.R` forms the +/// standardiser `sqrt(diag(TIPREDVAR)) / sqrt(diag(asymDIFFUSION))` +/// and uses it for `asymTIPREDEFFECTstd`. That source does not form +/// a `TIPREDEFFECTstd` matrix; the scalar map here is the footnote 4 +/// standardisation of the named Table 2 coefficient: `B · √v / √p`. +/// Form strictly positive `p` first, then strictly positive `v`, +/// then the continuous coefficient, then the SD ratio. A zero +/// coefficient with positive `v` and `p` is exactly zero. +/// Unstandardised `B` is defined for a zero coefficient and for +/// zero predictor variance; standardised `TIPREDEFFECT` is not. +/// Zero `v` has no positive predictor SD and fails closed. Zero +/// `q` has no positive process SD and fails closed. Lasting `p` +/// requires stable `a < 0`. `TIPREDEFFECT` is an event-time +/// process-dynamics quantity, so a non-event clock fails closed. A +/// larger positive `q` yields a smaller `|std|`. The asymptotic +/// standardisation `(-B / a) · √v / √p` is the `Δt → ∞` +/// total-change map and is not this continuous coefficient. The +/// finite-interval standardisation +/// `A^{-1}[e^{A Δt} − I] B · √v / √p` depends on the event +/// interval and is not this continuous map. +/// `B · √v / √(trait + p + added)` uses the total, not +/// `asymDIFFUSION`, and is not `TIPREDEFFECTstd` when `TRAITVAR` is +/// nonzero. `TRAITVAR` is not the standardisation variance. +/// Independent of open `#299` `asymTIPREDEFFECTstd`, `#298` +/// `DRIFTstd`, `#280` `discreteDRIFTstd`, `#296` +/// `discreteDIFFUSIONstd`, `#297` `DIFFUSIONstd`, and `#272` +/// `TIPREDVARstd`. This is not a Kalman filter, not a matrix +/// `expm`, not DSEM, and not ctsem estimation. +/// +/// # Errors +/// +/// Returns [`PsychometricError::EventTimeRequired`] for any +/// non-event clock, +/// [`PsychometricError::StationaryVarianceRequiresStableDrift`] +/// when `a ≥ 0`, +/// [`PsychometricError::StandardisedTimeIndependentEffectRequiresPositiveWithinSubjectVariance`] +/// when `q = 0`, +/// [`PsychometricError::StandardisedTimeIndependentEffectRequiresPositivePredictorVariance`] +/// when `v = 0`, and +/// [`PsychometricError::InvalidNumericInput`] when an input is +/// non-finite, the predictor variance is negative, or the mapped +/// product overflows. +pub fn recover_standardised_time_independent_predictor_effect( + time_independent_effect: f64, + predictor_variance: f64, + continuous_diffusion: f64, + log_rate: f64, + clock: LagClock, +) -> Result { + let within = recover_stationary_latent_variance(continuous_diffusion, log_rate, clock)?; + if within == 0.0 { + return Err( + PsychometricError::StandardisedTimeIndependentEffectRequiresPositiveWithinSubjectVariance, + ); + } + let predictor_variance = require_finite(predictor_variance)?; + if predictor_variance < 0.0 { + return Err(PsychometricError::InvalidNumericInput); + } + if predictor_variance == 0.0 { + return Err( + PsychometricError::StandardisedTimeIndependentEffectRequiresPositivePredictorVariance, + ); + } + let coefficient = require_finite(time_independent_effect)?; + if coefficient == 0.0 { + return Ok(0.0); + } + let process_sd = within.sqrt(); + let predictor_sd = predictor_variance.sqrt(); + require_finite(coefficient * predictor_sd / process_sd) +} + +/// Refuse treating unstandardised `TIPREDEFFECT` as p. 16 +/// `TIPREDEFFECTstd`. +/// +/// Unstandardised `B` is defined for a zero coefficient and for +/// zero predictor variance. Footnote 4 `TIPREDEFFECTstd` requires +/// strictly positive `asymDIFFUSION` and strictly positive +/// `TIPREDVAR`. Equal numbers when `v = p` remain distinct named +/// quantities. +/// +/// # Errors +/// +/// Always returns +/// [`PsychometricError::UnstandardisedTimeIndependentEffectIsNotStandardisedTimeIndependentEffect`]. +pub fn refuse_unstandardised_time_independent_effect_as_standardised_time_independent_effect( + unstandardised_effect: f64, + standardised_effect: f64, +) -> Result { + let _ = (unstandardised_effect, standardised_effect); + Err( + PsychometricError::UnstandardisedTimeIndependentEffectIsNotStandardisedTimeIndependentEffect, + ) +} + +/// Refuse treating p. 16 `asymTIPREDEFFECTstd` as p. 16 +/// `TIPREDEFFECTstd`. +/// +/// `(-B / a) · √v / √p` is the standardised total change. Table 2 +/// `TIPREDEFFECT` is the continuous coefficient. Equal numbers when +/// `a = −1` remain distinct named quantities. +/// +/// # Errors +/// +/// Always returns +/// [`PsychometricError::AsymptoticStandardisedTimeIndependentEffectIsNotStandardisedTimeIndependentEffect`]. +pub fn refuse_asymptotic_standardised_time_independent_effect_as_standardised_time_independent_effect( + asymptotic_standardised_effect: f64, + standardised_effect: f64, +) -> Result { + let _ = (asymptotic_standardised_effect, standardised_effect); + Err( + PsychometricError::AsymptoticStandardisedTimeIndependentEffectIsNotStandardisedTimeIndependentEffect, + ) +} + +/// Refuse treating the finite-interval standardised TI effect as +/// p. 16 `TIPREDEFFECTstd`. +/// +/// `A^{-1}[e^{A Δt} − I] B · √v / √p` depends on the event +/// interval. `B · √v / √p` is the continuous coefficient and does +/// not. +/// +/// # Errors +/// +/// Always returns +/// [`PsychometricError::DiscreteStandardisedTimeIndependentEffectIsNotStandardisedTimeIndependentEffect`]. +pub fn refuse_discrete_standardised_time_independent_effect_as_standardised_time_independent_effect( + discrete_standardised_effect: f64, + standardised_effect: f64, +) -> Result { + let _ = (discrete_standardised_effect, standardised_effect); + Err( + PsychometricError::DiscreteStandardisedTimeIndependentEffectIsNotStandardisedTimeIndependentEffect, + ) +} + +/// Refuse treating `B · √v / √(trait + p + added)` as p. 16 +/// `TIPREDEFFECTstd`. +/// +/// Footnote 4 measurement of the continuous TI effect uses +/// `asymDIFFUSION`, not total variance. `TRAITVAR` is not the +/// standardisation variance. +/// +/// # Errors +/// +/// Always returns +/// [`PsychometricError::TraitContaminatedTimeIndependentEffectIsNotStandardisedTimeIndependentEffect`]. +pub fn refuse_trait_contaminated_time_independent_effect_as_standardised_time_independent_effect( + trait_contaminated_effect: f64, + standardised_effect: f64, +) -> Result { + let _ = (trait_contaminated_effect, standardised_effect); + Err( + PsychometricError::TraitContaminatedTimeIndependentEffectIsNotStandardisedTimeIndependentEffect, + ) +} + /// Exact scalar §7.2 `addedTIPREDVAR`. /// /// Driver, Oud, and Voelkle (2017, §7.2, pp. 20–21; Eq. 3, p. 5; @@ -6891,6 +7066,7 @@ mod tests { recover_standardised_discrete_continuous_intercept, recover_standardised_initial_latent_mean, recover_standardised_initial_latent_variance, recover_standardised_manifest_mean, recover_standardised_manifest_trait_variance, + recover_standardised_time_independent_predictor_effect, recover_standardised_trait_variance, recover_stationary_initial_latent_mean, recover_stationary_initial_latent_variance, recover_stationary_initial_observed_mean, recover_stationary_initial_observed_variance, recover_stationary_lagged_latent_covariance, @@ -6908,6 +7084,7 @@ mod tests { refuse_asymptotic_continuous_intercept_observed_mean_as_stationary_initial_observed_mean, refuse_asymptotic_standardised_continuous_intercept_as_standardised_continuous_intercept, refuse_asymptotic_standardised_continuous_intercept_as_standardised_discrete_continuous_intercept, + refuse_asymptotic_standardised_time_independent_effect_as_standardised_time_independent_effect, refuse_asymptotic_time_independent_effect_as_coefficient, refuse_asymptotic_time_independent_effect_as_continuous_intercept, refuse_asymptotic_time_independent_effect_as_discrete_effect, @@ -6920,6 +7097,7 @@ mod tests { refuse_continuous_intercept_as_manifest_means, refuse_difference_quotient_as_local_rate, refuse_discrete_standardised_continuous_intercept_as_standardised_asymptotic_continuous_intercept, refuse_discrete_standardised_continuous_intercept_as_standardised_continuous_intercept, + refuse_discrete_standardised_time_independent_effect_as_standardised_time_independent_effect, refuse_evolved_observed_mean_as_after_extra_process_observed_mean, refuse_evolved_observed_mean_as_extra_process_observed_mean, refuse_evolved_observed_mean_as_impulse_carry_observed_mean, @@ -7026,6 +7204,7 @@ mod tests { refuse_time_independent_effect_as_time_varying_discrete_effect, refuse_time_independent_observed_mean_as_initial_time_dependent_observed_mean, refuse_time_independent_observed_mean_as_initial_time_independent_observed_mean, + refuse_trait_contaminated_time_independent_effect_as_standardised_time_independent_effect, refuse_trait_plus_state_lagged_covariance_as_stationary_lagged_latent_covariance, refuse_trait_scaled_continuous_intercept_as_standardised_continuous_intercept, refuse_trait_variance_as_process_noise, refuse_trait_variance_as_stationary_within_subject, @@ -7038,6 +7217,7 @@ mod tests { refuse_unstandardised_initial_latent_variance_as_standardised_initial_latent_variance, refuse_unstandardised_manifest_mean_as_standardised_manifest_mean, refuse_unstandardised_manifest_trait_variance_as_standardised_manifest_trait_variance, + refuse_unstandardised_time_independent_effect_as_standardised_time_independent_effect, refuse_unstandardised_trait_variance_as_standardised_trait_variance, refuse_within_subject_scaled_initial_latent_mean_as_standardised_initial_latent_mean, }; @@ -16353,4 +16533,260 @@ mod tests { Err(PsychometricError::InvalidNumericInput) ); } + + #[test] + #[allow(clippy::too_many_lines)] + fn standardised_time_independent_effect_recovers_driver_page_sixteen_after_positive_p_and_v() { + // Driver et al. (2017, p. 16 TIPREDEFFECTstd; §7.2; Table 2; + // footnote 4; Eq. 3; 2017-era summary.ctsemFit.R): form strictly + // positive p = −q / (2 a), then strictly positive v, then + // B · √v / √p. + let coefficient = 0.2_f64; + let predictor_variance = 1.6_f64; + let diffusion = 0.8_f64; + let log_rate = -0.5_f64; + let recovered = recover_standardised_time_independent_predictor_effect( + coefficient, + predictor_variance, + diffusion, + log_rate, + LagClock::EventTime, + ) + .expect("TIPREDEFFECTstd"); + let stationary = + recover_stationary_latent_variance(diffusion, log_rate, LagClock::EventTime) + .expect("p"); + let expected = coefficient * predictor_variance.sqrt() / stationary.sqrt(); + assert!((recovered - expected).abs() < 1e-15); + assert!((coefficient - recovered).abs() > 1e-3); + let unit_asymptotic = recover_asymptotic_time_independent_predictor_effect( + coefficient, + 1.0, + log_rate, + LagClock::EventTime, + ) + .expect("unit asymTIPREDEFFECT"); + let asymptotic = unit_asymptotic * predictor_variance.sqrt() / stationary.sqrt(); + assert!((asymptotic - recovered).abs() > 1e-3); + let discrete = recover_discrete_time_independent_predictor_effect( + coefficient, + 1.0, + log_rate, + 1.0, + LagClock::EventTime, + ) + .expect("discreteTIPREDEFFECT") + * predictor_variance.sqrt() + / stationary.sqrt(); + assert!((discrete - recovered).abs() > 1e-3); + let later = recover_discrete_time_independent_predictor_effect( + coefficient, + 1.0, + log_rate, + 2.5, + LagClock::EventTime, + ) + .expect("discreteTIPREDEFFECT Δt=2.5") + * predictor_variance.sqrt() + / stationary.sqrt(); + assert!((later - recovered).abs() > 1e-3); + assert!((later - discrete).abs() > 1e-3); + let larger_q = recover_standardised_time_independent_predictor_effect( + coefficient, + predictor_variance, + 1.6, + log_rate, + LagClock::EventTime, + ) + .expect("larger q"); + assert!(larger_q.abs() < recovered.abs()); + let zero = recover_standardised_time_independent_predictor_effect( + 0.0, + predictor_variance, + diffusion, + log_rate, + LagClock::EventTime, + ) + .expect("zero TIPREDEFFECT"); + assert_eq!(zero.to_bits(), 0.0_f64.to_bits()); + let negative = recover_standardised_time_independent_predictor_effect( + -coefficient, + predictor_variance, + diffusion, + log_rate, + LagClock::EventTime, + ) + .expect("signed TIPREDEFFECTstd"); + assert!((negative + expected).abs() < 1e-15); + let equal_ratio = recover_standardised_time_independent_predictor_effect( + coefficient, + stationary, + diffusion, + log_rate, + LagClock::EventTime, + ) + .expect("v = p"); + assert!((equal_ratio - coefficient).abs() < 1e-15); + let added = recover_asymptotic_time_independent_predictor_variance( + coefficient, + predictor_variance, + log_rate, + LagClock::EventTime, + ) + .expect("addedTIPREDVAR"); + let trait_plus_state = + recover_trait_plus_state_latent_variance(0.5, stationary).expect("trait + p"); + let contaminated = + coefficient * predictor_variance.sqrt() / (trait_plus_state + added).sqrt(); + assert!((contaminated - recovered).abs() > 1e-3); + assert_eq!( + refuse_unstandardised_time_independent_effect_as_standardised_time_independent_effect( + coefficient, recovered + ), + Err( + PsychometricError::UnstandardisedTimeIndependentEffectIsNotStandardisedTimeIndependentEffect + ) + ); + assert_eq!( + refuse_unstandardised_time_independent_effect_as_standardised_time_independent_effect( + coefficient, equal_ratio + ), + Err( + PsychometricError::UnstandardisedTimeIndependentEffectIsNotStandardisedTimeIndependentEffect + ) + ); + assert_eq!( + refuse_asymptotic_standardised_time_independent_effect_as_standardised_time_independent_effect( + asymptotic, recovered + ), + Err( + PsychometricError::AsymptoticStandardisedTimeIndependentEffectIsNotStandardisedTimeIndependentEffect + ) + ); + assert_eq!( + refuse_discrete_standardised_time_independent_effect_as_standardised_time_independent_effect( + discrete, recovered + ), + Err( + PsychometricError::DiscreteStandardisedTimeIndependentEffectIsNotStandardisedTimeIndependentEffect + ) + ); + assert_eq!( + refuse_trait_contaminated_time_independent_effect_as_standardised_time_independent_effect( + contaminated, recovered + ), + Err( + PsychometricError::TraitContaminatedTimeIndependentEffectIsNotStandardisedTimeIndependentEffect + ) + ); + } + + #[test] + #[allow(clippy::too_many_lines)] + fn standardised_time_independent_effect_fails_closed_when_unstandardised_is_defined() { + assert_eq!( + recover_standardised_time_independent_predictor_effect( + 0.2, + 1.6, + 0.0, + -0.5, + LagClock::EventTime + ), + Err( + PsychometricError::StandardisedTimeIndependentEffectRequiresPositiveWithinSubjectVariance + ) + ); + assert_eq!( + recover_standardised_time_independent_predictor_effect( + 0.2, + 0.0, + 0.8, + -0.5, + LagClock::EventTime + ), + Err( + PsychometricError::StandardisedTimeIndependentEffectRequiresPositivePredictorVariance + ) + ); + assert_eq!( + recover_standardised_time_independent_predictor_effect( + 0.2, + -1.6, + 0.8, + -0.5, + LagClock::EventTime + ), + Err(PsychometricError::InvalidNumericInput) + ); + assert_eq!( + recover_standardised_time_independent_predictor_effect( + 0.2, + 1.6, + 0.8, + 0.5, + LagClock::EventTime + ), + Err(PsychometricError::StationaryVarianceRequiresStableDrift) + ); + assert_eq!( + recover_standardised_time_independent_predictor_effect( + 0.2, + 1.6, + 0.8, + -0.5, + LagClock::SystemTime + ), + Err(PsychometricError::EventTimeRequired) + ); + assert_eq!( + recover_standardised_time_independent_predictor_effect( + 0.2, + 1.6, + -0.8, + -0.5, + LagClock::EventTime + ), + Err(PsychometricError::InvalidNumericInput) + ); + assert_eq!( + recover_standardised_time_independent_predictor_effect( + f64::NAN, + 1.6, + 0.8, + -0.5, + LagClock::EventTime + ), + Err(PsychometricError::InvalidNumericInput) + ); + assert_eq!( + recover_standardised_time_independent_predictor_effect( + 0.2, + f64::NAN, + 0.8, + -0.5, + LagClock::EventTime + ), + Err(PsychometricError::InvalidNumericInput) + ); + assert_eq!( + recover_standardised_time_independent_predictor_effect( + 0.2, + f64::INFINITY, + 0.8, + -0.5, + LagClock::EventTime + ), + Err(PsychometricError::InvalidNumericInput) + ); + assert_eq!( + recover_standardised_time_independent_predictor_effect( + f64::MAX, + 1.0, + 0.5, + -1.0, + LagClock::EventTime + ), + Err(PsychometricError::InvalidNumericInput) + ); + } } diff --git a/crates/psychometric_core/src/lib.rs b/crates/psychometric_core/src/lib.rs index c081a63f6..bd34988ac 100644 --- a/crates/psychometric_core/src/lib.rs +++ b/crates/psychometric_core/src/lib.rs @@ -261,6 +261,22 @@ //! correlation; zero `MANIFESTTRAITVAR` fails closed; a non-event //! clock fails closed; `MANIFESTTRAITVAR` does not require `a < 0`; //! JSS PDF re-opened 2026-08-27T14:20Z), +//! recovers the Driver p. 16 `TIPREDEFFECTstd` as +//! `B · √v / √p` after strictly positive `asymDIFFUSION` +//! `p = −q / (2 a)` and strictly positive `TIPREDVAR` (footnote 4 +//! uses only the relevant within-subject variance, not total +//! `trait + p + added`; 2017-era `summary.ctsemFit.R` forms the +//! standardiser `√TIPREDVAR / √asymDIFFUSION` and uses it for +//! `asymTIPREDEFFECTstd`; that source does not form a +//! `TIPREDEFFECTstd` matrix; unstandardised `B` is defined for a +//! zero coefficient and for zero predictor variance and is not that +//! map; `(-B / a) · √v / √p` is the `Δt → ∞` map and is not that +//! continuous coefficient; `A^{-1}[e^{A Δt} − I] B · √v / √p` is +//! the finite-interval map and is not that continuous +//! standardisation; `B · √v / √(trait + p + added)` uses the total +//! and is not that map when `TRAITVAR` is nonzero; zero `q` fails +//! closed; zero `v` fails closed; a non-event clock fails closed; +//! `a ≥ 0` fails closed; JSS PDF re-opened 2026-08-29T14:20Z), //! and refuses //! latent-mean comparison below strong invariance. @@ -418,6 +434,8 @@ pub use event_time::recover_standardised_manifest_trait_variance; /// Exact scalar p. 16 `MANIFESTVARstd` `θ/...` after strictly positive `MANIFESTVAR`. pub use event_time::recover_standardised_manifest_variance; +/// Exact scalar p. 16 `TIPREDEFFECTstd` `B · √v / √p` after strictly positive `asymDIFFUSION` and `TIPREDVAR`. +pub use event_time::recover_standardised_time_independent_predictor_effect; /// Exact scalar p. 16 `TRAITVARstd` `trait / trait = 1` after strictly positive `TRAITVAR`. pub use event_time::recover_standardised_trait_variance; /// Exact scalar p. 16 stationary `T0MEANS` `-κ / a + −B z / a`. @@ -466,6 +484,8 @@ pub use event_time::refuse_asymptotic_continuous_intercept_observed_mean_as_stat pub use event_time::refuse_asymptotic_standardised_continuous_intercept_as_standardised_continuous_intercept; /// Refuse treating p. 16 `asymCINTstd` as `discreteCINTstd`. pub use event_time::refuse_asymptotic_standardised_continuous_intercept_as_standardised_discrete_continuous_intercept; +/// Refuse treating p. 16 `asymTIPREDEFFECTstd` as `TIPREDEFFECTstd`. +pub use event_time::refuse_asymptotic_standardised_time_independent_effect_as_standardised_time_independent_effect; /// Refuse treating §7.2 `asymTIPREDEFFECT` as `TIPREDEFFECT` `B`. pub use event_time::refuse_asymptotic_time_independent_effect_as_coefficient; /// Refuse treating §7.2 `asymTIPREDEFFECT` as `CINT`. @@ -492,6 +512,8 @@ pub use event_time::refuse_difference_quotient_as_local_rate; pub use event_time::refuse_discrete_standardised_continuous_intercept_as_standardised_asymptotic_continuous_intercept; /// Refuse treating p. 16 `discreteCINTstd` as `CINTstd`. pub use event_time::refuse_discrete_standardised_continuous_intercept_as_standardised_continuous_intercept; +/// Refuse treating the finite-interval standardised TI effect as p. 16 `TIPREDEFFECTstd`. +pub use event_time::refuse_discrete_standardised_time_independent_effect_as_standardised_time_independent_effect; /// Refuse treating evolved `τ + λ μ_t` as the after-t0 extra-process observed mean. pub use event_time::refuse_evolved_observed_mean_as_after_extra_process_observed_mean; /// Refuse treating evolved `τ + λ μ_t` as the extra-process observed mean. @@ -715,6 +737,8 @@ pub use event_time::refuse_time_independent_effect_as_time_varying_discrete_effe pub use event_time::refuse_time_independent_observed_mean_as_initial_time_dependent_observed_mean; /// Refuse treating process-increment `τ + λ(μ_t + A^{-1}[e^{A Δt} − I] B z)` as the first-occasion TI-predictor observed mean. pub use event_time::refuse_time_independent_observed_mean_as_initial_time_independent_observed_mean; +/// Refuse treating `B · √v / √(trait + p + added)` as p. 16 `TIPREDEFFECTstd`. +pub use event_time::refuse_trait_contaminated_time_independent_effect_as_standardised_time_independent_effect; /// Refuse treating §4.3 trait-plus-state lagged covariance as lagged stationary `T0VAR`. pub use event_time::refuse_trait_plus_state_lagged_covariance_as_stationary_lagged_latent_covariance; /// Refuse treating `κ / √(trait + p + added)` as `CINTstd`. @@ -744,6 +768,8 @@ pub use event_time::refuse_unstandardised_manifest_trait_variance_as_standardise /// Refuse treating unstandardised `MANIFESTVAR` as p. 16 `MANIFESTVARstd`. pub use event_time::refuse_unstandardised_manifest_variance_as_standardised_manifest_variance; +/// Refuse treating unstandardised `TIPREDEFFECT` as p. 16 `TIPREDEFFECTstd`. +pub use event_time::refuse_unstandardised_time_independent_effect_as_standardised_time_independent_effect; /// Refuse treating unstandardised `TRAITVAR` as p. 16 `TRAITVARstd`. pub use event_time::refuse_unstandardised_trait_variance_as_standardised_trait_variance; /// Refuse treating `μ_0 / √asymDIFFUSION` as `T0MEANSstd`. diff --git a/crates/psychometric_core/tests/multilevel_event_time_recovery_contract.rs b/crates/psychometric_core/tests/multilevel_event_time_recovery_contract.rs index 1c0027f44..f6a222273 100644 --- a/crates/psychometric_core/tests/multilevel_event_time_recovery_contract.rs +++ b/crates/psychometric_core/tests/multilevel_event_time_recovery_contract.rs @@ -39,14 +39,14 @@ use psychometric_core::{ recover_standardised_discrete_continuous_intercept, recover_standardised_initial_latent_mean, recover_standardised_initial_latent_variance, recover_standardised_manifest_mean, recover_standardised_manifest_trait_variance, recover_standardised_manifest_variance, - recover_standardised_trait_variance, recover_stationary_initial_latent_mean, - recover_stationary_initial_latent_variance, recover_stationary_initial_observed_mean, - recover_stationary_initial_observed_variance, recover_stationary_lagged_latent_covariance, - recover_stationary_lagged_observed_covariance, recover_stationary_latent_variance, - recover_stationary_later_latent_variance, recover_stationary_later_observed_variance, - recover_time_dependent_predictor_impulse, recover_time_dependent_predictor_impulse_carry, - recover_trait_plus_state_lagged_covariance, recover_trait_plus_state_latent_variance, - recover_within_residual_event_time_log_rate, + recover_standardised_time_independent_predictor_effect, recover_standardised_trait_variance, + recover_stationary_initial_latent_mean, recover_stationary_initial_latent_variance, + recover_stationary_initial_observed_mean, recover_stationary_initial_observed_variance, + recover_stationary_lagged_latent_covariance, recover_stationary_lagged_observed_covariance, + recover_stationary_latent_variance, recover_stationary_later_latent_variance, + recover_stationary_later_observed_variance, recover_time_dependent_predictor_impulse, + recover_time_dependent_predictor_impulse_carry, recover_trait_plus_state_lagged_covariance, + recover_trait_plus_state_latent_variance, recover_within_residual_event_time_log_rate, refuse_after_extra_process_contribution_as_observed_mean, refuse_after_extra_process_latent_mean_as_observed_mean, refuse_asymptotic_continuous_intercept_as_asymptotic_time_independent_effect, @@ -6540,3 +6540,157 @@ fn manifest_variance_std_clock_path_is_runtime_opaque() { Err(PsychometricError::EventTimeRequired) ); } + +#[test] +fn standardised_time_independent_effect_recovers_driver_page_sixteen_after_positive_p_and_v() { + let coefficient = 0.2_f64; + let predictor_variance = 1.6_f64; + let diffusion = 0.8_f64; + let log_rate = -0.5_f64; + let recovered = recover_standardised_time_independent_predictor_effect( + coefficient, + predictor_variance, + diffusion, + log_rate, + LagClock::EventTime, + ) + .expect("TIPREDEFFECTstd"); + let stationary = + recover_stationary_latent_variance(diffusion, log_rate, LagClock::EventTime).expect("p"); + let expected = coefficient * predictor_variance.sqrt() / stationary.sqrt(); + let error = (recovered - expected).abs(); + assert!( + error < 1e-15, + "Driver et al. (2017, p. 16 TIPREDEFFECTstd): RMSE {error} for B · √v / √p" + ); + let unstandardised_rmse = (coefficient - expected).abs(); + assert!( + error < unstandardised_rmse, + "Driver et al. (2017, Table 2): unstandardised B RMSE {unstandardised_rmse} must exceed TIPREDEFFECTstd RMSE {error}" + ); + let unit_asymptotic = recover_asymptotic_time_independent_predictor_effect( + coefficient, + 1.0, + log_rate, + LagClock::EventTime, + ) + .expect("unit asymTIPREDEFFECT"); + let asymptotic = unit_asymptotic * predictor_variance.sqrt() / stationary.sqrt(); + let asymptotic_rmse = (asymptotic - expected).abs(); + assert!( + error < asymptotic_rmse, + "Driver et al. (2017, §7.2): asymTIPREDEFFECTstd RMSE {asymptotic_rmse} must exceed TIPREDEFFECTstd RMSE {error}" + ); + let discrete = recover_discrete_time_independent_predictor_effect( + coefficient, + 1.0, + log_rate, + 1.0, + LagClock::EventTime, + ) + .expect("discreteTIPREDEFFECT") + * predictor_variance.sqrt() + / stationary.sqrt(); + let discrete_rmse = (discrete - expected).abs(); + assert!( + error < discrete_rmse, + "Driver et al. (2017, p. 16): finite-interval standardised TIPREDEFFECT RMSE {discrete_rmse} must exceed TIPREDEFFECTstd RMSE {error}" + ); + let later = recover_discrete_time_independent_predictor_effect( + coefficient, + 1.0, + log_rate, + 2.5, + LagClock::EventTime, + ) + .expect("discreteTIPREDEFFECT Δt=2.5") + * predictor_variance.sqrt() + / stationary.sqrt(); + assert!( + (later - recovered).abs() > 1e-3, + "Driver et al. (2017, p. 16): a later event interval changes the finite-interval map and not TIPREDEFFECTstd" + ); + let larger_q = recover_standardised_time_independent_predictor_effect( + coefficient, + predictor_variance, + 1.6, + log_rate, + LagClock::EventTime, + ) + .expect("larger q"); + assert!(larger_q.abs() < recovered.abs()); + let negative = recover_standardised_time_independent_predictor_effect( + -coefficient, + predictor_variance, + diffusion, + log_rate, + LagClock::EventTime, + ) + .expect("negative signed TIPREDEFFECTstd"); + assert!((negative + expected).abs() < 1e-15); +} + +#[test] +fn standardised_time_independent_effect_refuses_non_event_clocks_and_does_not_keep_zero_q_or_v() { + assert_eq!( + recover_standardised_time_independent_predictor_effect( + 0.2, + 1.6, + 0.8, + -0.5, + LagClock::AssertionTime + ), + Err(PsychometricError::EventTimeRequired) + ); + assert_eq!( + recover_standardised_time_independent_predictor_effect( + 0.2, + 1.6, + 0.8, + -0.5, + LagClock::KnowledgeCutoff + ), + Err(PsychometricError::EventTimeRequired) + ); + assert_eq!( + recover_standardised_time_independent_predictor_effect( + 0.2, + 1.6, + 0.0, + -0.5, + LagClock::EventTime + ), + Err( + PsychometricError::StandardisedTimeIndependentEffectRequiresPositiveWithinSubjectVariance + ) + ); + assert_eq!( + recover_standardised_time_independent_predictor_effect( + 0.2, + 0.0, + 0.8, + -0.5, + LagClock::EventTime + ), + Err(PsychometricError::StandardisedTimeIndependentEffectRequiresPositivePredictorVariance) + ); + assert_eq!( + recover_standardised_time_independent_predictor_effect( + 0.2, + 1.6, + 0.8, + 0.5, + LagClock::EventTime + ), + Err(PsychometricError::StationaryVarianceRequiresStableDrift) + ); + let zero = recover_standardised_time_independent_predictor_effect( + 0.0, + 1.6, + 0.8, + -0.5, + LagClock::EventTime, + ) + .expect("zero TIPREDEFFECT"); + assert_eq!(zero.to_bits(), 0.0_f64.to_bits()); +} diff --git a/crates/psychometric_core/tests/scientific_claim_boundary_contract.rs b/crates/psychometric_core/tests/scientific_claim_boundary_contract.rs index 6ccf7f38b..a8d61e6e9 100644 --- a/crates/psychometric_core/tests/scientific_claim_boundary_contract.rs +++ b/crates/psychometric_core/tests/scientific_claim_boundary_contract.rs @@ -34,14 +34,14 @@ use psychometric_core::{ recover_standardised_discrete_continuous_intercept, recover_standardised_initial_latent_mean, recover_standardised_initial_latent_variance, recover_standardised_manifest_mean, recover_standardised_manifest_trait_variance, recover_standardised_manifest_variance, - recover_standardised_trait_variance, recover_stationary_initial_latent_mean, - recover_stationary_initial_latent_variance, recover_stationary_initial_observed_mean, - recover_stationary_initial_observed_variance, recover_stationary_lagged_latent_covariance, - recover_stationary_lagged_observed_covariance, recover_stationary_latent_variance, - recover_stationary_later_latent_variance, recover_stationary_later_observed_variance, - recover_time_dependent_predictor_impulse, recover_time_dependent_predictor_impulse_carry, - recover_trait_plus_state_lagged_covariance, recover_trait_plus_state_latent_variance, - recover_within_residual_event_time_log_rate, + recover_standardised_time_independent_predictor_effect, recover_standardised_trait_variance, + recover_stationary_initial_latent_mean, recover_stationary_initial_latent_variance, + recover_stationary_initial_observed_mean, recover_stationary_initial_observed_variance, + recover_stationary_lagged_latent_covariance, recover_stationary_lagged_observed_covariance, + recover_stationary_latent_variance, recover_stationary_later_latent_variance, + recover_stationary_later_observed_variance, recover_time_dependent_predictor_impulse, + recover_time_dependent_predictor_impulse_carry, recover_trait_plus_state_lagged_covariance, + recover_trait_plus_state_latent_variance, recover_within_residual_event_time_log_rate, refuse_after_extra_process_contribution_as_observed_mean, refuse_after_extra_process_latent_mean_as_observed_mean, refuse_asymptotic_continuous_intercept_as_asymptotic_time_independent_effect, @@ -51,6 +51,7 @@ use psychometric_core::{ refuse_asymptotic_continuous_intercept_observed_mean_as_stationary_initial_observed_mean, refuse_asymptotic_standardised_continuous_intercept_as_standardised_continuous_intercept, refuse_asymptotic_standardised_continuous_intercept_as_standardised_discrete_continuous_intercept, + refuse_asymptotic_standardised_time_independent_effect_as_standardised_time_independent_effect, refuse_asymptotic_time_independent_effect_as_coefficient, refuse_asymptotic_time_independent_effect_as_continuous_intercept, refuse_asymptotic_time_independent_effect_as_discrete_effect, @@ -63,6 +64,7 @@ use psychometric_core::{ refuse_continuous_intercept_as_manifest_means, refuse_discrete_standardised_continuous_intercept_as_standardised_asymptotic_continuous_intercept, refuse_discrete_standardised_continuous_intercept_as_standardised_continuous_intercept, + refuse_discrete_standardised_time_independent_effect_as_standardised_time_independent_effect, refuse_evolved_observed_mean_as_after_extra_process_observed_mean, refuse_evolved_observed_mean_as_extra_process_observed_mean, refuse_evolved_observed_mean_as_impulse_carry_observed_mean, @@ -167,6 +169,7 @@ use psychometric_core::{ refuse_time_independent_effect_as_time_varying_discrete_effect, refuse_time_independent_observed_mean_as_initial_time_dependent_observed_mean, refuse_time_independent_observed_mean_as_initial_time_independent_observed_mean, + refuse_trait_contaminated_time_independent_effect_as_standardised_time_independent_effect, refuse_trait_plus_state_lagged_covariance_as_stationary_lagged_latent_covariance, refuse_trait_scaled_continuous_intercept_as_standardised_continuous_intercept, refuse_trait_variance_as_process_noise, refuse_trait_variance_as_stationary_within_subject, @@ -179,6 +182,7 @@ use psychometric_core::{ refuse_unstandardised_manifest_mean_as_standardised_manifest_mean, refuse_unstandardised_manifest_trait_variance_as_standardised_manifest_trait_variance, refuse_unstandardised_manifest_variance_as_standardised_manifest_variance, + refuse_unstandardised_time_independent_effect_as_standardised_time_independent_effect, refuse_unstandardised_trait_variance_as_standardised_trait_variance, refuse_within_subject_scaled_initial_latent_mean_as_standardised_initial_latent_mean, }; @@ -3782,3 +3786,169 @@ fn standardised_manifest_variance_is_not_unstandardised_traitstd_or_observed_var ) ); } + +#[allow(clippy::too_many_lines)] +#[test] +fn standardised_time_independent_effect_is_not_unstandardised_asymptotic_or_discrete() { + let coefficient = 0.2_f64; + let predictor_variance = 1.6_f64; + let diffusion = 0.8_f64; + let log_rate = -0.5_f64; + let recovered = recover_standardised_time_independent_predictor_effect( + coefficient, + predictor_variance, + diffusion, + log_rate, + LagClock::EventTime, + ) + .expect("TIPREDEFFECTstd"); + let stationary = + recover_stationary_latent_variance(diffusion, log_rate, LagClock::EventTime).expect("p"); + assert!( + (recovered - coefficient * predictor_variance.sqrt() / stationary.sqrt()).abs() < 1e-15, + "Driver et al. (2017, p. 16 footnote 4): TIPREDEFFECTstd is B · √v / √p" + ); + assert!( + (recovered - coefficient).abs() > 1e-3, + "Driver et al. (2017, Table 2): unstandardised TIPREDEFFECT is not TIPREDEFFECTstd" + ); + let unit_asymptotic = recover_asymptotic_time_independent_predictor_effect( + coefficient, + 1.0, + log_rate, + LagClock::EventTime, + ) + .expect("unit asymTIPREDEFFECT"); + let asymptotic = unit_asymptotic * predictor_variance.sqrt() / stationary.sqrt(); + assert!( + (asymptotic - recovered).abs() > 1e-3, + "Driver et al. (2017, §7.2): asymTIPREDEFFECTstd is not TIPREDEFFECTstd" + ); + let discrete = recover_discrete_time_independent_predictor_effect( + coefficient, + 1.0, + log_rate, + 1.0, + LagClock::EventTime, + ) + .expect("discreteTIPREDEFFECT") + * predictor_variance.sqrt() + / stationary.sqrt(); + assert!( + (discrete - recovered).abs() > 1e-3, + "Driver et al. (2017, p. 16): finite-interval standardised TIPREDEFFECT is not TIPREDEFFECTstd" + ); + let later = recover_discrete_time_independent_predictor_effect( + coefficient, + 1.0, + log_rate, + 2.5, + LagClock::EventTime, + ) + .expect("discreteTIPREDEFFECT Δt=2.5") + * predictor_variance.sqrt() + / stationary.sqrt(); + assert!( + (later - recovered).abs() > 1e-3, + "Driver et al. (2017, p. 16): a later event interval changes the finite-interval map and not TIPREDEFFECTstd" + ); + let added = recover_asymptotic_time_independent_predictor_variance( + coefficient, + predictor_variance, + log_rate, + LagClock::EventTime, + ) + .expect("addedTIPREDVAR"); + let trait_plus_state = + recover_trait_plus_state_latent_variance(0.5, stationary).expect("trait + p"); + let contaminated = coefficient * predictor_variance.sqrt() / (trait_plus_state + added).sqrt(); + assert!( + (contaminated - recovered).abs() > 1e-3, + "Driver et al. (2017, footnote 4): total variance is not TIPREDEFFECTstd" + ); + let zero = recover_standardised_time_independent_predictor_effect( + 0.0, + predictor_variance, + diffusion, + log_rate, + LagClock::EventTime, + ) + .expect("zero TIPREDEFFECT"); + assert_eq!(zero.to_bits(), 0.0_f64.to_bits()); + assert_eq!( + recover_standardised_time_independent_predictor_effect( + coefficient, + predictor_variance, + 0.0, + log_rate, + LagClock::EventTime + ), + Err( + psychometric_core::PsychometricError::StandardisedTimeIndependentEffectRequiresPositiveWithinSubjectVariance + ) + ); + assert_eq!( + recover_standardised_time_independent_predictor_effect( + coefficient, + 0.0, + diffusion, + log_rate, + LagClock::EventTime + ), + Err( + psychometric_core::PsychometricError::StandardisedTimeIndependentEffectRequiresPositivePredictorVariance + ) + ); + assert_eq!( + recover_standardised_time_independent_predictor_effect( + coefficient, + predictor_variance, + diffusion, + 0.5, + LagClock::EventTime + ), + Err(psychometric_core::PsychometricError::StationaryVarianceRequiresStableDrift) + ); + assert_eq!( + recover_standardised_time_independent_predictor_effect( + coefficient, + predictor_variance, + diffusion, + log_rate, + LagClock::DocumentTime + ), + Err(psychometric_core::PsychometricError::EventTimeRequired) + ); + assert_eq!( + refuse_unstandardised_time_independent_effect_as_standardised_time_independent_effect( + coefficient, recovered + ), + Err( + psychometric_core::PsychometricError::UnstandardisedTimeIndependentEffectIsNotStandardisedTimeIndependentEffect + ) + ); + assert_eq!( + refuse_asymptotic_standardised_time_independent_effect_as_standardised_time_independent_effect( + asymptotic, recovered + ), + Err( + psychometric_core::PsychometricError::AsymptoticStandardisedTimeIndependentEffectIsNotStandardisedTimeIndependentEffect + ) + ); + assert_eq!( + refuse_discrete_standardised_time_independent_effect_as_standardised_time_independent_effect( + discrete, recovered + ), + Err( + psychometric_core::PsychometricError::DiscreteStandardisedTimeIndependentEffectIsNotStandardisedTimeIndependentEffect + ) + ); + assert_eq!( + refuse_trait_contaminated_time_independent_effect_as_standardised_time_independent_effect( + contaminated, recovered + ), + Err( + psychometric_core::PsychometricError::TraitContaminatedTimeIndependentEffectIsNotStandardisedTimeIndependentEffect + ) + ); +} diff --git a/docs/adr/0005-posterior-esem-dsem.md b/docs/adr/0005-posterior-esem-dsem.md index ee1e6cf0d..f6fc18c25 100644 --- a/docs/adr/0005-posterior-esem-dsem.md +++ b/docs/adr/0005-posterior-esem-dsem.md @@ -37,6 +37,7 @@ The executable standardised-initial-variance slice recovers Driver et al. (2017, The executable standardised-asymptotic-diffusion slice recovers Driver et al. (2017, p. 16 `asymDIFFUSIONstd`) as `p / p = 1` after strictly positive `asymDIFFUSION` `p = −q / (2 a)` (footnote 4; 2017-era `summary.ctsemFit.R` `solve(sqrt(diag(asymDIFFUSION))) %&% asymDIFFUSION`; JSS PDF re-opened 2026-08-26T17:20Z). Unstandardised `p` is defined for a zero process and is not that map. `p_0 / p_0 = 1` is the named `T0VARstd` first-occasion correlation and is not `asymDIFFUSIONstd` even when both equal 1. `q / p = −2 a` is the named `DIFFUSIONstd` continuous-diffusion ratio and is not this correlation. `v / v = 1` is the named `TIPREDVARstd` predictor correlation and is not this map even when both equal 1. Zero `q` and `a ≥ 0` fail closed. This is not ctsem estimation. The executable standardised-manifest-trait-variance slice recovers Driver et al. (2017, p. 16 `MANIFESTTRAITVARstd`) as `ψ / ψ = 1` after strictly positive `MANIFESTTRAITVAR` (Table 2 `Ψ_τ`; §7.1, p. 19; footnote 4; 2017-era `summary.ctsemFit.R` `solve(sqrt(diag(MANIFESTTRAITVAR) + ridging)) %&% MANIFESTTRAITVAR`; JSS PDF re-opened 2026-08-27T14:20Z). Unstandardised `ψ` is defined for a zero manifest trait and is not that map. `trait / trait = 1` is the named `TRAITVARstd` process-level correlation and is not `MANIFESTTRAITVARstd` even when both equal 1. `θ` is `MANIFESTVAR` and is not that correlation. `MANIFESTTRAITVAR` does not require `a < 0`. This is not ctsem estimation. The executable standardised-manifest-variance slice recovers Driver et al. (2017, p. 16 `MANIFESTVARstd`) as `θ / θ = 1` after strictly positive `MANIFESTVAR` (Table 2 measurement-error Cholesky; Eq. 5 `ε ~ N(0, Θ)`; footnote 4; 2017-era `summary.ctsemFit.R` `solve(sqrt(diag(MANIFESTVAR) + ridging)) %&% MANIFESTVAR`; default ridge 0; JSS PDF re-opened 2026-08-27T14:25Z). Unstandardised `θ` is defined for a zero residual and is not that map. `ψ / ψ = 1` is `MANIFESTTRAITVARstd` and is not `MANIFESTVARstd` even when both equal 1. `MANIFESTVAR` does not require `a < 0`. +The executable standardised-time-independent-effect slice recovers Driver et al. (2017, p. 16 `TIPREDEFFECTstd`) as `B · √v / √p` after strictly positive `asymDIFFUSION` `p = −q / (2 a)` and strictly positive `TIPREDVAR` (footnote 4; §7.2; Eq. 3; Table 2; 2017-era `summary.ctsemFit.R` standardiser `√TIPREDVAR / √asymDIFFUSION`; that source does not form `TIPREDEFFECTstd`; JSS PDF re-opened 2026-08-29T14:20Z). Unstandardised `B` is defined for a zero coefficient and for zero predictor variance and is not that map. `(-B / a) · √v / √p` is the `Δt → ∞` map and is not this continuous coefficient. `A^{-1}[e^{A Δt} − I] B · √v / √p` is the finite-interval map and is not this continuous standardisation. `B · √v / √(trait + p + added)` uses total variance and is not the residual map. Zero `q`, zero `v`, and `a ≥ 0` fail closed. This is not ctsem estimation. The executable standardised-trait-variance slice recovers Driver et al. (2017, p. 16 `TRAITVARstd`) as `trait / trait = 1` after strictly positive `TRAITVAR` (Table 2 `φ_ξ`; §7.1; footnote 4; 2017-era `summary.ctsemFit.R` `solve(sqrt(diag(TRAITVAR))) %&% TRAITVAR`; JSS PDF re-opened 2026-08-26T17:45Z). Unlike `T0VARstd` there is no ridge addend. Unstandardised `TRAITVAR` is defined for a zero trait and is not that map. `p_0 / p_0 = 1` is the named `T0VARstd` first-occasion correlation and is not `TRAITVARstd` even when both equal 1. `t0_b² v` is `addedT0TIPREDVAR` and is not this correlation. Zero `TRAITVAR` and a non-event clock fail closed. `TRAITVAR` does not require `a < 0`. This is not ctsem estimation. diff --git a/docs/research/multilevel-event-time-recovery.md b/docs/research/multilevel-event-time-recovery.md index 3701dcb4b..8fe4dc63a 100644 --- a/docs/research/multilevel-event-time-recovery.md +++ b/docs/research/multilevel-event-time-recovery.md @@ -68,7 +68,7 @@ This slice stays inside `psychometric_core`. It does not add a second invariance 62. refuse treating unstandardised `DRIFT` `a` as `DRIFTstd`, refuse treating the discrete standardisation `e^{a Δt}` as `DRIFTstd`, refuse treating `a p / (trait + p + added)` as `DRIFTstd`, and refuse treating `TRAITVAR` as the footnote 4 standardisation variance; 63. recover the exact scalar p. 16 `asymTIPREDEFFECTstd` `(-B / a) · √v / √(-q / (2 a))` after forming strictly positive `asymDIFFUSION` `−q / (2 a)` and strictly positive predictor variance `v` (Driver et al., 2017, p. 16; §7.2, pp. 20–21; Eq. 3, p. 5; Table 2, p. 12; footnote 4; JSS PDF re-opened 2026-08-23T14:25Z; form the within-subject variance first, then `v`, then the unit asymptotic effect, then the SD ratio; `a ≥ 0`, `q = 0`, and `v = 0` fail closed); 64. refuse treating unstandardised `asymTIPREDEFFECT` `-B / a` as `asymTIPREDEFFECTstd`, refuse treating the finite-interval standardisation `A^{-1}[e^{A Δt} − I] B · √v / √p` as `asymTIPREDEFFECTstd`, refuse treating `(-B / a) · √v / √(trait + p + added)` as `asymTIPREDEFFECTstd`, and refuse treating `TRAITVAR` as the footnote 4 standardisation variance; -65. recover the exact scalar p. 16 `TIPREDEFFECTstd` `B · √v / √(-q / (2 a))` after forming strictly positive `asymDIFFUSION` `−q / (2 a)` and strictly positive predictor variance `v` (Driver et al., 2017, p. 16; §7.2, pp. 20–21; Eq. 3, p. 5; Table 2, p. 12; footnote 4; JSS PDF re-opened 2026-08-23T16:21Z; form the within-subject variance first, then `v`, then the continuous coefficient, then the SD ratio; `a ≥ 0`, `q = 0`, and `v = 0` fail closed); +65. recover the exact scalar p. 16 `TIPREDEFFECTstd` `B · √v / √(-q / (2 a))` after forming strictly positive `asymDIFFUSION` `−q / (2 a)` and strictly positive predictor variance `v` (Driver et al., 2017, p. 16; §7.2, pp. 20–21; Eq. 3, p. 5; Table 2, p. 12; footnote 4; 2017-era ctsem `summary.ctsemFit.R`; JSS PDF re-opened 2026-08-29T14:20Z; form the within-subject variance first, then `v`, then the continuous coefficient, then the SD ratio; `a ≥ 0`, `q = 0`, and `v = 0` fail closed); 66. refuse treating unstandardised `TIPREDEFFECT` `B` as `TIPREDEFFECTstd`, refuse treating `asymTIPREDEFFECTstd` `(-B / a) · √v / √p` as `TIPREDEFFECTstd`, refuse treating the finite-interval standardisation `A^{-1}[e^{A Δt} − I] B · √v / √p` as `TIPREDEFFECTstd`, refuse treating `B · √v / √(trait + p + added)` as `TIPREDEFFECTstd`, and refuse treating `TRAITVAR` as the footnote 4 standardisation variance; 67. recover the exact scalar Table 3 / p. 16 `T0TIPREDEFFECTstd` `t0_b · √v / √p_0` after forming strictly positive free `T0VAR` `p_0` and strictly positive predictor variance `v` (Driver et al., 2017, Table 3, p. 13; p. 16; footnote 4; 2017-era ctsem `summary.ctsemFit.R`; JSS PDF re-opened 2026-08-23T17:20Z; form free `T0VAR` first, then `v`, then the first-occasion coefficient, then the SD ratio; `p_0 = 0` and `v = 0` fail closed; a non-event clock fails closed; free `T0VAR` does not require `a < 0`); 68. refuse treating unstandardised `T0TIPREDEFFECT` `t0_b` as `T0TIPREDEFFECTstd`, refuse treating `TIPREDEFFECTstd` `B · √v / √(-q / (2 a))` as `T0TIPREDEFFECTstd`, refuse treating `asymTIPREDEFFECTstd` `(-B / a) · √v / √p` as `T0TIPREDEFFECTstd`, refuse treating `t0_b · √v / √(trait + p_0 + added)` as `T0TIPREDEFFECTstd`, and refuse treating `TRAITVAR` as the footnote 4 standardisation variance; @@ -243,7 +243,7 @@ The Voelkle et al. (2012) ZORA accepted manuscript was re-opened 2026-08-18T21:0 - Driver et al. (2017, p. 16 `DIFFUSIONstd`; Eq. 4; footnote 4; JSS PDF re-opened 2026-08-23T13:20Z) recovers a known continuous standardisation \(q/(-q/(2a))=-2a\) at machine-scale RMSE, and that RMSE is smaller than treating unstandardised \(q\), discrete \(Q_{\Delta t}/p\), or \(q/(\mathrm{trait}+p+\mathrm{added})\) as `DIFFUSIONstd`; distinct positive \(q\) recover the same \(-2a\); \(q=0\) and \(a\ge 0\) fail closed; a non-event clock and an overflowing ratio fail closed. - Driver et al. (2017, p. 16 `DRIFTstd`; Eq. 1; footnote 4; JSS PDF re-opened 2026-08-23T13:28Z) recovers a known continuous auto-effect \(a\) after strictly positive `asymDIFFUSION` at machine-scale RMSE, and that RMSE is smaller than treating unstandardised \(a\), discrete \(e^{a\Delta t}\), or \(ap/(\mathrm{trait}+p+\mathrm{added})\) as `DRIFTstd`; distinct positive \(q\) recover the same \(a\); \(q=0\) and \(a\ge 0\) fail closed; a non-event clock fails closed. - Driver et al. (2017, p. 16 `asymTIPREDEFFECTstd`; §7.2; Eq. 3; footnote 4; JSS PDF re-opened 2026-08-23T14:25Z) recovers a known standardised asymptotic TI effect \((-B/a)\cdot\sqrt{v}/\sqrt{-q/(2a)}\) at machine-scale RMSE, and that RMSE is smaller than treating unstandardised \(-B/a\), finite-interval \(A^{-1}[e^{A\Delta t}-I]B\cdot\sqrt{v}/\sqrt{p}\), or \((-B/a)\cdot\sqrt{v}/\sqrt{\mathrm{trait}+p+\mathrm{added}}\) as `asymTIPREDEFFECTstd`; a larger positive \(q\) yields a smaller \(|\mathrm{std}|\); a zero coefficient with positive \(v\) and \(p\) is exactly zero; \(q=0\), \(v=0\), and \(a\ge 0\) fail closed; a non-event clock and an overflowing product fail closed. -- Driver et al. (2017, p. 16 `TIPREDEFFECTstd`; §7.2; Eq. 3; footnote 4; JSS PDF re-opened 2026-08-23T16:21Z) recovers a known standardised continuous TI effect \(B\cdot\sqrt{v}/\sqrt{-q/(2a)}\) at machine-scale RMSE, and that RMSE is smaller than treating unstandardised \(B\), asymptotic \((-B/a)\cdot\sqrt{v}/\sqrt{p}\), finite-interval \(A^{-1}[e^{A\Delta t}-I]B\cdot\sqrt{v}/\sqrt{p}\), or \(B\cdot\sqrt{v}/\sqrt{\mathrm{trait}+p+\mathrm{added}}\) as `TIPREDEFFECTstd`; a larger positive \(q\) yields a smaller \(|\mathrm{std}|\); a zero coefficient with positive \(v\) and \(p\) is exactly zero; \(q=0\), \(v=0\), and \(a\ge 0\) fail closed; a non-event clock and an overflowing product fail closed. +- Driver et al. (2017, p. 16 `TIPREDEFFECTstd`; §7.2; Eq. 3; footnote 4; 2017-era ctsem `summary.ctsemFit.R`; JSS PDF re-opened 2026-08-29T14:20Z) recovers a known standardised continuous TI effect \(B\cdot\sqrt{v}/\sqrt{-q/(2a)}\) at machine-scale RMSE, and that RMSE is smaller than treating unstandardised \(B\), asymptotic \((-B/a)\cdot\sqrt{v}/\sqrt{p}\), finite-interval \(A^{-1}[e^{A\Delta t}-I]B\cdot\sqrt{v}/\sqrt{p}\), or \(B\cdot\sqrt{v}/\sqrt{\mathrm{trait}+p+\mathrm{added}}\) as `TIPREDEFFECTstd`; a larger positive \(q\) yields a smaller \(|\mathrm{std}|\); a zero coefficient with positive \(v\) and \(p\) is exactly zero; \(q=0\), \(v=0\), and \(a\ge 0\) fail closed; a non-event clock and an overflowing product fail closed. - Driver et al. (2017, Table 3 / p. 16 `T0TIPREDEFFECTstd`; footnote 4; 2017-era ctsem `summary.ctsemFit.R`; JSS PDF re-opened 2026-08-23T17:20Z) recovers a known standardised first-occasion TI effect \(t0_b\cdot\sqrt{v}/\sqrt{p_0}\) at machine-scale RMSE, and that RMSE is smaller than treating unstandardised \(t0_b\), continuous \(B\cdot\sqrt{v}/\sqrt{-q/(2a)}\), asymptotic \((-B/a)\cdot\sqrt{v}/\sqrt{p}\), or \(t0_b\cdot\sqrt{v}/\sqrt{\mathrm{trait}+p_0+\mathrm{added}}\) as `T0TIPREDEFFECTstd`; a larger positive \(p_0\) yields a smaller \(|\mathrm{std}|\); a zero coefficient with positive \(v\) and \(p_0\) is exactly zero; \(p_0=0\) and \(v=0\) fail closed; a non-event clock and an overflowing product fail closed; free `T0VAR` does not require \(a<0\). - Driver et al. (2017, Table 3 / p. 16 / 2017-era `addedT0TIPREDVAR`; §7.2; 2017-era ctsem `summary.ctsemFit.R`; JSS PDF re-opened 2026-08-23T18:20Z) recovers a known first-occasion extra TI variance \(t0_b^{2}v\) at machine-scale RMSE, and that RMSE is smaller than treating `addedTIPREDVAR` \((B/a)^{2}v\), `T0TIPREDEFFECTstd` \(t0_b\cdot\sqrt{v}/\sqrt{p_0}\), free \(p_0\), or `TRAITVAR` as `addedT0TIPREDVAR`; doubling \(v\) doubles the extra variance; a signed coefficient yields the same product; a zero coefficient or zero predictor variance is exactly zero; \(v<0\) fails closed; a non-event clock and an overflowing product fail closed; free `T0TIPREDEFFECT` does not require \(a<0\). - Driver et al. (2017, Eq. 5 of 2017-era `addedT0TIPREDVAR`; Table 3 / p. 16; Table 2, p. 12; 2017-era ctsem `summary.ctsemFit.R`; JSS PDF re-opened 2026-08-23T19:10Z) recovers a known extra observed-indicator TI variance \(\lambda^{2}t0_b^{2}v\) at machine-scale RMSE, and that RMSE is smaller than treating the latent extra \(t0_b^{2}v\), first-occasion observed variance \(\lambda^{2}p_0+\theta\), Eq. 5 of `addedTIPREDVAR` \(\lambda^{2}(B/a)^{2}v\), or `MANIFESTVAR` \(\theta\) as that observed extra; doubling \(v\) doubles the extra observed variance; a signed coefficient yields the same product; a zero loading or zero extra is exactly zero; \(v<0\) fails closed; a non-event clock and an overflowing product fail closed; free `T0TIPREDEFFECT` does not require \(a<0\).