Skip to content

Commit

Permalink
typo
Browse files Browse the repository at this point in the history
  • Loading branch information
philippberens committed Oct 12, 2016
1 parent bc925d0 commit 164ab8f
Show file tree
Hide file tree
Showing 4 changed files with 19 additions and 17 deletions.
36 changes: 19 additions & 17 deletions analysis.md
Original file line number Diff line number Diff line change
Expand Up @@ -215,7 +215,7 @@ bf1 / bf2

## Bayes factor analysis
## --------------
## [1] Year * Group : 1.250783 ±0.6%
## [1] Year * Group : 1.244842 ±0.69%
##
## Against denominator:
## Age ~ Year
Expand Down Expand Up @@ -256,9 +256,9 @@ bmdl <- stan_glm(Age~Year*Group, tbl,
## Chain 1, Iteration: 1600 / 2000 [ 80%] (Sampling)
## Chain 1, Iteration: 1800 / 2000 [ 90%] (Sampling)
## Chain 1, Iteration: 2000 / 2000 [100%] (Sampling)
## Elapsed Time: 0.722 seconds (Warm-up)
## 0.762 seconds (Sampling)
## 1.484 seconds (Total)
## Elapsed Time: 0.723 seconds (Warm-up)
## 0.658 seconds (Sampling)
## 1.381 seconds (Total)
##
##
## SAMPLING FOR MODEL 'continuous' NOW (CHAIN 2).
Expand All @@ -275,9 +275,9 @@ bmdl <- stan_glm(Age~Year*Group, tbl,
## Chain 2, Iteration: 1600 / 2000 [ 80%] (Sampling)
## Chain 2, Iteration: 1800 / 2000 [ 90%] (Sampling)
## Chain 2, Iteration: 2000 / 2000 [100%] (Sampling)
## Elapsed Time: 0.668 seconds (Warm-up)
## 0.623 seconds (Sampling)
## 1.291 seconds (Total)
## Elapsed Time: 0.729 seconds (Warm-up)
## 0.907 seconds (Sampling)
## 1.636 seconds (Total)
##
##
## SAMPLING FOR MODEL 'continuous' NOW (CHAIN 3).
Expand All @@ -294,9 +294,9 @@ bmdl <- stan_glm(Age~Year*Group, tbl,
## Chain 3, Iteration: 1600 / 2000 [ 80%] (Sampling)
## Chain 3, Iteration: 1800 / 2000 [ 90%] (Sampling)
## Chain 3, Iteration: 2000 / 2000 [100%] (Sampling)
## Elapsed Time: 0.75 seconds (Warm-up)
## 0.619 seconds (Sampling)
## 1.369 seconds (Total)
## Elapsed Time: 0.683 seconds (Warm-up)
## 0.648 seconds (Sampling)
## 1.331 seconds (Total)
##
##
## SAMPLING FOR MODEL 'continuous' NOW (CHAIN 4).
Expand All @@ -313,9 +313,9 @@ bmdl <- stan_glm(Age~Year*Group, tbl,
## Chain 4, Iteration: 1600 / 2000 [ 80%] (Sampling)
## Chain 4, Iteration: 1800 / 2000 [ 90%] (Sampling)
## Chain 4, Iteration: 2000 / 2000 [100%] (Sampling)
## Elapsed Time: 0.843 seconds (Warm-up)
## 0.557 seconds (Sampling)
## 1.4 seconds (Total)
## Elapsed Time: 0.799 seconds (Warm-up)
## 1.258 seconds (Sampling)
## 2.057 seconds (Total)

We can summarize the fitted model and plot the posterior density over the parameters:

Expand All @@ -335,9 +335,9 @@ bmdl
##
## Estimates:
## Median MAD_SD
## (Intercept) -91.6 114.6
## (Intercept) -98.0 117.1
## Year 0.1 0.1
## Group>=1995 1.0 8.4
## Group>=1995 0.9 8.5
## Year:Group>=1995 0.0 0.0
## sigma 2.2 0.3
##
Expand All @@ -348,7 +348,7 @@ bmdl
##
## Observations: 33 Number of unconstrained parameters: 5

Comparing the fitted model to the frequentist models above shows that the posterior median of the linear effect of Year (0.103) is similar to the estimated value above (0.153), but shrunken towards zero by the prior. The posterior density on the interaction term is centered around zero during inference, arguing that there is little evidence of a different slope after 1995. There is a small effect of the interaction term on the y-intercept, increasing the estimated y-intercept by 900. This is likely an artefact of the model parametrization.
Comparing the fitted model to the frequentist models above shows that the posterior median of the linear effect of Year (0.106) is similar to the estimated value above (0.153), but shrunken towards zero by the prior. The posterior density on the interaction term is centered around zero during inference, arguing that there is little evidence of a different slope after 1995. There is a small effect of the interaction term on the y-intercept, increasing the estimated y-intercept by 900. This is likely an artefact of the model parametrization.

``` r
draws <- as.data.frame(as.matrix(bmdl))
Expand Down Expand Up @@ -382,6 +382,8 @@ We check certain properties of the Bayesian fitting procedures graphically:
stan_diag(bmdl)
```

## Warning: Removed 1 rows containing missing values (geom_bar).

![](analysis_files/figure-markdown_github/unnamed-chunk-8-1.png)

Extended data figure
Expand Down Expand Up @@ -428,7 +430,7 @@ The fitted model has a slope of 0.121 years for years before 1995 (their slope =

## Bayes factor analysis
## --------------
## [1] Year * Group : 8.843183 ±1.25%
## [1] Year * Group : 8.756212 ±1.03%
##
## Against denominator:
## Age ~ Year
Expand Down
Binary file modified analysis_files/figure-markdown_github/plot_bayes_preds-1.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified analysis_files/figure-markdown_github/unnamed-chunk-7-1.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified analysis_files/figure-markdown_github/unnamed-chunk-8-1.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.

0 comments on commit 164ab8f

Please sign in to comment.