> ## Documentation Index
> Fetch the complete documentation index at: https://calendar-effects.mintlify.site/llms.txt
> Use this file to discover all available pages before exploring further.

# hosting/cards/dataset.md

> A Hugging Face card template: its {placeholders} are filled in by src/hosting/publish_hf.py.

`hosting/cards/dataset.md` · chapter [The dashboard and publishing](https://calendar-effects.mintlify.site/tour/09-dashboards-and-publishing.md), file 15 · 121 lines · [open in the repository](https://github.sfu.ca/aba395/Calendar-Effects/blob/main/hosting/cards/dataset.md)

## What it does

A Hugging Face card template: its \{placeholders} are filled in by src/hosting/publish\_hf.py.

## Source

```markdown title="hosting/cards/dataset.md" lines expandable theme={null}
---
license: cc-by-nc-4.0
pretty_name: Calendar Effects · retail stocks and Wikipedia attention around shopping events
language:
- en
tags:
- finance
- event-study
- stock-market
- wikipedia
- time-series
- spark-structured-streaming
size_categories:
- 10K<n<100K
configs:
- config_name: daily_signals
  data_files:
  - split: train
    path: data/daily_signals/train.parquet
  - split: validation
    path: data/daily_signals/validation.parquet
  - split: test
    path: data/daily_signals/test.parquet
  default: true
- config_name: event_windows
  data_files:
  - split: full
    path: data/event_windows.parquet
- config_name: event_summary
  data_files:
  - split: full
    path: data/event_summary.parquet
- config_name: event_trend
  data_files:
  - split: full
    path: data/event_trend.parquet
- config_name: big_move_predictions
  data_files:
  - split: train
    path: data/big_move_predictions/train.parquet
  - split: validation
    path: data/big_move_predictions/validation.parquet
  - split: test
    path: data/big_move_predictions/test.parquet
- config_name: ml_test_predictions
  data_files:
  - split: test
    path: data/ml_test_predictions.parquet
---

# Calendar Effects

Do retail stocks move abnormally around shopping events, and does Wikipedia attention move with them?
This dataset holds the results of a CMPT 732 (Big Data, Simon Fraser University) group project that
studied {n_retailers} US-listed retailers ({n_online} online, {n_store} store) from {first_year} to {last_year}
around {event_names}.

Daily prices and Wikipedia pageviews were replayed through **Kafka** into **Spark Structured Streaming**,
which fitted a market model for each stock every day, flagged abnormal returns and attention spikes,
closed each event window's cumulative abnormal return (CAR), and scored the next day with a
**Spark MLlib** model ([{model_repo}](https://huggingface.co/{model_repo})). A batch event study computed
the same CARs as an answer key, and the two match.

The dashboard: {dashboard_url} (also in the Space [{space_repo}](https://huggingface.co/spaces/{space_repo})).

## What is in it

| Subset | Rows | One row is |
|---|---|---|
| `daily_signals` | {n_signals} | a stock-day: abnormal return, its z-score, Wikipedia views and their z-score, alerts |
| `event_windows` | {n_windows} | one stock around one event occurrence: alpha, beta, CAR over days −5..+5, its z-score |
| `event_summary` | {n_summary} | an event type and retailer group: mean CAR, clustered 95% CI, four p-values |
| `event_trend` | {n_trend} | an event type: change in CAR per year, with its CI |
| `big_move_predictions` | {n_predictions} | a stock-day: the model's score for a big move the next day, and whether it was flagged |
| `ml_test_predictions` | {n_test} | a stock-day in the test years: score and what happened |

**Splits.** `daily_signals` and `big_move_predictions` are split by year exactly as the big-move model
was: `train` {fit_years_train}, `validation` {validation_year}, `test` {test_years}. The other tables
are not used for training, so each is one `full` split.

**Empty values.** Each stock's first {estimation_days} trading days only build its baseline, so early
rows have pageviews but no abnormal return yet. The same holds after gaps in a stock's history.

`results/` holds the report's summary of every result, its tables and charts. `config/` holds the
registries the pipeline reads: the retailers, the event types and their date rules,
the hand-listed event dates with sources, and the Wikipedia article of each company.

## How the columns are made

- **Abnormal return (`ar`)**: the day's return minus `alpha + beta × market return`, where alpha and beta
  come from an ordinary least squares fit on the previous {estimation_days} trading days, ending {gap_days} trading
  days earlier so an event never leaks into its own baseline. The market is the S&P 500 fund ({market}).
- **`z_ar`**: `ar / ar_sd`, the abnormal return in units of its usual size. `abnormal_return` is 1 when
  `|z_ar| ≥ {abnormal_z}`.
- **`z_views`**: the day's Wikipedia views against the previous {attention_days} trading days (with the same gap), in
  standard deviations. `attention_spike` is 1 when `z_views ≥ {spike_z}`.
- **CAR**: the sum of a window's abnormal returns over trading days −5..+5, where day 0 is the first
  trading day on or after the event date.
- **`p_big_move_next`**: the model's score that tomorrow's `|z_ar|` will be at least {abnormal_z}. It ranks
  days well but is not a calibrated probability (training weighted both classes equally);
  `big_move_alert` is 1 for scores in the top {alert_share} of the validation year.

## What is not in it

No prices, volumes or raw returns. They come from Yahoo Finance, whose terms do not allow republishing
them, so only statistics we computed from them are here. Wikipedia pageview counts come from the
Wikimedia REST API and are public (CC0).

## Findings, in short

- Store retailers' mean CAR over all events is {store_all_car} (clustered p = {store_all_p}).
- The big-move model ranks days with ROC-AUC {auc_roc} on {test_years}, and {precision_top} of its flags were
  big moves against a {base_rate} base rate ({lift_top} lift). Wikipedia attention did not improve it.

## Licence

[CC BY-NC 4.0](https://creativecommons.org/licenses/by-nc/4.0/): reuse and adapt with credit to the project,
not for commercial use (the prices behind these statistics may only be used non-commercially). The
Wikipedia pageview counts themselves are CC0. Nothing here is investment advice.

Built {built} from commit `{code_version}`.
```


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.