---
title: "Principal Components Regression: What Does the Yield Curve Say About Next Year's Economy?"
description: "Principal components regression (PCR) in R, by hand and with pls::pcr(), on eight US interest rates that correlate above .94 and the growth of the US economy a year later (FRED, 1976-2019): why least squares fails with collinear predictors, level, slope and curvature, scores and loadings, choosing the number of components by cross-validation in blocks, back to coefficients, the trap of the component with the largest variance, ridge for comparison, Newey-West errors and APA reporting."
author: ""
---
```{r options, echo=FALSE, warning=FALSE, message=FALSE}
directory<-if (rstudioapi::isAvailable()) paste0(dirname(rstudioapi::getActiveDocumentContext()$path),"/") else ""
source(paste0(directory, "R/code_options.R"))
# no knitr cache: the page downloads its data from FRED each time it runs (in a few seconds),
# and a cached chunk would quietly keep an old download
knitr::opts_chunk$set(fig.height = 4.5, cache = FALSE)
```
## The question: eight predictors that say the same thing
The United States borrows money for three months, for a year, for five, for ten. Each of these loans has its own interest rate, and together they form the **yield curve**. People who watch the economy look at its shape. When the long rates are much higher than the short ones, the economy usually grows. When the short rates climb above the long ones, the curve is *inverted*, and a recession often follows (Estrella & Hardouvelis, 1991).
So: **can the eight interest rates of today predict how much the economy will grow in the next year?**
A regression with eight predictors is easy to run and hopeless to read. The eight rates rise and fall together; two neighbors correlate above .99. Least squares cannot tell them apart, and its coefficients explode.
**Principal components regression** (PCR) goes around the problem in two steps. First it replaces the eight rates by a few **new** variables that summarize them and do not correlate with each other. Then it uses these in an ordinary regression. This example is a kind one, because the new variables have a meaning that anybody can see. It also shows the weak point of the method, in its purest form.
```{r packages}
library(ggplot2)
library(pls) # pcr(): principal components regression, with cross-validation
library(sandwich) # NeweyWest(): standard errors for overlapping time series
library(lmtest) # coeftest(), coefci()
library(glmnet) # ridge regression, for comparison
# number formats for the text
f1 <- function(x) formatC(x, format = "f", digits = 1, big.mark = ",")
f2 <- function(x) formatC(x, format = "f", digits = 2, big.mark = ",")
f3 <- function(x) formatC(x, format = "f", digits = 3, big.mark = ",")
# no leading zero
nz <- function(x, d = 2) sub("^(-?)0", "\\1", formatC(x, format = "f", digits = d))
pval <- function(p) if (p < .001) "< .001" else paste("=", nz(p, 3))
pct <- function(x, d = 1) paste0(formatC(100 * x, format = "f", digits = d), "%")
```
---
## 1. The data
FRED, the database of the Federal Reserve Bank of St. Louis, gives every series as a CSV file, free and with no login. We take the monthly interest rates for eight maturities, average them over each quarter, and the real gross domestic product (GDP) of the quarter (Board of Governors of the Federal Reserve System, n.d.; U.S. Bureau of Economic Analysis, n.d.).
```{r download}
fred <- function(id) {
d <- read.csv(paste0("https://fred.stlouisfed.org/graph/fredgraph.csv?id=", id), na.strings = ".")
names(d) <- c("date", "value")
quarter <- paste0(substr(d$date, 1, 4), "Q", (as.integer(substr(d$date, 6, 7)) + 2) %/% 3)
tapply(d$value, quarter, mean) # the mean of the months of the quarter
}
maturities <- c(`3 months` = "TB3MS", `6 months` = "TB6MS", `1 year` = "GS1", `2 years` = "GS2",
`3 years` = "GS3", `5 years` = "GS5", `7 years` = "GS7", `10 years` = "GS10")
rates <- lapply(maturities, fred)
gdp <- fred("GDPC1")
quarters <- names(rates[["2 years"]]) # the shortest series: it starts in 1976
quarters <- quarters[quarters >= "1976Q3" & quarters <= "2018Q4"]
X <- sapply(rates, function(r) r[quarters]) # 8 columns: percent per year
at <- match(quarters, names(gdp))
y <- as.numeric(100 * (gdp[at + 4] / gdp[at] - 1)) # growth in the NEXT four quarters, in %
n <- nrow(X)
c(quarters = n, rates = ncol(X))
summary(y)
```
A row is a quarter. The predictors are the rates of that quarter; the outcome is the growth of real GDP over the **following** four quarters, so it is a forecast. The sample ends with the rates of `r tail(quarters, 1)`, whose outcome is the growth until the end of 2019: the pandemic of 2020 was not in any yield curve. There are `r n` quarters. Mean growth was `r f1(mean(y))`% a year, with a standard deviation of `r f1(sd(y))`.
---
## 2. Look at the data
```{r look, fig.height = 6.5}
time <- as.numeric(substr(quarters, 1, 4)) + (as.numeric(substr(quarters, 6, 6)) - 1) / 4
long <- data.frame(
time = rep(time, 8),
rate = as.vector(X),
maturity = factor(rep(colnames(X), each = n), levels = colnames(X))
)
pa <- ggplot(long, aes(time, rate, colour = maturity)) +
geom_line(linewidth = 0.5) +
scale_colour_viridis_d(option = "D", end = 0.9, name = NULL) +
labs(title = "Eight interest rates", x = NULL, y = "% per year") + theme_bw()
pb <- ggplot(data.frame(time, y), aes(time, y)) +
geom_hline(yintercept = 0, colour = "grey60") +
geom_line(colour = "#eb6834", linewidth = 0.7) +
labs(
title = "Growth of the economy in the following year",
x = "quarter in which the rates were observed",
y = "%"
) +
theme_bw()
patchwork::wrap_plots(pa, pb, ncol = 1)
R <- cor(X)
range(R[lower.tri(R)])
```
The eight lines move as one. The correlations are between `r f2(min(R[lower.tri(R)]))` and `r f3(max(R[lower.tri(R)]))`. What distinguishes the quarters, apart from the level, is how far the lines are **spread**.
---
## 3. Why least squares fails
```{r ols}
ols <- lm(y ~ X)
ols_table <- coef(summary(ols))[-1, ]
rownames(ols_table) <- colnames(X)
round(ols_table, 2)
vif <- diag(solve(R)) # variance inflation factors
round(vif)
c(R2 = summary(ols)$r.squared)
```
Read the column of estimates. The 2-year rate: `r f1(ols_table["2 years", 1])`. The 5-year rate: `r f1(ols_table["5 years", 1])`. So the economy should grow by `r f1(ols_table["2 years", 1])` points more when the 2-year rate is one point higher and everything else stays the same. But everything else **never** stays the same. When the 2-year rate rises, the 1-year and the 3-year rates rise with it.
The **variance inflation factor** says how many times the variance of a coefficient is larger than it would be with uncorrelated predictors. A usual warning level is 10. Here it goes up to `r formatC(max(vif), format = "f", digits = 0, big.mark = ",")`. The fit is not the problem: the predictions of least squares are still meaningful as long as the rates move together. But the coefficients are noise, and they change wildly if a few quarters are left out:
```{r unstable}
half <- time < 1998
round(
cbind(
first_half = coef(lm(y ~ X, subset = half))[-1],
second_half = coef(lm(y ~ X, subset = !half))[-1]
),
1
)
```
---
## 4. The method step by step, with formulas
### Step 1: principal components
Center the columns of $X$ (subtract the means). We look for a weighted sum of the eight rates, $t_1 = X v_1$, with weights of length 1, that **varies as much as possible**. That is the first component. The second, $t_2 = X v_2$, varies as much as possible among all the weighted sums that are uncorrelated with the first. And so on, until there are eight. The weights $v_j$ are the **loadings**, the values $t_{ij}$ the **scores**. They come from the eigenvectors of the covariance matrix of $X$:
$$S = \frac{X^\top X}{n-1}, \qquad S v_j = \lambda_j v_j, \qquad \text{Var}(t_j) = \lambda_j$$
```{r components}
Xc <- scale(X, scale = FALSE) # centered, not divided by the SD
eig <- eigen(cov(X))
V <- eig$vectors
# +1 or -1 for each component
turn <- sign(c(V[1, 1], V[8, 2] - V[1, 2], V[1, 3] + V[8, 3], rep(1, 5)))
V <- V %*% diag(turn)
dimnames(V) <- list(colnames(X), paste0("PC", 1:8))
Tscores <- Xc %*% V
share <- eig$values / sum(eig$values)
round(100 * share, 3)
max(abs(abs(prcomp(X)$x) - abs(Tscores))) # the same as prcomp()
```
The sign of a component is arbitrary (if $v$ is a solution, so is $-v$), and we turned the first three so that they are easy to read. All the rates are in the same unit, percent per year, so we did **not** standardize them. With predictors in different units one must (`scale. = TRUE`), or the component follows the variable with the largest numbers.
```{r loadings}
years <- c(0.25, 0.5, 1, 2, 3, 5, 7, 10)
load_long <- data.frame(
years = rep(years, 3),
loading = as.vector(V[, 1:3]),
component = factor(
rep(c("PC1: level", "PC2: slope", "PC3: curvature"), each = 8),
levels = c("PC1: level", "PC2: slope", "PC3: curvature")
)
)
ggplot(load_long, aes(years, loading, colour = component)) +
geom_hline(yintercept = 0, colour = "grey60") +
geom_line(linewidth = 1) + geom_point(size = 2.2) +
scale_colour_manual(values = c("#2a78d6", "#eb6834", "#1baf7a"), name = NULL) +
labs(title = "The weights of the first three components", x = "maturity (years)", y = "loading") +
theme_bw() + theme(legend.position = "bottom")
```
The eight rates have turned into three ideas, known to every bond trader since Litterman and Scheinkman (1991):
- **PC1, the level** (`r pct(share[1])` of the variance): nearly equal weights. High when all rates are high.
- **PC2, the slope** (`r pct(share[2])`): negative weights for the short, positive for the long rates. High when the curve is steep, negative when it is inverted.
- **PC3, the curvature** (`r pct(share[3], 2)`): positive at both ends, negative in the middle.
The remaining five together have `r pct(sum(share[4:8]), 2)` of the variance.
### Step 2: regress the outcome on the scores
Take the first $a$ components and run an ordinary regression:
$$y = \gamma_0 + \gamma_1 t_1 + \dots + \gamma_a t_a + e$$
The scores are uncorrelated, so the coefficient of a component does not change when others are added or removed. There is no collinearity left.
### Step 3: translate back to the original predictors
The scores are weighted sums of the rates, so the regression on the scores **is** a regression on the rates, with coefficients
$$\hat\beta_{PCR} = V_a \hat\gamma = \sum_{j=1}^{a} \hat\gamma_j v_j$$
With all eight components this is exactly the least-squares solution. With fewer, the directions in which the predictors hardly vary are left out, and those were the directions that made the coefficients explode: the variance of $\hat\gamma_j$ is $\sigma^2 / \big((n-1)\lambda_j\big)$, huge when $\lambda_j$ is tiny.
### Step 4: choose the number of components
PCR has one setting, $a$. It is chosen by **cross-validation**: which number of components predicts quarters that were not used in the fit best?
---
## 5. Fitting the model
### How are the components related to growth?
```{r component_regression}
pcr_by_hand <- lm(y ~ Tscores[, 1:3])
names(pcr_by_hand$coefficients) <- c("(Intercept)", "level", "slope", "curvature")
gamma <- coef(pcr_by_hand)
r_components <- drop(cor(Tscores, y))
round(rbind(share_of_variance_of_X = share, correlation_with_growth = r_components), 4)
summary(pcr_by_hand)
```
The outcome overlaps: the growth of the next four quarters, seen from two neighboring quarters, shares three of them. So the residuals are autocorrelated and the standard errors above are too small. The Newey–West standard errors (see [generalized least squares](EXAMPLE_GENERALIZED_LEAST_SQUARES.Rmd)) allow for it:
```{r newey_west}
nw <- NeweyWest(pcr_by_hand, lag = 6, prewhite = FALSE)
hac <- coeftest(pcr_by_hand, vcov = nw)
ci <- coefci(pcr_by_hand, vcov. = nw)
hac
```
Look at the two rows of the first table above. The **level**, with `r pct(share[1])` of the variance of the predictors, correlates with growth at `r f2(r_components[1])`: it says nothing. The **slope**, with `r pct(share[2])` of the variance, correlates at `r f2(r_components[2])`, and the **curvature**, with `r pct(share[3], 2)`, at `r f2(r_components[3])`.
This is the weak point of PCR. The components are made **without looking at the outcome**. The component with the largest variance need not be the one that matters, and the method has no way of knowing (Jolliffe, 1982). Somebody who keeps "the components that explain 95% of the variance", a common rule, would have kept the level only, and found nothing.
### How many components? Cross-validation in blocks
Neighboring quarters are nearly copies of each other, so leaving out single quarters at random would be no test at all. We cut the years into ten **blocks**, leave out one, and also the four quarters on each side of it, whose outcomes overlap with the block:
```{r cross_validation}
block <- cut(seq_len(n), 10, labels = FALSE)
cv_error <- function(predict_fun) {
pred <- numeric(n)
for (k in 1:10) {
test <- which(block == k)
# the block and its neighbors
near <- which(sapply(seq_len(n), function(i) min(abs(i - test))) <= 4)
pred[test] <- predict_fun(setdiff(seq_len(n), near), test)
}
sqrt(mean((y - pred)^2))
}
pcr_predict <- function(a) function(train, test) {
if (a == 0) return(rep(mean(y[train]), length(test)))
m <- pcr(y ~ X, ncomp = a, data = list(y = y[train], X = X[train, ]))
drop(predict(m, newdata = list(X = X[test, , drop = FALSE]), ncomp = a))
}
spread <- X[, "10 years"] - X[, "3 months"] # the classic single predictor
spread_predict <- function(train, test) {
b <- coef(lm(y[train] ~ spread[train])); b[1] + b[2] * spread[test]
}
set.seed(21)
ridge_predict <- function(train, test) {
m <- cv.glmnet(
X[train, ],
y[train],
alpha = 0,
standardize = FALSE,
lambda = 10^seq(3, -4, length.out = 80)
)
drop(predict(m, X[test, , drop = FALSE], s = "lambda.min"))
}
cv <- c(
sapply(0:8, function(a) cv_error(pcr_predict(a))),
cv_error(spread_predict),
cv_error(ridge_predict)
)
names(cv) <- c(paste(0:8, "components"), "spread 10 years - 3 months", "ridge")
cbind(error = round(cv, 3))
best <- which.min(cv[2:9])
```
```{r cv_chart}
cv_data <- data.frame(a = 0:8, rmse = cv[1:9])
ggplot(cv_data, aes(a, rmse)) +
geom_line(colour = "#2a78d6", linewidth = 0.9) +
geom_point(colour = "#2a78d6", size = 2.5) +
geom_hline(
yintercept = cv[["spread 10 years - 3 months"]],
linetype = "dashed",
colour = "#eb6834"
) +
scale_x_continuous(breaks = 0:8) +
labs(
title = "Error of the forecast in left-out blocks of years",
subtitle = "Dashed: a regression on the difference of the 10-year and the 3-month rate",
x = "number of components",
y = "root mean squared error (points of growth)"
) +
theme_bw()
```
- **No component** (always predict the mean): `r f2(cv[1])` points. **One** (the level) is worse: `r f2(cv[2])`. With **`r best`** the error is smallest, `r f2(cv[best + 1])`. With all 8, which is least squares, `r f2(cv[9])`.
- The **spread** between the 10-year and the 3-month rate, the one-number version of the slope, has `r f2(cv[["spread 10 years - 3 months"]])`. **Ridge** regression, which shrinks all the directions instead of cutting some off, has `r f2(cv[["ridge"]])`.
- Nothing is impressive: the best model improves on the plain mean by `r pct(1 - cv[best + 1] / cv[1], 0)`. The economy is hard to predict.
### The same with `pcr()`
```{r pcr_package}
market <- data.frame(y = y)
market$X <- X # a matrix as one column of the data frame
fit <- pcr(y ~ X, ncomp = 8, data = market)
summary(fit)
beta_pcr <- drop(coef(fit, ncomp = best))
beta_hand <- drop(V[, 1:best] %*% gamma[-1][1:best])
max(abs(beta_pcr - beta_hand))
```
`summary()` prints the cumulative share of the variance of $X$ and of $y$ explained by 1, 2, ... components. The last line says `r f1(100 * R2(fit, estimate = "train", intercept = FALSE)$val[1, 1, 3])`% of the variance of growth for three components. `pcr()` can do the cross-validation, too (`validation = "CV"`), but with random segments unless you pass your own in `segments`.
### Back to the interest rates
```{r coefficients_chart}
coef_data <- data.frame(
years = rep(years, 2),
beta = c(coef(ols)[-1], beta_pcr),
method = rep(c("Least squares (8 components)", paste0("PCR (", best, " components)")), each = 8)
)
ggplot(coef_data, aes(years, beta, colour = method)) +
geom_hline(yintercept = 0, colour = "grey60") +
geom_line(linewidth = 0.9) +
geom_point(size = 2.2) +
scale_colour_manual(values = c("#eb6834", "#2a78d6"), name = NULL) +
labs(
title = "Coefficients of the eight rates",
x = "maturity (years)",
y = "points of growth per point of the rate"
) +
theme_bw() +
theme(legend.position = "bottom")
```
The coefficients of PCR are small and follow a smooth pattern; those of least squares jump up and down. Both predict. Only one can be read: what matters is the shape of the curve, the long end against the short end and the middle.
---
## 6. What do the numbers mean?
The slope component is nearly the classic spread: their correlation is
```{r slope_spread}
cor(Tscores[, "PC2"], spread)
sd_slope <- sd(Tscores[, "PC2"])
c(sd_of_slope_score = sd_slope, effect_of_one_sd = unname(gamma["slope"]) * sd_slope)
```
A quarter whose slope score is one standard deviation above average was followed by growth that was `r f2(gamma["slope"] * sd_slope)` points higher, 95% CI [`r f2(ci["slope", 1] * sd_slope)`, `r f2(ci["slope", 2] * sd_slope)`].
```{r scores_chart}
ggplot(
data.frame(
slope = Tscores[, "PC2"],
y,
decade = factor(paste0(10 * (as.numeric(substr(quarters, 1, 4)) %/% 10), "s"))
),
aes(slope, y)
) +
geom_vline(xintercept = 0, colour = "grey70") +
geom_point(aes(colour = decade), size = 1.8, alpha = 0.8) +
geom_smooth(method = "lm", formula = y ~ x, se = FALSE, colour = "grey20", linewidth = 0.8) +
scale_colour_viridis_d(option = "C", end = 0.9, name = NULL) +
labs(
title = "The slope of the yield curve and growth in the following year",
x = "score of PC2 (left: flat or inverted curve; right: steep)",
y = "growth (%)"
) +
theme_bw() +
theme(legend.position = "bottom")
```
Is the relation stable?
```{r stability}
periods <- list(`1976-2018` = rep(TRUE, n), `1976-1984` = time < 1985, `1985-2018` = time >= 1985)
stable <- t(sapply(periods, function(p) {
m <- lm(y[p] ~ Tscores[p, 1:3])
c(quarters = sum(p), slope = coef(m)[[3]], R2 = summary(m)$r.squared)
}))
round(stable, 2)
```
It is not. The slope mattered much more until 1984 than after. A model that was chosen on the whole period knows how the story ended. A real forecaster did not.
---
## 7. Things to keep in mind
- **Choose the components by how they predict, not by their variance.** Cross-validate, look at the correlation of **every** component with the outcome, and do not trust the rule of 80% or 95% of the variance.
- **Nor choose them one by one by their *p* values.** With many components, picking the significant ones is [stepwise regression](EXAMPLE_STEPWISE_REGRESSION.Rmd) with all its problems. Taking the first $a$ in their order is a safer restriction.
- **Standardize** unless all the predictors are in the same unit and their differences in variance mean something.
- **The components belong to the sample.** In cross-validation they must be computed from the training rows only, as `pcr()` does, and for new data the **old** means and loadings are used.
- **PCR does not select predictors.** Every component contains all of them. To leave some out, use the lasso.
- **Ridge regression** is the smooth version of the same idea: it shrinks a direction more the smaller its variance (see [regularized regression](EXAMPLE_REGULARIZED_REGRESSION.Rmd)). PCR keeps it or drops it.
- **Partial least squares** chooses its components by looking at the outcome, which repairs the weak point shown here.
- **Factor analysis is not PCR.** A component is a weighted sum of the observed variables. A factor is a hidden cause of them, with its own model of measurement error.
- **Overlapping outcomes** make a short sample look long. The `r n` quarters here are about `r round(n / 4)` independent years, with `r sum(y < 0)` quarters of falling GDP ahead, in a handful of recessions.
---
## 8. Reporting the results in APA style
A report (APA 7th edition) needs the predictors and their scaling, how the number of components was chosen, the share of variance of each component, what the components mean, and the regression on them. The numbers come from the R objects:
```{r apa_numbers}
apa_table <- data.frame(
Component = c("Intercept", "PC1: level", "PC2: slope", "PC3: curvature"),
var = c("—", pct(share[1:3], 2)),
r = c("—", nz(r_components[1:3])),
b = f3(gamma), SE = f3(hac[, 2]),
CI = paste0("[", f2(ci[, 1]), ", ", f2(ci[, 2]), "]"),
p = sapply(hac[, 4], function(p) sub("^= ", "", pval(p))))
```
**Method** (data analysis):
> We predicted the growth of US real GDP over the following four quarters from the interest rates of eight maturities (3 months to 10 years; quarterly means, `r quarters[1]`–`r tail(quarters, 1)`, *N* = `r n`). Because the rates were highly correlated (*r* = `r nz(min(R[lower.tri(R)]))` to `r nz(max(R[lower.tri(R)]), 3)`; largest variance inflation factor = `r formatC(max(vif), format = "f", digits = 0, big.mark = ",")`), we used principal components regression on the centered, unstandardized rates. The number of components was chosen by cross-validation with ten blocks of consecutive quarters, leaving out four quarters on each side of the block. Standard errors are Newey–West with six lags, because the outcomes of neighboring quarters overlap. Analyses were conducted in R (Version `r paste(R.version$major, R.version$minor, sep = ".")`; R Core Team, `r R.version$year`) with the package pls (Mevik & Wehrens, 2007).
**Results:**
> The first three components explained `r pct(sum(share[1:3]), 2)` of the variance of the rates and corresponded to the level, the slope and the curvature of the yield curve (Table 1). Cross-validation favored `r best` components (RMSE = `r f2(cv[best + 1])` percentage points, against `r f2(cv[1])` for the mean and `r f2(cv[9])` for least squares with all the rates). The level was not related to growth, *b* = `r f3(gamma["level"])`, *p* `r pval(hac["level", 4])`. Growth was higher after a steep curve, *b* = `r f2(gamma["slope"])`, 95% CI [`r f2(ci["slope", 1])`, `r f2(ci["slope", 2])`], *p* `r pval(hac["slope", 4])`, and lower after a curve that was high at both ends, *b* = `r f2(gamma["curvature"])`, 95% CI [`r f2(ci["curvature", 1])`, `r f2(ci["curvature", 2])`], *p* `r pval(hac["curvature", 4])`; *R*² = `r nz(summary(pcr_by_hand)$r.squared)`. The coefficient of the slope was `r f2(stable["1976-1984", "slope"])` until 1984 and `r f2(stable["1985-2018", "slope"])` afterwards.
**Table 1**
*Principal Components Regression of GDP Growth on the Yield Curve*
```{r apa_table, echo=FALSE}
knitr::kable(apa_table, col.names = c("Component", "Variance of the rates", "*r* with growth", "*b*", "*SE*", "95% CI", "*p*"),
align = "lrrrrrr", format = "pipe", row.names = FALSE)
```
*Note.* *N* = `r n` quarters. *b*: percentage points of growth per unit of the component score. Newey–West standard errors (6 lags).
**Points to remember:**
- Say whether the predictors were standardized.
- Report the variance share **and** the relation to the outcome of each component.
- Name the components only after showing their loadings.
- Validate with a scheme that fits the data: blocks for time series, groups for clustered data.
---
## 9. Summary
| | |
|---|---|
| **When** | Many, highly correlated predictors, and the aim is prediction or a few interpretable summaries |
| **Step 1** | Principal components of $X$: uncorrelated weighted sums, ordered by variance |
| **Step 2** | Regress $y$ on the first $a$ scores |
| **Back** | $\hat\beta = V_a \hat\gamma$: coefficients for the original predictors |
| **How (R)** | `pls::pcr(y ~ X, ncomp = , scale = , validation = "CV")`, or `prcomp()` and `lm()` |
| **Choose $a$** | Cross-validation, with the components computed inside |
| **Weak point** | The components ignore $y$; small-variance components can matter most |
| **Relatives** | Ridge (shrinks instead of cutting), [partial least squares](EXAMPLE_PARTIAL_LEAST_SQUARES.Rmd) (looks at $y$) |
| **Related pages** | [Regularized regression](EXAMPLE_REGULARIZED_REGRESSION.Rmd), [stepwise regression](EXAMPLE_STEPWISE_REGRESSION.Rmd), [generalized least squares](EXAMPLE_GENERALIZED_LEAST_SQUARES.Rmd) |
---
## References
Board of Governors of the Federal Reserve System (US). (n.d.). *Market yield on U.S. Treasury securities at constant maturity* [Data set]. FRED, Federal Reserve Bank of St. Louis. https://fred.stlouisfed.org/series/GS10
Estrella, A., & Hardouvelis, G. A. (1991). The term structure as a predictor of real economic activity. *The Journal of Finance*, *46*(2), 555–576. https://doi.org/10.1111/j.1540-6261.1991.tb02674.x
Jolliffe, I. T. (1982). A note on the use of principal components in regression. *Journal of the Royal Statistical Society: Series C*, *31*(3), 300–303. https://doi.org/10.2307/2348005
Litterman, R. B., & Scheinkman, J. (1991). Common factors affecting bond returns. *The Journal of Fixed Income*, *1*(1), 54–61. https://doi.org/10.3905/jfi.1991.692347
Mevik, B.-H., & Wehrens, R. (2007). The pls package: Principal component and partial least squares regression in R. *Journal of Statistical Software*, *18*(2), 1–23. https://doi.org/10.18637/jss.v018.i02
U.S. Bureau of Economic Analysis. (n.d.). *Real gross domestic product* [GDPC1] [Data set]. FRED, Federal Reserve Bank of St. Louis. https://fred.stlouisfed.org/series/GDPC1