RainbowStats Technical Appendix

Matrix Algebra for PCA-Based State Effects

How quarterly state house-price histories become three continuous variables in a county cross-section.

1. Construct the state history matrix

Let X be a T × S matrix. Each column contains quarterly log growth in the All-Transactions House Price Index for one state or the District of Columbia. In this analysis, S = 51 and T = 195.

xt,s = log(HPIt,s) − log(HPIt−1,s)

Because states have different means and volatilities, each column is standardized:

zt,s = (xt,s − x̄s) / σs

2. Decompose the correlation matrix

The standardized matrix produces the state correlation matrix:

R = (1 / (T − 1)) ZᵀZ

Principal component analysis performs the eigendecomposition:

R = VΛVᵀ

The diagonal matrix Λ contains eigenvalues ordered from largest to smallest. The columns of V are orthonormal eigenvectors. RainbowStats uses the state entries in these eigenvectors as the displayed component weights.

VᵀV = I
ComponentIndividual varianceCumulative variance
PC₀29.89%29.89%
PC₁10.21%40.10%
PC₂6.78%46.89%

3. Map state coordinates to counties

Let s(i) identify the state containing county i. For the first three components, county i receives the row of V belonging to its state:

pi,k = Vs(i),k,   k = 0,1,2

The 2024 county regression is then:

yi = α + βᵀwi + γ₀pi,0 + γ₁pi,1 + γ₂pi,2 + εi

Here, y is county house-price growth and w contains county personal-income growth, listing growth and nominal GDP growth.

4. Why this differs from state dummy variables

With state dummies, county i receives a one in its state's column and zero in every other state column. The coefficient for one state is unrelated by construction to the coefficient for another.

With PCA state effects, each state receives a three-number coordinate. States with similar historical housing dynamics tend to have similar coordinates. The model therefore uses a low-dimensional description of housing-market structure rather than a collection of unrelated labels.

Important qualification: PCA does not population-weight large states more heavily. Standardizing the 51 state series gives each state a place in the correlation matrix. What differs across states is the resulting loading, which reflects historical co-movement rather than population or GDP.

5. Orthogonality and the selected-state cross-section

The eigenvectors are orthogonal in the full 51-state PCA. Once the analysis keeps only eight states and repeats each state's coordinates for all of its counties, the county-level PCA columns need not remain perfectly uncorrelated. Unequal county counts implicitly reweight the state rows.

This explains why a correlation matrix calculated after county selection does not necessarily show exact zeros between the PCA variables. The PCA itself is not corrupted; the regression sample is a restricted and reweighted projection of the original state space.

6. The rank limit

The county sample contains eight states, so there are only eight distinct PCA loading profiles. The intercept is another between-state vector and consumes one degree of freedom. Consequently:

maximum independent state directions = 8 − 1 = 7

Attempting to include ten components makes the design matrix singular. With seven components, and assuming the restricted loading matrix has full rank, the PCA columns plus the intercept span the same between-state space as seven state dummies. At that point PCA is a rotation of the fixed-effect basis, not meaningful dimension reduction.

The three-component model is substantively different: it deliberately restricts the state effect to the leading historical housing patterns.

7. Seven-component robustness check

ComponentCoefficientt-statistic
PC₀−0.141−2.488
PC₁0.0694.980
PC₂0.0746.362
PC₃0.0351.837
PC₄0.0290.641
PC₅−0.045−0.994
PC₆0.0721.019

R² rises from 0.406 with three components to 0.451 with seven; adjusted R² rises from 0.389 to 0.424. The added components are not individually strong. The first three remain the stable, interpretable factors.

8. Nominalizing county GDP

Nominal GDP growth equals real GDP growth plus GDP-deflator growth:

Δlog(NGDPi,t) = Δlog(RGDPi,t) + Δlog(GDPDEFt)

For the 2024 cross-section, interpolated GDP-deflator growth is 0.025125, approximately 2.51%. This value is identical for every county. With an intercept, adding a common constant to one regressor changes the intercept but cannot change cross-sectional slopes, fitted values, residuals or R².

9. Interpretation limits