Note 30: Case Study II: Astrophysical Light Curves & Sensor Flux
Module 7: Wrangling, Case Studies & Ethics
Learning Objectives
Audit pre-processed space-telescope telemetry (data/lc_kepler.csv) and diagnose how aggressive detrending and sigma-clipping can erase the very physical signal under study.
Explain why information criteria (AIC/AICc) cannot be compared across different temporal aggregation scales and distinguish statistical significance from physical importance in large-\(N\) series.
Show mathematically and empirically how pre-smoothing with a rolling average injects artificial \(\text{MA}(q)\) autocorrelation into white noise.
Evaluate dynamic regression (ARIMA(rate ~ exposure)) against univariate ARIMA and ETS on Swift/BAT Crab Nebula X-ray telemetry (data/crab.csv) to separate astrophysical drift from instrumental exposure.
1. Tabby’s Star: When Preprocessing Erases the Signal
Tabby’s Star (KIC 8462852) became famous during NASA’s Kepler mission for irregular, asymmetric optical dimming events reaching up to 22% depth and lasting 5 to 80 days, widely attributed to transit clouds of exocomet dust fragments.
Artist impression of dust and comet fragments orbiting Tabby’s Star (KIC 8462852).
The local file data/lc_kepler.csv holds 58,502 long-cadence (~29.4-minute) flux observations indexed in Barycentric Kepler Julian Date (BKJD), defined by the NASA Kepler archive as days since 2009-01-01 12:00:00 UTC (\(\text{BJD} = \text{BKJD} + 2{,}454{,}833.0\)). Before fitting any model, always audit the empirical distribution of the archive.
Look closely at Min_Flux: it is 0.99851 (a 0.15% deviation!), not 0.78. Why did the famous 22% dips vanish? This CSV was exported after applying \(3\sigma\) outlier clipping plus a 101-cadence (\(\approx 2.06\)-day) cubic Savitzky-Golay flattening filter. Any astrophysical dimming lasting 5–80 days was treated as “slow baseline drift” and divided out, while sharp dip cores were clipped as outliers! Even the deepest residual notch at BKJD 794.07 (2011-03-06, the exact date of the famous 15% D792 dip) was flattened to sub-percent micro-variability.
Kepler operated in an Earth-trailing heliocentric orbit, so its telemetry has no 24-hour terrestrial diurnal cycle (PDQ(0, 0, 0)). Below we aggregate the full 4-year mission to regular daily means (1,462 days) and compare it against a dense 60-day hourly window (2010-05-01 to 2010-06-30, 1,440 hours).
Figure 1: Pre-flattened Kepler flux of KIC 8462852 across the full 4-year mission (daily means, top) and a 60-day hourly window in May–June 2010 (bottom).
fit_daily <- lc_daily |>model(ARIMA =ARIMA(flux_imp ~PDQ(0, 0, 0)))fit_hourly <- lc_hourly60 |>model(ARIMA =ARIMA(flux_imp ~PDQ(0, 0, 0)))bind_rows(glance(fit_daily) |>mutate(Scale ="Daily (4 yr, n = 1462)", Spec =format(fit_daily$ARIMA)),glance(fit_hourly) |>mutate(Scale ="Hourly (60 d, n = 1440)", Spec =format(fit_hourly$ARIMA))) |>mutate(Resid_SD_ppm =sqrt(sigma2) *1e6) |>select(Scale, Spec, Resid_SD_ppm, log_lik, AIC, AICc) |>fmt_tbl(digits =1, caption ="ARIMA fits across two aggregation scales (AIC values are NOT comparable; SD in ppm).")
ARIMA fits across two aggregation scales (AIC values are NOT comparable; SD in ppm).
Scale
Spec
Resid_SD_ppm
log_lik
AIC
AICc
Daily (4 yr, n = 1462)
<ARIMA(1,0,1) w/ mean>
58.0
12187
-24367
-24367
Hourly (60 d, n = 1440)
<ARIMA(3,0,2) w/ mean>
82.7
11495
-22976
-22976
Three methodological lessons follow from this comparison:
AIC is strictly incomparable across aggregation scales. Because \(\text{AIC} = -2\ell(\hat{\theta}; \mathbf{y}) + 2k\) evaluates the Gaussian log-likelihood on a specific data vector \(\mathbf{y}\), changing from hourly averages to daily averages alters both the observations and their noise variance \(\sigma^2 \sim 10^{-9}\). A lower AIC on daily data (-24,367 vs -22,976) never implies a “better” scientific model of the star.
Statistical significance is not astrophysical significance. In the daily ARIMA(1,0,1) fit, \(\hat{\phi}_1 = 0.791\) yields \(|t| = 42.4\) (\(p < 10^{-250}\)), yet the entire series standard deviation is \(0.00017\) (0.017% flux): much of that short-range autocorrelation is the residual footprint of the 2-day Savitzky-Golay filter itself.
Linear ARIMA cannot forecast aperiodic occultation transients. Stationary Gaussian ARIMA forms linear combinations of recent lags and reverts to the baseline mean; it has zero predictive power for sudden, asymmetric dust-cloud eclipses arriving years apart.
3. Crab Nebula X-Ray Telemetry & The Moving-Average Trap
The Crab Nebula (remnant of the 1054 CE supernova) and its central pulsar have long served as an X-ray “standard candle” for calibrating space observatories. Yet NASA’s Swift Burst Alert Telescope (BAT, 15–50 keV) revealed genuine multi-year hard X-ray drift of roughly 7% (Wilson-Hodge et al., 2011).
Hubble Space Telescope composite image of the Crab Nebula (M1, remnant of SN 1054).
Before aggregating data/crab.csv to weekly means, beware a common preprocessing mistake: applying a \(k\)-point rolling mean before fitting ARIMA. Suppose \(\varepsilon_t \stackrel{\text{iid}}{\sim} (0, \sigma^2)\) is pure white noise, and we form \(z_t = \frac{1}{3}(\varepsilon_t + \varepsilon_{t-1} + \varepsilon_{t-2})\). Because consecutive averages share overlapping innovations, \(z_t\) becomes an exact \(\text{MA}(2)\) process with theoretical autocorrelations:
Pre-smoothing therefore fabricates strong serial correlation that never existed in the detector data.
set.seed(493)wn <-rnorm(1000)ma3 <-na.omit(as.numeric(stats::filter(wn, rep(1/3, 3), sides =1)))tibble(Lag =1:3,White_Noise_ACF =acf(wn, plot =FALSE)$acf[2:4],MA3_Smoothed_ACF =acf(ma3, plot =FALSE)$acf[2:4],Theoretical_MA2 =c(2/3, 1/3, 0)) |>fmt_tbl(digits =3, caption ="Artificial MA(2) autocorrelation injected by a 3-point moving average on white noise.")
Artificial MA(2) autocorrelation injected by a 3-point moving average on white noise.
Lag
White_Noise_ACF
MA3_Smoothed_ACF
Theoretical_MA2
1
-0.063
0.642
0.667
2
0.030
0.349
0.333
3
-0.002
0.002
0.000
4. Secular Flux Drift vs. Exposure Time in Swift/BAT
Auditing data/crab.csv by year reveals a high-fidelity calibration era from 2005 through 2018 (annual mean count rate drops 6.9% from 0.230 in 2008 to 0.214 in 2011), whereas 2019–2025 contains an archive outage carry-forward block (only 6 unique values in 2019) and late calibration spikes. We therefore analyze the clean 2005–2018 record, aggregating raw daily rates (DATA_FLAG == 0) directly to weekly means without rolling smoothing, and test whether weekly detector exposure (TIMEDEL_EXPO, in kiloseconds) explains flux variation using dynamic regression:
Figure 2: Weekly Swift/BAT hard X-ray count rate of the Crab Nebula (2005–2018), showing the ~7% secular decline from 2008 to 2011 and 2017–2018 ARIMA holdout forecasts.
In ARIMAX (LM w/ ARIMA(2,1,2) errors), the exposure slope is tiny and insignificant (\(\hat{\beta}_1 = -0.000027\), \(p = 0.713\)), and univariate ARIMA(2,1,2) beats both ARIMAX and ETS on the 2-year holdout (RMSE = 0.00689, MAPE = 1.89%). This confirms that the ~7% multi-year flux variation is genuine astrophysical evolution in the nebula’s synchrotron wind rather than an artifact of spacecraft exposure time.
Practice Exercises
Verifying Moving-Average Autocorrelation Bias. Simulate 2,000 standard normal white-noise observations and compare the empirical ACF at lags 1–4 of (a) the raw series and (b) a 5-point moving average against the theoretical formula \(\rho(h) = (5 - h)/5\) for \(1 \le h \le 4\).
Solution
A \(k\)-point simple moving average of white noise shares \(k - h\) overlapping innovations at lag \(h < k\), yielding \(\rho(h) = (k - h)/k\):
set.seed(2025)e <-rnorm(2000)ma5 <-na.omit(as.numeric(stats::filter(e, rep(1/5, 5), sides =1)))tibble(Lag =1:4,Raw_WN =acf(e, plot =FALSE)$acf[2:5],MA5_Empirical =acf(ma5, plot =FALSE)$acf[2:5],MA5_Theoretical = (5-1:4) /5) |>fmt_tbl(digits =3, caption ="Empirical vs. theoretical autocorrelation induced by a 5-point moving average.")
Empirical vs. theoretical autocorrelation induced by a 5-point moving average.
Lag
Raw_WN
MA5_Empirical
MA5_Theoretical
1
0.011
0.776
0.8
2
-0.022
0.534
0.6
3
-0.029
0.296
0.4
4
-0.055
0.075
0.2
Daily vs. Weekly Crab Nebula Diagnostics. Fit a parsimonious ARIMA(RATE ~ pdq(0:2, 0:1, 0:2) + PDQ(0, 0, 0)) to the 2005–2018 daily Crab Nebula series (after fill_gaps() and linear interpolation) and compare its residual standard deviation (\(\sqrt{\sigma^2}\)) and lag-20 Ljung-Box test against the weekly ARIMA model from Section 4.
Solution
Aggregate averaging reduces daily photon-counting noise substantially, while both series should be audited with exact dof = p + q:
Daily vs. weekly Crab Nebula ARIMA residual diagnostics.
Scale
Resid_SD
lb_stat
lb_pvalue
Daily
0.00355
975.35
0.0000
Weekly
0.00527
15.08
0.5187
Daily ARIMA(2,1,1) shows a deceptively small innovation SD (0.00355) yet fails the Ljung-Box test dramatically (\(Q^* = 975.4\), \(p < 0.0001\)) with a sharp negative residual spike at lag 3 (-0.39). Because differencing a 3-point moving average produces \(\Delta z_t = (\varepsilon_t - \varepsilon_{t-3})/3\) (theoretical lag-3 ACF of \(-0.5\)), that diagnostic uncovers a 3-day rolling average baked into the archived daily file upstream! Aggregating directly into non-overlapping weekly bins breaks the 3-day overlap and restores clean white-noise innovations (\(Q^* = 15.08\), \(p = 0.519\)).
Key Takeaways
Always inspect empirical min/max ranges before modeling archived data: over-aggressive sigma-clipping and short-window Savitzky-Golay detrending erased Tabby’s Star’s real 22% dips down to 0.15% micro-variability.
Never compare AIC or AICc across different aggregation frequencies (hourly vs. daily) or different sample windows; likelihoods live on incompatible data spaces.
Never pre-smooth a series with a rolling average before fitting ARIMA: a \(k\)-point moving average injects artificial \(\text{MA}(k-1)\) autocorrelation into white noise.
Dynamic regression (ARIMA(y ~ x)) provides a formal out-of-sample test separating instrumental artifacts (such as spacecraft exposure) from real astrophysical drift.