Skip to content

Commit

Permalink
Fix lint issues
Browse files Browse the repository at this point in the history
  • Loading branch information
athowes committed May 17, 2024
1 parent 410ed01 commit 730fe60
Showing 1 changed file with 15 additions and 4 deletions.
19 changes: 15 additions & 4 deletions vignettes/epidist.Rmd
Original file line number Diff line number Diff line change
Expand Up @@ -89,9 +89,16 @@ secondary_dist <- data.table(meanlog = 1.8, sdlog = 0.5) |>

```{r lognormal, fig.cap="(ref:lognormal)"}
ggplot(data.frame(x = c(0, 8)), aes(x = x)) +
geom_function(fun = dlnorm, meanlog = secondary_dist[["meanlog"]], sdlog = secondary_dist[["sdlog"]]) +
geom_function(
fun = dlnorm,
meanlog = secondary_dist[["meanlog"]],
sdlog = secondary_dist[["sdlog"]]
) +
theme_minimal() +
labs(x = "Delay between primary and secondary event (days)", y = "Probability density")
labs(
x = "Delay between primary and secondary event (days)",
y = "Probability density"
)
```

```{r}
Expand All @@ -107,7 +114,10 @@ obs <- outbreak |>
```{r delay, fig.cap="(ref:delay)"}
obs[case %% 50 == 0, ] |>
ggplot(aes(y = case)) +
geom_segment(aes(x = ptime, xend = stime, y = case, yend = case), col = "grey") +
geom_segment(
aes(x = ptime, xend = stime, y = case, yend = case),
col = "grey"
) +
geom_point(aes(x = ptime), col = "#56B4E9") +
geom_point(aes(x = stime), col = "#009E73") +
labs(x = "Event time (day)", y = "Case number") +
Expand Down Expand Up @@ -164,7 +174,8 @@ sample_size <- 200
This sample size corresponds to `r 100 * round(sample_size / nrow(obs_cens_trunc), 3)`% of the data.

```{r}
obs_cens_trunc_samp <- obs_cens_trunc[sample(1:.N, sample_size, replace = FALSE)]
obs_cens_trunc_samp <-
obs_cens_trunc[sample(seq_len(.N), sample_size, replace = FALSE)]
```

With our censored, truncated, and sampled data, we are now ready to attempt to recover the underlying delay distribution using `epidist`.
Expand Down

0 comments on commit 730fe60

Please sign in to comment.