AI for Econometricians — browser lab

Sequence Models: CNNs, RNNs, and Learned State

Three deterministic exercises on the same six-point sequence. Change one control, predict what will change, and compare the plot with the numerical table. No model weights are trained here.

Experiment 1 — Causal filter and lag alignment

The three weights refer to current, previous, and two-period-lagged inputs. The first complete window ends at time 3. No future inputs and no padding are used.

What does “causal” mean here?

The filter at t uses no values later than t. It does not establish a causal effect in the econometric sense. The filters are specified values, not estimates from training data.

Experiment 2 — How far does one input change travel?

Increase one observation by +0.5 and compare changes relative to the original sequence. The three-tap filter has a finite receptive field; the nonlinear recurrent state can respond at every later time.

The filter is the one selected in Experiment 1. The RNN recurrent weight is the one selected in Experiment 3.

Why isn't this an economic impulse response?

This is a controlled numeric perturbation of an input to two fixed computational mechanisms. The RNN is nonlinear, and there is no estimated structural economic system or identification strategy.

Experiment 3 — Actual recurrent sensitivity, not |w| alone

Trace the tanh hidden states and the exact local derivatives w_h × (1 − h_t²). Their product is the final-state sensitivity ∂h₆/∂h₀; check it against centered finite differences.

Which derivative is being tested?

Only the derivative of the final hidden state with respect to the initial hidden state, with all model parameters fixed. A training-loss gradient with respect to RNN weights would require the specified loss and further chain-rule terms.

Lesson notes — Course home — Python code — R code