Linear inflation model, delta1 = delta2 = 1
\(\mathcal{S}_{\pi}\) = {AWHMAN, S&P div yield, T5YFFM, AAAFFM, DDURRG3M086SBEA, DNDGRG3M086SBEA, DSERRG3M086SBEA}
A reproducible application showing data construction, model selection, threshold sensitivity, and post-selection estimation.
The package data contain transformed monthly U.S. macroeconomic series. After excluding date and the response PCEPI, the website calculations use 101 candidate variables.
McCracken, Michael W., and Serena Ng. 2016. “FRED-MD: A Monthly Database for Macroeconomic Research.” Journal of Business & Economic Statistics 34(4): 574–589. doi:10.1080/07350015.2015.1086655.
Source: Federal Reserve Bank of St. Louis, FRED-MD and FRED-QD. The package example uses the transformed snapshot distributed with the source tree.
library(BoostingMultipleTesting)
data(
"FREDMDPPM_transformed",
package = "BoostingMultipleTesting"
)
fred_data <- as.data.frame(
FREDMDPPM_transformed,
stringsAsFactors = FALSE,
check.names = FALSE
)
| date | PCEPI | RPI | W875RX1 | DPCERA3M086SBEA | CMRMTSPLx |
|---|---|---|---|---|---|
| 2-01-19 | 0.001 | 0.0011 | 0.0009 | 0.0044 | 0.0144 |
| 3-01-19 | 0.0006 | 0.0019 | 0.0009 | 0.0141 | -0.028 |
| 4-01-19 | 0.0036 | 0.0035 | 0.0036 | 0.0153 | 0.0099 |
| 5-01-19 | 0.001 | 0.0024 | 0.0024 | -0.0204 | -0.0315 |
| 6-01-19 | 0.0005 | 0.0008 | -0.0002 | -0.0003 | 0.0086 |
| 7-01-19 | 0.0018 | 0.0018 | 0.0019 | 0.0021 | -0.0069 |
The displayed results are computed when the website is built. Select a shared value for delta1 and delta2 to compare the resulting support while holding the data and all other settings fixed.
Current code value: delta1 = 1; delta2 is omitted and defaults to delta1.
The linear application uses transformed PCEPI as the response. After complete-case filtering and removal of zero-variance columns, the estimation sample contains 785 observations and 101 standardized candidates.
delta1 <- 1
target_name <- "PCEPI"
inflation <- fred_data[[target_name]]
candidate_names <- setdiff(names(fred_data), c("date", target_name))
x_raw <- as.matrix(fred_data[candidate_names])
storage.mode(x_raw) <- "numeric"
keep <- is.finite(inflation) & complete.cases(x_raw)
y_linear <- inflation[keep]
x_linear <- x_raw[keep, , drop = FALSE]
sds <- apply(x_linear, 2, stats::sd)
x_linear <- scale(x_linear[, is.finite(sds) & sds > 0, drop = FALSE])
selected_linear <- boosting_glm(
y = y_linear,
X = x_linear,
link = "linear",
pval = 0.05,
delta1 = delta1,
HAC = FALSE
)
colnames(x_linear)[selected_linear]
\(\mathcal{S}_{\pi}\) = {AWHMAN, S&P div yield, T5YFFM, AAAFFM, DDURRG3M086SBEA, DNDGRG3M086SBEA, DSERRG3M086SBEA}
\(\mathcal{S}_{\pi}\) = {AWHMAN, T5YFFM, AAAFFM, DDURRG3M086SBEA, DNDGRG3M086SBEA, DSERRG3M086SBEA}
\(\mathcal{S}_{\pi}\) = {AWHMAN, T5YFFM, DDURRG3M086SBEA, DNDGRG3M086SBEA, DSERRG3M086SBEA}
HAC = FALSE. Set HAC = TRUE for Newey-West standard errors with automatic bandwidth selection in linear, logit, or probit models.The binary response equals one when trailing smoothed annual inflation exceeds 2.5 percent. The resulting complete-case sample contains 763 observations and 101 standardized candidates.
delta1 <- 1
target_name <- "PCEPI"
inflation <- as.numeric(fred_data[[target_name]])
candidate_names <- setdiff(names(fred_data), c("date", target_name))
x_raw <- as.matrix(fred_data[candidate_names])
storage.mode(x_raw) <- "numeric"
annual_inflation <- 100 * as.numeric(
stats::filter(inflation, rep(1, 12), sides = 1)
)
smoothed_inflation <- as.numeric(
stats::filter(annual_inflation, rep(1 / 12, 12), sides = 1)
)
ppm <- as.integer(smoothed_inflation > 2.5)
keep <- is.finite(ppm) & complete.cases(x_raw)
y_ppm <- ppm[keep]
x_ppm <- x_raw[keep, , drop = FALSE]
sds <- apply(x_ppm, 2, stats::sd)
x_ppm <- scale(x_ppm[, is.finite(sds) & sds > 0, drop = FALSE])
selected_ppm <- boosting_glm(
y = y_ppm,
X = x_ppm,
link = "logit",
pval = 0.05,
delta1 = delta1
)
colnames(x_ppm)[selected_ppm]
\(\mathcal{S}_{PPM}\) = {CES0600000007, AWHMAN, BUSINVx, TB3SMFFM, T1YFFM, EXCAUSx, DSERRG3M086SBEA, DTCOLNVHFNM}
\(\mathcal{S}_{PPM}\) = {AWHMAN, TB3SMFFM, DSERRG3M086SBEA}
\(\mathcal{S}_{PPM}\) = {AWHMAN, DSERRG3M086SBEA}
The logical selection vectors subset the standardized candidate matrices. The final regressions can then be estimated with the selected columns only.
inflation_data <- data.frame(
inflation = y_linear,
x_linear[, selected_linear, drop = FALSE],
check.names = FALSE
)
inflation_model <- stats::lm(inflation ~ ., data = inflation_data)
ppm_data <- data.frame(
ppm = y_ppm,
x_ppm[, selected_ppm, drop = FALSE],
check.names = FALSE
)
ppm_model <- stats::glm(
ppm ~ .,
data = ppm_data,
family = stats::binomial("logit")
)