Advice provided
Data
I supplemented the UNNEST.csv file as follows to create a complete panel for the 61 months ended 2023-0-01:
A monthly
gdpvariable from U.S. Bureau of Economic Analysis, Gross Domestic Product GDP, retrieved from FRED, Federal Reserve Bank of St. Louis, June 18, 2023 through 2023-01-01 extrapolated to 2023-03-01 using a drift (random walk) model and interpolated to monthly.Replaced the
qivariable withcpi, the 16% Trimmed-Mean Consumer Price Index (CPI), a measure of core inflation calculated by the Federal Reserve Bank of Cleveland. The Trimmed-Mean CPI excludes the CPI components that show the most extreme monthly price changes. This series excludes 8% of the CPI components with the highest and lowest one-month price changes from each tail of the price-change distribution resulting in a 16% Trimmed-Mean Inflation Estimate. Federal Reserve Bank of Cleveland, 16% Trimmed-Mean Consumer Price Index TRMMEANCPIM158SFRBCLE, retrieved from FRED, Federal Reserve Bank of St. Louis, June 16, 2023.
The combined data frame was converted to a tsibble, a time series adapted data frame.
#| echo: false
source(here::here("R/libr.R"))
source(here("R/data.R"))
source(here("R/prep.R"))
d |>
gt() |>
fmt_number(columns = c(gdp), decimals = 0) |>
fmt_number(columns = c(dj_delta,emv,qi,cpi), decimals = 2) |>
fmt_number(columns = c(unrate,dff), decimals = 1)Initial visualization
autoplot(d,unrate) +
autoplot(d,dff) /
autoplot(d,dj_delta) +
autoplot(d,gdp)/
autoplot(d,emv) +
autoplot(d,cpi)The plots of dj_delta and emv appear stationary and this is confirmed by testing.
d |> features(dj_delta, ljung_box, lag = 10)
d |> features(emv, ljung_box, lag = 10)I recommend discarding these features, because they will do nothing except introduce noise. This is consistent with your result in Table 1. I would omit Table 2.
cpi dff
The regression of cpi on dff failx to satisfy the assumptions for use of lm() on heteroscedascticity grounds.
fit <- lm(cpi ~ dff,d)
summary(fit)
plot(fit, which = 3)COVID variable
Taking 2023-03-01 as first month during which the COVID pandemic began to have an impact, I introduce a new variable, covid factor with levels before switch and after. The second level is to allow covid to be used in lm() as an interaction term.
bc <- which(d$dte < ymd("2020-04-01"))
af <- which(d$dte > ymd("2020-03-01"))
d$covid <- "nil"
d[bc,"covid"] <- "before"
d[af,"covid"] <- "after"
d[23,"covid"] <- "switch"
d$covid <- as.factor(d$covid)
table(d$covid)cpi dff + covid
Linear regression of cpi on dff + covid similarly fails on heteroscedascticity grounds.
fit <- lm(cpi ~ dff + covid,d)
summary(fit)
plot(fit, which = 3)Saturated model without the white noise index variables
fit <- lm(unrate ~ dff + gdp + cpi + covid,d)
summary(fit)
par(mfrow = c(2,2))
plot(fit)
gvlma(fit)The global statistic and link function evaluations of the lm() assumptions fail. See Peña EA, Slate EH. Global Validation of Linear Model Assumptions. J Am Stat Assoc. 2006 Mar 1;101(473):341. doi: 10.1198/016214505000000637. PMID: 20157621; PMCID: PMC2820257.
fit <- gvlma(unrate ~ dff + gdp + cpi + covid,d)
plot(fit, onepage = FALSE)