Extracts already-computed statistical signals from a fitted
EventStudyTask into a flat, JSON-ready S3 list. This is the
always-available grounding foundation for the knowledge base and offline
advice layer — it recomputes nothing; all signals already exist in the
fitted task.
Arguments
- task
A fitted
EventStudyTask(afterfit_model()and optionallycalculate_statistics()have been called).- max_events
Integer. Maximum number of events to include in the per-event sections (
estimation_window,event_window,contract_state). Events are ranked by anomaly score (degenerate events first, then by absolute final CAR). The remainder is summarised inaggregate_summary. Default: 20.
Value
A named list of class "es_diagnostics" with six sections:
metaList:
n_events_total(integer),n_events_shown(integer),n_events_summarized(integer),event_ids_shown(integer vector).estimation_windowList of plain numeric vectors (length
n_events_shown):r2,sigma,degree_of_freedom,shapiro_p,dw_stat,ljung_box_p,acf1. Each entry isNA_real_when the model was not fitted or residuals are insufficient for the test.event_windowList of plain numeric vectors (length
n_events_shown):ar_t(last event-window day AR t-stat),ar_p(two-sided p-value),car_t(full-window CAR t-stat),car_p(two-sided p-value),final_car. AllNA_real_when theART/CARTcolumns are absent.cross_sectionalList of scalars aggregated across ALL events:
n_events(total),n_valid_events(fitted count),car_iqr,car_sd,n_overlap_pairs,any_overlap. Multi-event fields degrade toNAwhentask$aar_caar_tblisNULL.contract_stateList of logical/numeric vectors (length
n_events_shown):is_fitted,na_ar_count,na_est_count,insufficient_obs,zero_var_index.aggregate_summaryNamed list summarising remainder events (those beyond
max_events):n_summarized,mean_r2,median_r2,mean_final_car,n_fitted,n_degenerate.NULLwhen no events are summarised (all shown).