View source on GitHub
|
Checks the Bayesian posterior predictive p-value of the total outcome.
Inherits From: BaseCheck
meridian.analysis.review.checks.BayesianPPPCheck(
*,
meridian: (Any | None) = None,
model_context: (meridian.model.context.ModelContext | None) = None,
inference_data: (az.InferenceData | None) = None,
analyzer: meridian.analysis.analyzer.Analyzer,
config: ConfigType,
selected_geos: (Sequence[str] | None) = None,
selected_times: (Sequence[str] | None) = None
)
The test statistic is the outcome summed over the selected geos and times.
For each posterior draw, the model's predictive distribution of this total is
normal, with mean equal to the expected total outcome and variance equal to
the summed residual variance of the selected geo and time cells. The check
computes the two-sided posterior predictive p-value in closed form: the
average, over posterior draws, of the probability that a predictive total
lands at least as far from the posterior predictive mean as the observed
total. The check fails if the p-value is below ppp_threshold.
Methods
is_relevant
@classmethodis_relevant( model_context:meridian.model.context.ModelContext, inference_data: (az.InferenceData | None) = None ) -> bool
Checks if the check is relevant for the given model context.
run
run() -> meridian.analysis.review.results.BayesianPPPCheckResult
Executes the check.
The return type uses the generic ResultType, making it specific for each subclass.
View source on GitHub