Skip to content

Commit 6c7f3ca

Browse files
committed
adds more section and figure titles
1 parent f051bda commit 6c7f3ca

1 file changed

Lines changed: 13 additions & 9 deletions

File tree

vignettes/Chapter07.Rmd

Lines changed: 13 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -24,8 +24,11 @@ pdfplots <- FALSE # default: FALSE; set this to TRUE only if you like pdf figure
2424
par(mgp = c(1.6, .6, 0), mar = c(2.6, 2.6, 2.6, .4), lwd = 1.5)
2525
```
2626

27-
# Section 7.2
28-
## Figure 7.1
27+
# Section 7.2: Bayesian Learning of (Stationary) Autoregressive Models
28+
## Section 7.2.2: Exploring stationarity during post-processing
29+
30+
## Figure 7.1: U.S. GDP data
31+
2932
First, we load the data. Because of the extreme outliers during the COVID
3033
pandemic, we restrict our analysis to the time before its outbreak.
3134

@@ -146,7 +149,7 @@ regression <- function(y, X, prior = "improper", b0 = 0, B0 = 1, c0 = 0.01,
146149

147150
Now we are ready to reproduce the results in the book.
148151

149-
## Example 7.1
152+
## Example 7.1: AR modeling of the U.S. GDP data
150153

151154
We begin by writing a function that sets up the design matrix for an AR($p$)
152155
model.
@@ -177,7 +180,7 @@ for (p in 1:4) {
177180
}
178181
```
179182

180-
## Figure 7.2
183+
## Figure 7.2: Exploratory model selection
181184
Now we plot the draws for the leading coefficient, i.e., the coefficient
182185
corresponding to the highest lag in each of the models.
183186

@@ -218,7 +221,8 @@ res_semi_2 <- regression(y, Xy, prior = "semi-conjugate",
218221
219222
```
220223

221-
## Figure 7.3
224+
## Figure 7.3: AR(3) models with improper, semi-conjugate, and conjugate priors
225+
222226
We now visualize the posterior of the model parameters under all those priors.
223227

224228
```{r, echo = -c(1:3), fig.height = 12}
@@ -266,7 +270,7 @@ for (i in 1:5) {
266270
We reuse the AR($p$) models under the improper prior from above to explore
267271
stationarity for $p = 1, 2, 3$.
268272

269-
## Figure 7.4
273+
## Figure 7.4: Checking stationarity conditions for the GDP data
270274

271275
```{r, echo = -c(1:2), fig.width = 9, fig.height = 3}
272276
if (pdfplots) {
@@ -300,15 +304,15 @@ data("inflation", package = "BayesianLearningCode")
300304

301305
First, we plot the data and its empirical autocorrelation function.
302306

303-
## Figure 7.5
307+
## Figure 7.5: EU inflation data
304308

305309
```{r, echo = -c(1:2)}
306310
if (pdfplots) {
307311
pdf("7-2_5.pdf", width = 12, height = 5)
308312
par(mar = c(2.6, 1.5, 1.5, .1), mgp = c(1.5, .5, 0), lwd = 1.5)
309313
}
310314
par(mfrow = c(1,2))
311-
ts.plot(inflation, main = "EU Inflation")
315+
ts.plot(inflation, main = "EU inflation")
312316
acf(inflation, main = "")
313317
title("Empirical autocorrelation function")
314318
```
@@ -325,7 +329,7 @@ for (p in 1:3) {
325329
}
326330
```
327331

328-
## Figure 7.6
332+
## Figure 7.6: Checking stationarity conditions for the EU inflation data
329333

330334
```{r, echo = -c(1:2), fig.width = 9, fig.height = 3}
331335
if (pdfplots) {

0 commit comments

Comments
 (0)