diff options
Diffstat (limited to 'vignettes')
-rw-r--r-- | vignettes/web_only/FOCUS_Z.R | 115 | ||||
-rw-r--r-- | vignettes/web_only/compiled_models.R | 61 |
2 files changed, 0 insertions, 176 deletions
diff --git a/vignettes/web_only/FOCUS_Z.R b/vignettes/web_only/FOCUS_Z.R deleted file mode 100644 index 0c19794e..00000000 --- a/vignettes/web_only/FOCUS_Z.R +++ /dev/null @@ -1,115 +0,0 @@ -## ---- include = FALSE--------------------------------------------------------- -require(knitr) -options(digits = 5) -opts_chunk$set(engine='R', tidy = FALSE) - -## ---- echo = TRUE, fig = TRUE, fig.width = 8, fig.height = 7------------------ -library(mkin, quietly = TRUE) -LOD = 0.5 -FOCUS_2006_Z = data.frame( - t = c(0, 0.04, 0.125, 0.29, 0.54, 1, 2, 3, 4, 7, 10, 14, 21, - 42, 61, 96, 124), - Z0 = c(100, 81.7, 70.4, 51.1, 41.2, 6.6, 4.6, 3.9, 4.6, 4.3, 6.8, - 2.9, 3.5, 5.3, 4.4, 1.2, 0.7), - Z1 = c(0, 18.3, 29.6, 46.3, 55.1, 65.7, 39.1, 36, 15.3, 5.6, 1.1, - 1.6, 0.6, 0.5 * LOD, NA, NA, NA), - Z2 = c(0, NA, 0.5 * LOD, 2.6, 3.8, 15.3, 37.2, 31.7, 35.6, 14.5, - 0.8, 2.1, 1.9, 0.5 * LOD, NA, NA, NA), - Z3 = c(0, NA, NA, NA, NA, 0.5 * LOD, 9.2, 13.1, 22.3, 28.4, 32.5, - 25.2, 17.2, 4.8, 4.5, 2.8, 4.4)) - -FOCUS_2006_Z_mkin <- mkin_wide_to_long(FOCUS_2006_Z) - -## ----FOCUS_2006_Z_fits_1, echo=TRUE, fig.height=6----------------------------- -Z.2a <- mkinmod(Z0 = mkinsub("SFO", "Z1"), - Z1 = mkinsub("SFO")) -m.Z.2a <- mkinfit(Z.2a, FOCUS_2006_Z_mkin, quiet = TRUE) -plot_sep(m.Z.2a) -summary(m.Z.2a, data = FALSE)$bpar - -## ----FOCUS_2006_Z_fits_2, echo=TRUE, fig.height=6----------------------------- -Z.2a.ff <- mkinmod(Z0 = mkinsub("SFO", "Z1"), - Z1 = mkinsub("SFO"), - use_of_ff = "max") - -m.Z.2a.ff <- mkinfit(Z.2a.ff, FOCUS_2006_Z_mkin, quiet = TRUE) -plot_sep(m.Z.2a.ff) -summary(m.Z.2a.ff, data = FALSE)$bpar - -## ----FOCUS_2006_Z_fits_3, echo=TRUE, fig.height=6----------------------------- -Z.3 <- mkinmod(Z0 = mkinsub("SFO", "Z1", sink = FALSE), - Z1 = mkinsub("SFO"), use_of_ff = "max") -m.Z.3 <- mkinfit(Z.3, FOCUS_2006_Z_mkin, quiet = TRUE) -plot_sep(m.Z.3) -summary(m.Z.3, data = FALSE)$bpar - -## ----FOCUS_2006_Z_fits_5, echo=TRUE, fig.height=7----------------------------- -Z.5 <- mkinmod(Z0 = mkinsub("SFO", "Z1", sink = FALSE), - Z1 = mkinsub("SFO", "Z2", sink = FALSE), - Z2 = mkinsub("SFO"), use_of_ff = "max") -m.Z.5 <- mkinfit(Z.5, FOCUS_2006_Z_mkin, quiet = TRUE) -plot_sep(m.Z.5) - -## ----FOCUS_2006_Z_fits_6, echo=TRUE, fig.height=8----------------------------- -Z.FOCUS <- mkinmod(Z0 = mkinsub("SFO", "Z1", sink = FALSE), - Z1 = mkinsub("SFO", "Z2", sink = FALSE), - Z2 = mkinsub("SFO", "Z3"), - Z3 = mkinsub("SFO"), - use_of_ff = "max") -m.Z.FOCUS <- mkinfit(Z.FOCUS, FOCUS_2006_Z_mkin, - parms.ini = m.Z.5$bparms.ode, - quiet = TRUE) -plot_sep(m.Z.FOCUS) -summary(m.Z.FOCUS, data = FALSE)$bpar -endpoints(m.Z.FOCUS) - -## ----FOCUS_2006_Z_fits_7, echo=TRUE, fig.height=8----------------------------- -Z.mkin.1 <- mkinmod(Z0 = mkinsub("SFO", "Z1", sink = FALSE), - Z1 = mkinsub("SFO", "Z2", sink = FALSE), - Z2 = mkinsub("SFO", "Z3"), - Z3 = mkinsub("SFORB")) -m.Z.mkin.1 <- mkinfit(Z.mkin.1, FOCUS_2006_Z_mkin, quiet = TRUE) -plot_sep(m.Z.mkin.1) -summary(m.Z.mkin.1, data = FALSE)$cov.unscaled - -## ----FOCUS_2006_Z_fits_9, echo=TRUE, fig.height=8----------------------------- -Z.mkin.3 <- mkinmod(Z0 = mkinsub("SFORB", "Z1", sink = FALSE), - Z1 = mkinsub("SFO", "Z2", sink = FALSE), - Z2 = mkinsub("SFO")) -m.Z.mkin.3 <- mkinfit(Z.mkin.3, FOCUS_2006_Z_mkin, quiet = TRUE) -plot_sep(m.Z.mkin.3) - -## ----FOCUS_2006_Z_fits_10, echo=TRUE, fig.height=8---------------------------- -Z.mkin.4 <- mkinmod(Z0 = mkinsub("SFORB", "Z1", sink = FALSE), - Z1 = mkinsub("SFO", "Z2", sink = FALSE), - Z2 = mkinsub("SFO", "Z3"), - Z3 = mkinsub("SFO")) -m.Z.mkin.4 <- mkinfit(Z.mkin.4, FOCUS_2006_Z_mkin, - parms.ini = m.Z.mkin.3$bparms.ode, - quiet = TRUE) -plot_sep(m.Z.mkin.4) - -## ----FOCUS_2006_Z_fits_11, echo=TRUE, fig.height=8---------------------------- -Z.mkin.5 <- mkinmod(Z0 = mkinsub("SFORB", "Z1", sink = FALSE), - Z1 = mkinsub("SFO", "Z2", sink = FALSE), - Z2 = mkinsub("SFO", "Z3"), - Z3 = mkinsub("SFORB")) -m.Z.mkin.5 <- mkinfit(Z.mkin.5, FOCUS_2006_Z_mkin, - parms.ini = m.Z.mkin.4$bparms.ode[1:4], - quiet = TRUE) -plot_sep(m.Z.mkin.5) - -## ----FOCUS_2006_Z_fits_11a, echo=TRUE----------------------------------------- -m.Z.mkin.5a <- mkinfit(Z.mkin.5, FOCUS_2006_Z_mkin, - parms.ini = c(m.Z.mkin.5$bparms.ode[1:7], - k_Z3_bound_free = 0), - fixed_parms = "k_Z3_bound_free", - quiet = TRUE) -plot_sep(m.Z.mkin.5a) - -## ----FOCUS_2006_Z_fits_11b, echo=TRUE----------------------------------------- -mkinparplot(m.Z.mkin.5a) - -## ----FOCUS_2006_Z_fits_11b_endpoints, echo=TRUE------------------------------- -endpoints(m.Z.mkin.5a) - diff --git a/vignettes/web_only/compiled_models.R b/vignettes/web_only/compiled_models.R deleted file mode 100644 index 691037ec..00000000 --- a/vignettes/web_only/compiled_models.R +++ /dev/null @@ -1,61 +0,0 @@ -## ---- include = FALSE--------------------------------------------------------- -library(knitr) -opts_chunk$set(tidy = FALSE, cache = FALSE) - -## ----check_gcc, eval = FALSE-------------------------------------------------- -# pkgbuild::has_compiler() - -## ----Rprofile, eval = FALSE--------------------------------------------------- -# Sys.setenv(PATH = paste("C:/Rtools/bin", Sys.getenv("PATH"), sep=";")) - -## ----HOME, eval = FALSE------------------------------------------------------- -# Sys.getenv("HOME") - -## ----create_SFO_SFO----------------------------------------------------------- -library("mkin", quietly = TRUE) -SFO_SFO <- mkinmod( - parent = mkinsub("SFO", "m1"), - m1 = mkinsub("SFO")) - -## ----benchmark_SFO_SFO, fig.height = 3, message = FALSE, warning = FALSE------ -if (require(rbenchmark)) { - b.1 <- benchmark( - "deSolve, not compiled" = mkinfit(SFO_SFO, FOCUS_2006_D, - solution_type = "deSolve", - use_compiled = FALSE, quiet = TRUE), - "Eigenvalue based" = mkinfit(SFO_SFO, FOCUS_2006_D, - solution_type = "eigen", quiet = TRUE), - "deSolve, compiled" = mkinfit(SFO_SFO, FOCUS_2006_D, - solution_type = "deSolve", quiet = TRUE), - replications = 3) - print(b.1) - factor_SFO_SFO <- round(b.1["1", "relative"]) -} else { - factor_SFO_SFO <- NA - print("R package rbenchmark is not available") -} - -## ----benchmark_FOMC_SFO, fig.height = 3, warning = FALSE---------------------- -if (require(rbenchmark)) { - FOMC_SFO <- mkinmod( - parent = mkinsub("FOMC", "m1"), - m1 = mkinsub( "SFO")) - - b.2 <- benchmark( - "deSolve, not compiled" = mkinfit(FOMC_SFO, FOCUS_2006_D, - use_compiled = FALSE, quiet = TRUE), - "deSolve, compiled" = mkinfit(FOMC_SFO, FOCUS_2006_D, quiet = TRUE), - replications = 3) - print(b.2) - factor_FOMC_SFO <- round(b.2["1", "relative"]) -} else { - factor_FOMC_SFO <- NA - print("R package benchmark is not available") -} - -## ----sessionInfo, echo = FALSE------------------------------------------------ -cat(utils::capture.output(utils::sessionInfo())[1:3], sep = "\n") -if(!inherits(try(cpuinfo <- readLines("/proc/cpuinfo")), "try-error")) { - cat(gsub("model name\t: ", "CPU model: ", cpuinfo[grep("model name", cpuinfo)[1]])) -} - |