From 4944ac895eb9caac1af783f80d980bf575bf69d3 Mon Sep 17 00:00:00 2001 From: Sam Date: Fri, 4 Oct 2024 18:46:37 +0100 Subject: [PATCH 1/2] add explicit dist and primary arg usage to getting started --- NEWS.md | 1 + vignettes/primarycensoreddist.Rmd | 28 ++++++++++++++++------------ 2 files changed, 17 insertions(+), 12 deletions(-) diff --git a/NEWS.md b/NEWS.md index d1bbfbb..0c93319 100644 --- a/NEWS.md +++ b/NEWS.md @@ -13,6 +13,7 @@ This is the development version of `primarycensoreddist` and is not yet ready fo * Simplified the "Analytic solutions" vignette by removing verbose derivation details. * Added links between vignettes to make it easier to navigate the documentation. +* Added explicit usage of `pdist`, `dprimary`, `rdist`, and `rprimary` arguments in the getting started vignette to make it easier to link to mathematical details. # primarycensoreddist 0.5.0 diff --git a/vignettes/primarycensoreddist.Rmd b/vignettes/primarycensoreddist.Rmd index bced166..3b599fa 100644 --- a/vignettes/primarycensoreddist.Rmd +++ b/vignettes/primarycensoreddist.Rmd @@ -82,15 +82,17 @@ pwindow <- 1 # Random samples without secondary censoring samples <- rprimarycensoreddist( - n, rlnorm, - meanlog = meanlog, sdlog = sdlog, - pwindow = pwindow, swindow = 0, D = obs_time + n, + rdist = rlnorm, rprimary = stats::runif, + pwindow = pwindow, swindow = 0, D = obs_time, + meanlog = meanlog, sdlog = sdlog ) # Random samples with secondary censoring samples_sc <- rprimarycensoreddist( - n, rlnorm, - meanlog = meanlog, sdlog = sdlog, - pwindow = pwindow, swindow = 1, D = obs_time + n, + rdist = rlnorm, rprimary = stats::runif, + pwindow = pwindow, swindow = 1, D = obs_time, + meanlog = meanlog, sdlog = sdlog ) # Calculate the PMF for the samples with secondary censoring samples_sc_pmf <- data.frame( @@ -172,9 +174,10 @@ Let's compare the empirical CDF of our samples without secondary censoring to th empirical_cdf <- ecdf(samples) theoretical_cdf <- pprimarycensoreddist( seq(0, obs_time, length.out = 100), - plnorm, - meanlog = meanlog, sdlog = sdlog, - pwindow = pwindow, D = obs_time + pdist = plnorm, + dprimary = stats::dunif, + pwindow = pwindow, D = obs_time, + meanlog = meanlog, sdlog = sdlog ) # Create a data frame for plotting @@ -226,9 +229,10 @@ Let's compare the empirical PMF of our samples with secondary censoring to the t # Calculate the theoretical PMF using dprimarycensoreddist theoretical_pmf <- dprimarycensoreddist( 0:(obs_time - 1), - plnorm, - meanlog = meanlog, sdlog = sdlog, - pwindow = pwindow, swindow = 1, D = obs_time + pdist = plnorm, + dprimary = stats::dunif, + pwindow = pwindow, swindow = 1, D = obs_time, + meanlog = meanlog, sdlog = sdlog ) pmf_df <- data.frame( From 1f0413cda0169475b5ad8147b18a1f69b6b554db Mon Sep 17 00:00:00 2001 From: Sam Abbott Date: Fri, 4 Oct 2024 18:52:40 +0100 Subject: [PATCH 2/2] Update primarycensoreddist.Rmd --- vignettes/primarycensoreddist.Rmd | 10 ++++------ 1 file changed, 4 insertions(+), 6 deletions(-) diff --git a/vignettes/primarycensoreddist.Rmd b/vignettes/primarycensoreddist.Rmd index 3b599fa..a2ca97a 100644 --- a/vignettes/primarycensoreddist.Rmd +++ b/vignettes/primarycensoreddist.Rmd @@ -83,14 +83,14 @@ pwindow <- 1 # Random samples without secondary censoring samples <- rprimarycensoreddist( n, - rdist = rlnorm, rprimary = stats::runif, + rdist = rlnorm, rprimary = runif, pwindow = pwindow, swindow = 0, D = obs_time, meanlog = meanlog, sdlog = sdlog ) # Random samples with secondary censoring samples_sc <- rprimarycensoreddist( n, - rdist = rlnorm, rprimary = stats::runif, + rdist = rlnorm, rprimary = runif, pwindow = pwindow, swindow = 1, D = obs_time, meanlog = meanlog, sdlog = sdlog ) @@ -174,8 +174,7 @@ Let's compare the empirical CDF of our samples without secondary censoring to th empirical_cdf <- ecdf(samples) theoretical_cdf <- pprimarycensoreddist( seq(0, obs_time, length.out = 100), - pdist = plnorm, - dprimary = stats::dunif, + pdist = plnorm, dprimary = dunif, pwindow = pwindow, D = obs_time, meanlog = meanlog, sdlog = sdlog ) @@ -229,8 +228,7 @@ Let's compare the empirical PMF of our samples with secondary censoring to the t # Calculate the theoretical PMF using dprimarycensoreddist theoretical_pmf <- dprimarycensoreddist( 0:(obs_time - 1), - pdist = plnorm, - dprimary = stats::dunif, + pdist = plnorm, dprimary = dunif, pwindow = pwindow, swindow = 1, D = obs_time, meanlog = meanlog, sdlog = sdlog )