Skip to content

Commit

Permalink
hide output produced during model fitting in vignettes
Browse files Browse the repository at this point in the history
  • Loading branch information
paul-buerkner committed Oct 24, 2018
1 parent 03d00e5 commit de6646b
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions vignettes/brms_multivariate.Rmd
Expand Up @@ -47,7 +47,7 @@ head(BTdata)

We begin with a relatively simple multivariate normal model.

```{r fit1, message=FALSE, warning=FALSE}
```{r fit1, message=FALSE, warning=FALSE, results='hide'}
fit1 <- brm(
cbind(tarsus, back) ~ sex + hatchdate + (1|p|fosternest) + (1|q|dam),
data = BTdata, chains = 2, cores = 2
Expand Down Expand Up @@ -80,7 +80,7 @@ Clearly, there is much variation in both animal characteristics that we can not

Now, suppose we only want to control for `sex` in `tarsus` but not in `back` and vice versa for `hatchdate`. Not that this is particular reasonable for the present example, but it allows us to illustrate how to specify different formulas for different response variables. We can no longer use `cbind` syntax and so we have to use a more verbose approach:

```{r fit2, message=FALSE, warning=FALSE}
```{r fit2, message=FALSE, warning=FALSE, results='hide'}
bf_tarsus <- bf(tarsus ~ sex + (1|p|fosternest) + (1|q|dam))
bf_back <- bf(back ~ hatchdate + (1|p|fosternest) + (1|q|dam))
fit2 <- brm(bf_tarsus + bf_back, data = BTdata, chains = 2, cores = 2)
Expand All @@ -103,7 +103,7 @@ Apparently, there is no noteworthy difference in the model fit. Accordingly, we

To give you a glimpse of the capabilities of **brms**' multivariate syntax, we change our model in various directions at the same time. Remember the slight left skewness of `tarsus`, which we will now model by using the `skew_normal` family instead of the `gaussian` family. Since we do not have a multivariate normal (or student-t) model, anymore, estimating residual correlations is no longer possible. We make this explicit using the `set_rescor` function. Further, we investigate if the relationship of `back` and `hatchdate` is really linear as previously assumed by fitting a non-linear spline of `hatchdate`. On top of it, we model separate residual variances of `tarsus` for males and femals chicks.

```{r fit3, message=FALSE, warning=FALSE}
```{r fit3, message=FALSE, warning=FALSE, results='hide'}
bf_tarsus <- bf(tarsus ~ sex + (1|p|fosternest) + (1|q|dam)) +
lf(sigma ~ 0 + sex) + skew_normal()
bf_back <- bf(back ~ s(hatchdate) + (1|p|fosternest) + (1|q|dam)) +
Expand Down

0 comments on commit de6646b

Please sign in to comment.