Nixtla Event Impact Modeler
by intent-solutions-io
>
Skill Details
Repository Files
7 files in this skill directory
name: nixtla-event-impact-modeler description: > Quantifies the impact of exogenous events on contract prices using TimeGPT and CausalImpact. Triggers on "event impact analysis", "model event effects", "quantify event impact", or "causal analysis". version: "1.0.0" allowed-tools: "Read,Write,Bash,Glob,Grep,WebSearch"
Nixtla Event Impact Modeler
Quantifies the causal impact of exogenous events on contract prices using TimeGPT forecasting and CausalImpact analysis.
Overview
This skill analyzes how external events (promotions, natural disasters, policy changes) affect contract prices over time. It combines historical price data with event details to quantify causal impacts using MCMC-based counterfactual modeling and TimeGPT forecasting. The skill produces impact estimates, adjusted forecasts, and visualizations for event-driven price changes.
Use cases: Promotion effectiveness analysis, disaster impact quantification, policy change assessment, pricing anomaly investigation, event-aware forecasting.
Prerequisites
Environment:
NIXTLA_TIMEGPT_API_KEY(required for TimeGPT forecasting)
Dependencies:
pip install nixtla pandas causalimpact matplotlib
Input requirements:
prices.csv: Contract prices with columnsds(datetime),price(numeric)events.csv: Event data with columnsds(datetime),event(string description)
Instructions
Step 1: Prepare data
Load and validate contract price and event data using the data preparation script.
python {baseDir}/scripts/prepare_data.py \
--prices prices.csv \
--events events.csv \
--output-prices prepared_prices.csv \
--output-events prepared_events.csv
To create sample data for testing:
python {baseDir}/scripts/prepare_data.py --create-sample
Script actions:
- Loads CSV files with datetime parsing
- Validates required columns (
ds,price/event) - Renames columns to Nixtla standard (
yfor price) - Adds default
unique_idif missing - Outputs prepared CSVs for analysis
Step 2: Configure model
Define event windows and mark treatment/control periods in the price data.
python {baseDir}/scripts/configure_model.py \
--prices prepared_prices.csv \
--events prepared_events.csv \
--window-days 3 \
--output configured_prices.csv
Script actions:
- Defines event periods with configurable window (default: 3 days before/after)
- Validates event dates fall within price data range
- Creates
treatmentcolumn (1=treatment period, 0=control period) - Outputs configured DataFrame with treatment markers
Parameters:
--window-days: Event window size in days (default: 3)
Step 3: Execute analysis
Run CausalImpact analysis with TimeGPT forecasting to quantify event effects.
python {baseDir}/scripts/analyze_impact.py \
--prices configured_prices.csv \
--events prepared_events.csv \
--niter 1000 \
--window-days 3 \
--output-impact impact_results.csv \
--output-forecast adjusted_forecast.csv \
--output-summary causal_summary.txt
Script actions:
- Defines pre-intervention and post-intervention periods
- Runs CausalImpact MCMC analysis (configurable iterations)
- Calculates absolute and relative event effects
- Generates TimeGPT adjusted forecasts
- Outputs impact metrics, forecasts, and summary report
Parameters:
--niter: MCMC iterations for CausalImpact (default: 1000)--window-days: Event window size (must match Step 2)
Step 4: Generate report
Create visualization and markdown report summarizing the analysis.
python {baseDir}/scripts/generate_report.py \
--impact-results impact_results.csv \
--adjusted-forecast adjusted_forecast.csv \
--causal-summary causal_summary.txt \
--output-plot impact_plot.png \
--output-report impact_report.md \
--title "Event Impact on Contract Prices"
Script actions:
- Generates time series plot with actual prices, forecasts, and treatment periods
- Creates markdown report with impact metrics, CausalImpact summary, and methodology
- Outputs high-resolution PNG and structured markdown report
Output
Generated files:
impact_results.csv: Event impact metrics (absolute effect, relative effect, average price)adjusted_forecast.csv: TimeGPT forecasts with actual prices and predictionscausal_summary.txt: CausalImpact statistical summaryimpact_plot.png: Time series visualization with treatment periods highlightedimpact_report.md: Comprehensive markdown report with all results
Impact metrics:
- Absolute effect: Total price change attributable to events
- Relative effect: Percentage change relative to mean price
- Counterfactual forecast: What prices would have been without events
Error Handling
| Error | Solution |
|---|---|
| Event dates outside price range | Adjust event dates or expand price data range |
| Missing event descriptions | Ensure event column exists in events CSV |
| TimeGPT API request failed | Verify NIXTLA_TIMEGPT_API_KEY and internet connection |
| CausalImpact failed to converge | Increase --niter parameter or adjust event windows |
| Insufficient pre-intervention data | Expand price history before first event |
Examples
Example 1: Promotion impact analysis
Scenario: Quantify price increase during promotional campaign.
Input:
prices.csv: Daily prices for 30 daysevents.csv: Single promotion event on day 15
Command sequence:
python scripts/prepare_data.py --prices prices.csv --events events.csv
python scripts/configure_model.py --prices prepared_prices.csv --events prepared_events.csv --window-days 5
python scripts/analyze_impact.py --prices configured_prices.csv --events prepared_events.csv --niter 2000
python scripts/generate_report.py --impact-results impact_results.csv --adjusted-forecast adjusted_forecast.csv
Output: impact_results.csv shows 15% relative price increase during promotion period.
Example 2: Natural disaster impact
Scenario: Assess price drop following natural disaster.
Input:
prices.csv: Weekly prices for 52 weeksevents.csv: Disaster event on week 26
Command sequence:
python scripts/prepare_data.py --prices prices.csv --events events.csv
python scripts/configure_model.py --prices prepared_prices.csv --events prepared_events.csv --window-days 7
python scripts/analyze_impact.py --prices configured_prices.csv --events prepared_events.csv
python scripts/generate_report.py --impact-results impact_results.csv --adjusted-forecast adjusted_forecast.csv --title "Disaster Impact Analysis"
Output: impact_report.md documents price recovery timeline and total economic impact.
Resources
Scripts (all in {baseDir}/scripts/):
prepare_data.py: Data loading and validation with argparse CLIconfigure_model.py: Event period configuration and treatment/control markinganalyze_impact.py: CausalImpact + TimeGPT analysis enginegenerate_report.py: Visualization and markdown report generation
Documentation:
Related Skills
Attack Tree Construction
Build comprehensive attack trees to visualize threat paths. Use when mapping attack scenarios, identifying defense gaps, or communicating security risks to stakeholders.
Grafana Dashboards
Create and manage production Grafana dashboards for real-time visualization of system and application metrics. Use when building monitoring dashboards, visualizing metrics, or creating operational observability interfaces.
Matplotlib
Foundational plotting library. Create line plots, scatter, bar, histograms, heatmaps, 3D, subplots, export PNG/PDF/SVG, for scientific visualization and publication figures.
Scientific Visualization
Create publication figures with matplotlib/seaborn/plotly. Multi-panel layouts, error bars, significance markers, colorblind-safe, export PDF/EPS/TIFF, for journal-ready scientific plots.
Seaborn
Statistical visualization. Scatter, box, violin, heatmaps, pair plots, regression, correlation matrices, KDE, faceted plots, for exploratory analysis and publication figures.
Shap
Model interpretability and explainability using SHAP (SHapley Additive exPlanations). Use this skill when explaining machine learning model predictions, computing feature importance, generating SHAP plots (waterfall, beeswarm, bar, scatter, force, heatmap), debugging models, analyzing model bias or fairness, comparing models, or implementing explainable AI. Works with tree-based models (XGBoost, LightGBM, Random Forest), deep learning (TensorFlow, PyTorch), linear models, and any black-box model
Pydeseq2
Differential gene expression analysis (Python DESeq2). Identify DE genes from bulk RNA-seq counts, Wald tests, FDR correction, volcano/MA plots, for RNA-seq analysis.
Query Writing
For writing and executing SQL queries - from simple single-table queries to complex multi-table JOINs and aggregations
Pydeseq2
Differential gene expression analysis (Python DESeq2). Identify DE genes from bulk RNA-seq counts, Wald tests, FDR correction, volcano/MA plots, for RNA-seq analysis.
Scientific Visualization
Meta-skill for publication-ready figures. Use when creating journal submission figures requiring multi-panel layouts, significance annotations, error bars, colorblind-safe palettes, and specific journal formatting (Nature, Science, Cell). Orchestrates matplotlib/seaborn/plotly with publication styles. For quick exploration use seaborn or plotly directly.
