← Module 11 overview
Module 11 · Project 6 · Due the date on Canvas · Time-Series Visualization · adaptive competency DV19

Verify transformations in browser R

Module 11 · Step 6 of 9 · Verify in browser R12–15 min

Why this lab Confirm the transformations with real R output and plots.

The R starter uses two synthetic fixtures with fictional monthly dates, not external campus records. Series 1 contains 24 fixed values; Series 2 simulates 36 enrollment values with seed 1104 and Gaussian error SD 1.5 before rounding. The annual smoother uses the symmetric 2-by-12 weights of classical seasonal adjustment (Cleveland & Tiao, 1976): endpoint weights 1/24 and eleven interior weights 1/12, omitting six months at each end. A classical additive decomposition of Series 2 then estimates the twelve seasonal effects from the data, so they can be compared with the effects the generator specified; with three years of monthly data the estimates approximate the specified effects without reproducing them exactly. The sample autocorrelation at lag \( k \) is \( r_k = \sum_{t=1}^{n-k}(y_t-\bar{y})(y_{t+k}-\bar{y}) \big/ \sum_{t=1}^{n}(y_t-\bar{y})^2 \), the quantity acf() prints. For independent observations its standard deviation is approximately \( 1/\sqrt{n} \), so values beyond about \( \pm 2/\sqrt{n} \) merit attention (Bartlett, 1946): roughly \( \pm 0.41 \) for the 24 values of Series 1 and \( \pm 0.33 \) for the 36 values of Series 2. Lag-12 autocorrelation is diagnostic, not proof that a cycle exists or is absent; trend and structural shifts can affect it, and a formal portmanteau test of residual autocorrelation exists for model checking (Ljung & Box, 1978). The comparison of pre/post means also includes the trend and is not a causal effect estimate; segmented regression separates a change in level from the pre-existing trend (Wagner et al., 2002). The lab ends by checking what the decomposition leaves unexplained. The remainder standard deviation is 1.03, below the generator’s 1.5 because the estimated trend and seasonal effects absorb part of the noise. The remainder autocorrelation at lag 12 is -0.5, outside the band of about ±0.41 for its 24 values; this is a property of the method rather than evidence of a remaining cycle. With two years of detrended values, each month’s seasonal effect is the mean of two values, so the two remainders for the same month are close to equal and opposite. A remainder diagnostic is read against how the components were estimated. The R output must agree with the visual interpretation before that interpretation is written into a caption.

Browser R · time-series verification

Inline R lab loading…

Evidence check: which conclusion is licensed by the output?