cleverly.longitudinal.StructuralModelCheck#
- class cleverly.longitudinal.StructuralModelCheck(names: tuple[str, ...], structural: NDArray[float64], nonparametric: NDArray[float64], covariance: NDArray[float64], statistic: float, df: int, pvalue: float, reason: str | None, ltmle: Any, n_splits: int, reference_df: float = nan, support: Support = Support(label='experimental', reason='This estimate was built outside a classified fit.', evidence=(), row=None, limits=()))[source]#
The comparison of the structural contrasts with the nonparametric ones.
The difference of the two contrast vectors has mean zero when the structural model holds. The statistic is a joint Wald statistic over the contrasts against the reference. It is a necessary-condition check and not a test of the model. On a cross-fitted fit, every estimate is the mean over
n_splitsfold splits, the first of which is the fit’s own.- Parameters:
- names
tupleofstr The contrasts,
ate_regimen[<regimen> vs <reference>].- structural
ndarray The structural point estimates, averaged over the splits.
- nonparametric
ndarray The
LTMLEpoint estimates on the same rows and splits, averaged over the splits.- covariance
ndarray The covariance of the split-averaged difference: the cross-split covariance of the difference curves plus the between-split covariance of the difference over
n_splits.- statistic
float The Wald statistic,
nanwhen no test is reported.- df
int The degrees of freedom: the number of contrasts.
- pvalue
float The tail probability of the Hotelling-type reference law,
nanwhen no test is reported.- reason
strorNone Why no test is reported, or
None.- ltmle
LongitudinalResult The nonparametric fit on the folds of the structural fit.
- n_splits
int The fold splits behind the estimates:
1for an in-sample fit.- reference_df
float, default=nan The Welch-Satterthwaite degrees of freedom of the covariance, the smallest over the contrasts. The p-value reads the Hotelling-type law
F(df, reference_df - df + 1)of the scaled statistic, andinfreads chi-squared.nanwhen no statistic is reported.- support
Support, default=UNCLASSIFIED What the package states about the evidence behind the statistic: the combination of the support of the structural contrasts and of the nonparametric contrasts that the statistic compares. The check is
supportedonly when every one of them is supported on one row.
- names
Methods#
- StructuralModelCheck.summary(*, detail: Literal['short', 'full'] = 'short') Summary[source]#
The two sets of contrasts, the joint test, and how to read it.
- Parameters:
- detail{“short”, “full”},
default“short” "full"adds how the check works and what its degrees of freedom mean.
- detail{“short”, “full”},
- Returns:
SummaryThe summary. It prints as text;
readingsays what the test means.
Attributes#
- StructuralModelCheck.difference#
The structural minus the nonparametric contrasts.
- StructuralModelCheck.support: Support = Support(label='experimental', reason='This estimate was built outside a classified fit.', evidence=(), row=None, limits=())#
- StructuralModelCheck.tested#
Whether the check reports a statistic.
- StructuralModelCheck.structural: NDArray[float64]#
- StructuralModelCheck.nonparametric: NDArray[float64]#
- StructuralModelCheck.covariance: NDArray[float64]#