R Under development (unstable) (2024-04-23 r86473 ucrt) -- "Unsuffered Consequences" Copyright (C) 2024 The R Foundation for Statistical Computing Platform: x86_64-w64-mingw32/x64 R is free software and comes with ABSOLUTELY NO WARRANTY. You are welcome to redistribute it under certain conditions. Type 'license()' or 'licence()' for distribution details. R is a collaborative project with many contributors. Type 'contributors()' for more information and 'citation()' on how to cite R or R packages in publications. Type 'demo()' for some demos, 'help()' for on-line help, or 'help.start()' for an HTML browser interface to help. Type 'q()' to quit R. > library(epigrowthfit) > options(warn = 2L, error = if (interactive()) recover) > > > ## exponential ######################################################### > > r <- log(2) / 20 > c0 <- 100 > > zz <- simulate(egf_model(curve = "exponential", family = "pois"), + nsim = 1L, + seed = 412575L, + mu = log(c(r, c0)), + cstart = 10) > mm <- egf(zz) > > stopifnot(all.equal(coef(zz), coef(mm), tolerance = 5e-02)) > > > ## subexponential ###################################################### > > alpha <- log(2) / 20 > c0 <- 100 > p <- 0.95 > > zz <- simulate(egf_model(curve = "subexponential", family = "pois"), + nsim = 1L, + seed = 696182L, + mu = c(log(alpha), log(c0), qlogis(p)), + cstart = 10) > mm <- egf(zz, + formula_priors = list(logit(p) ~ Normal(mu = qlogis(p), sigma = 0.5))) > > stopifnot(all.equal(coef(zz), coef(mm), tolerance = 5e-02)) > > > ## gompertz ############################################################ > > alpha <- log(2) / 20 > tinfl <- 100 > K <- 25000 > > zz <- simulate(egf_model(curve = "gompertz", family = "pois"), + nsim = 1L, + seed = 720748L, + mu = log(c(alpha, tinfl, K)), + cstart = 10) > mm <- egf(zz) > > stopifnot(all.equal(coef(zz), coef(mm), tolerance = 5e-02)) > > > ## logistic ############################################################ > > r <- log(2) / 20 > tinfl <- 100 > K <- 25000 > > zz <- simulate(egf_model(curve = "logistic", family = "pois"), + nsim = 1L, + seed = 366465L, + mu = log(c(r, tinfl, K)), + cstart = 10) > mm <- egf(zz) > > stopifnot(all.equal(coef(zz), coef(mm), tolerance = 5e-02)) > > > ## richards ############################################################ > > r <- log(2) / 20 > tinfl <- 100 > K <- 25000 > a <- 1.005 > > zz <- simulate(egf_model(curve = "richards", family = "pois"), + nsim = 1L, + seed = 51520L, + mu = log(c(r, tinfl, K, a)), + cstart = 10) > mm <- egf(zz, + formula_priors = list(log(a) ~ Normal(mu = log(a), sigma = 0.05))) > > stopifnot(all.equal(coef(zz), coef(mm), tolerance = 5e-02)) > > proc.time() user system elapsed 1.71 0.25 1.95