Skip to content

Commit 7db4923

Browse files
committed
Merge branch 'main' of github.com:gregorkastner/BayesianLearningCode
2 parents 9e00bc0 + 608ee8d commit 7db4923

1 file changed

Lines changed: 24 additions & 2 deletions

File tree

vignettes/Chapter08.Rmd

Lines changed: 24 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,8 @@ 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)
2525
```
2626

27-
# Section 8.1
27+
# Section 8.1.1: Probit Model
28+
## Example 8.1: Labour Market Data
2829
We illustrate probit regression analysis for the labor market data.
2930

3031
```{r}
@@ -243,7 +244,7 @@ plot(betas[,2], type="l", main = "", xlab = "", ylab = "")
243244
acf(betas[,2])
244245
```
245246

246-
# Section 8.2
247+
# Section 8.1.2
247248
We now estimate a logistic regression model for the labor market data
248249
using the two-block Polya-Gamma sampler.
249250

@@ -331,3 +332,24 @@ that there is not much difference.
331332
```{r}
332333
knitr::kable(round(t(res_beta*pi/sqrt(3)),3))
333334
```
335+
336+
# Section 8.2
337+
## Example 8.3: Road Safety Data
338+
339+
#small model with intercept, intervention effect and holiday dummy (activated in
340+
#July/August)
341+
# large model with intercept, intervention effect, linear trend, seasonal pattern
342+
#with monthly dummies in
343+
# Study how the acceptance rate detoriates, if d increases. ADD
344+
We load the data and extract the observations for the children in
345+
Linz. Then we define the regressor matrix.
346+
347+
```{r}
348+
data("accidents", package = "BayesianLearningCode")
349+
y <- accidents[, "children_accidents"]
350+
N <- length(y)
351+
352+
intervention <- c(rep(0,7*12+9),rep(1,8*12+3))
353+
holiday <- rep(c(rep(0,6), rep(1,2), rep(0,4)),16)
354+
X <- cbind(rep(1,N),intervention, holiday)
355+
```

0 commit comments

Comments
 (0)