Skip to content

Commit

Permalink
update README: fix plot clipping, inc. sample size
Browse files Browse the repository at this point in the history
  • Loading branch information
qmarcou committed Jul 3, 2024
1 parent b527a73 commit 8a07cef
Show file tree
Hide file tree
Showing 4 changed files with 11 additions and 11 deletions.
8 changes: 4 additions & 4 deletions README.Rmd
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ using the package. Let's first generate some data:
library(netidmtpreg)
library(tidyverse)
n_ind <- 1e2 # number of simulated individuals
n_ind <- 5e2 # number of simulated individuals
# Generate exponentially distributed event times without censoring
synth_idm_data <- generate_uncensored_ind_exp_idm_data(
Expand Down Expand Up @@ -121,10 +121,10 @@ future::plan("sequential") # close the multisession, see future's documentation
We obtain a `TPreg` object with a dedicated plotting method using ggplot:

```{r plot}
plot(net_estimate) + ggplot2::coord_cartesian(ylim = c(-5, 5))
plot(net_estimate) + ggplot2::coord_cartesian(ylim = c(-5, 5), clip = "off")
```

*Warning: note the use of `ggplot2::coord_cartesian` instead of `ggplot2::ylim`.
*Warning: note the use of `ggplot2::coord_cartesian` with `clip="off"` instead of `ggplot2::ylim`.
The former acts as a "zoom" command, while the latter acts as a filter on input
data, and as such might prevent display of large confidence intervals.*

Expand Down Expand Up @@ -171,7 +171,7 @@ set the linetype accordingly.
autoplot(net_estimate, model = "Net estimate") +
autolayer(crude_estimate, model = "Crude estimate") +
autolayer(truth_estimate, model = "Ground Truth") +
ggplot2::coord_cartesian(ylim = c(-5, 5))
ggplot2::coord_cartesian(ylim = c(-5, 5), xlim = c(0, 2), clip = "off")
```

These automated plotting routines are designed for quick inspection of the model.
Expand Down
14 changes: 7 additions & 7 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ library(tidyverse)
#> ✖ dplyr::lag() masks stats::lag()
#> ℹ Use the conflicted package (<http://conflicted.r-lib.org/>) to force all conflicts to become errors

n_ind <- 1e2 # number of simulated individuals
n_ind <- 5e2 # number of simulated individuals

# Generate exponentially distributed event times without censoring
synth_idm_data <- generate_uncensored_ind_exp_idm_data(
Expand Down Expand Up @@ -127,17 +127,17 @@ We obtain a `TPreg` object with a dedicated plotting method using
ggplot:

``` r
plot(net_estimate) + ggplot2::coord_cartesian(ylim = c(-5, 5))
plot(net_estimate) + ggplot2::coord_cartesian(ylim = c(-5, 5), clip = "off")
#> Warning: Removed 1 row containing missing values or values outside the scale range
#> (`geom_line()`).
```

<img src="man/figures/README-plot-1.png" width="100%" />

*Warning: note the use of `ggplot2::coord_cartesian` instead of
`ggplot2::ylim`. The former acts as a “zoom” command, while the latter
acts as a filter on input data, and as such might prevent display of
large confidence intervals.*
*Warning: note the use of `ggplot2::coord_cartesian` with `clip="off"`
instead of `ggplot2::ylim`. The former acts as a “zoom” command, while
the latter acts as a filter on input data, and as such might prevent
display of large confidence intervals.*

The obtained TPreg plots are composable ggplot objects that can be
combined. Let’s use this to compare our results with: 1) what would have
Expand Down Expand Up @@ -186,7 +186,7 @@ automatically set the linetype accordingly.
autoplot(net_estimate, model = "Net estimate") +
autolayer(crude_estimate, model = "Crude estimate") +
autolayer(truth_estimate, model = "Ground Truth") +
ggplot2::coord_cartesian(ylim = c(-5, 5))
ggplot2::coord_cartesian(ylim = c(-5, 5), xlim = c(0, 2), clip = "off")
#> Warning: Removed 1 row containing missing values or values outside the scale range
#> (`geom_line()`).
#> Removed 1 row containing missing values or values outside the scale range
Expand Down
Binary file modified man/figures/README-plot-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 man/figures/README-plot_compare-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 8a07cef

Please sign in to comment.