Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Issue #337: Use family as string in Ebola vignette #423

Closed
wants to merge 2 commits into from
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 6 additions & 4 deletions vignettes/ebola.Rmd
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,8 @@ knitr::opts_chunk$set(
warning = FALSE,
error = FALSE
)

options(stringsAsFactors = FALSE)
```

In this vignette, we use the `epidist` package to analyze line list data from the 2014-2016 outbreak of Ebola in Sierra Leone [@who_ebola_2014_2016].
Expand Down Expand Up @@ -220,15 +222,15 @@ Now we are ready to fit the latent individual model.

We start by fitting a single lognormal distribution to the data.
This model assumes that a single distribution describes all delays in the data, regardless of the case's location, sex, or any other covariates.
To do this, we set `formula = mu ~ 1` to place an model with only an intercept parameter (i.e. `~ 1` in R formula syntax) on the `mu` parameter of the lognormal distribution specified using `family = lognormal()`.
To do this, we set `formula = mu ~ 1` to place an model with only an intercept parameter (i.e. `~ 1` in R formula syntax) on the `mu` parameter of the lognormal distribution specified using `family = "lognormal"`.
(Note that the lognormal distribution has two distributional parameters `mu` and `sigma`.
As a model is not explicitly placed on `sigma`, a constant model `sigma ~ 1` is assumed.)

```{r}
fit <- epidist(
data = obs_prep,
formula = mu ~ 1,
family = lognormal(),
family = "lognormal",
algorithm = "sampling",
refresh = 0,
silent = 2,
Expand All @@ -252,7 +254,7 @@ To fit a model which varies the parameters of the fitted lognormal distribution,
fit_sex <- epidist(
data = obs_prep,
formula = bf(mu ~ 1 + sex, sigma ~ 1 + sex),
family = lognormal(),
family = "lognormal",
algorithm = "sampling",
refresh = 0,
silent = 2,
Expand Down Expand Up @@ -281,7 +283,7 @@ fit_sex_district <- epidist(
mu ~ 1 + sex + (1 | district),
sigma ~ 1 + sex + (1 | district)
),
family = lognormal(),
family = "lognormal",
algorithm = "sampling",
refresh = 0,
silent = 2,
Expand Down
Loading