Supplementary Material S1 (revised): code for "A Marked Discrete-Time Hawkes Model with Periodic Baseline for
Corporate Patent Filing Dynamics" (mathematics-4669062, revision 1). Python 3, numpy, scipy, pandas, scikit-learn, matplotlib.

Data
  build_daily.py            daily firm-level panel from CSMAR application records (same-day near-duplicates merged)
  xdup_text.py, build_xdaytxt.py  near-identical applications filed 1-3 days apart (Reviewer 2, comment 5)
  pubdelay.py               completeness of late-2024 filings from publication delays (comment 6)
  caldesc.py, desc2.py      calendar statistics and descriptive table
  china_holiday_calendar_2010_2024.csv  official public holidays and make-up working days (State Council notices)

Estimation
  hawkes4.py                generalised exact ECM/SQUAREM estimator: occasion (censored Poisson), Poisson and negative binomial
                            families; calendar, holiday and free date factors; firm trend, firm-year, half-year, factorised and
                            piecewise-linear baselines; arbitrary kernel clocks (e.g. working days); group-specific excitation
  hawkes.py                 helpers (calendar coding, batch model)
  rev_fit.py                all main and robustness fits:  python3 rev_fit.py SPEC K PERIODS
                            SPEC examples: hol (main), base, date, hol+wd, hol+year, hol+firm, hol+half, hol+pwl, hol+xdaytxt,
                            hol+sel, hol+hist0, hol+hist1460
  boot8.py                  parametric bootstrap of the main specification
  het_rev.py                heterogeneity with firm-clustered sandwich standard errors
  fri_diag.py               observed vs predicted next-day occasion rates (comment 3)
  pred_rev.py               predictive comparison with a common baseline, NB and Poisson Hawkes, Diebold-Mariano tests
  select_oos.py             model selection by one-year-ahead log score
Simulation
  sim8.py                   main simulation study with inner bootstrap
  sim_ar.py                 smooth AR(1) baseline deviations without/with slow excitation (comment 2)
Output
  gather.py, gather_sim.py, figs_rev.py   tables and figures

The patent records are licensed from CSMAR and cannot be redistributed; the derived daily panel is available from the
authors on request. CSMAR column names are kept in their original form and are defined as Unicode-escaped
constants at the top of the data scripts (e.g. COL_APP_NO = application number).
