aboutsummaryrefslogtreecommitdiff
path: root/man
diff options
context:
space:
mode:
authorJohannes Ranke <jranke@uni-bremen.de>2016-11-18 16:28:49 +0100
committerJohannes Ranke <jranke@uni-bremen.de>2016-11-18 16:28:49 +0100
commite7b2d16306b7d03cde66223c9b27abde928f9447 (patch)
tree85d650cfb8e071b00a1228566ec788dc1b477809 /man
parent8bdb67360502bd1a8eb5317d287b094510b4a02c (diff)
Improve examples for showing with pkgdown
- Use quiet= TRUE in dontrun sections - Use mkinsub in model definitions - Avoid \code{\link{}} in titles
Diffstat (limited to 'man')
-rw-r--r--man/Extract.mmkin.Rd13
-rw-r--r--man/endpoints.Rd4
-rw-r--r--man/mccall81_245T.Rd5
-rw-r--r--man/mkinerrmin.Rd9
-rw-r--r--man/mkinfit.Rd28
-rw-r--r--man/mkinparplot.Rd9
-rw-r--r--man/mmkin.Rd11
-rw-r--r--man/plot.mmkin.Rd7
-rw-r--r--man/print.mkinmod.Rd9
-rw-r--r--man/schaefer07_complex_case.Rd8
-rw-r--r--man/summary.mkinfit.Rd2
-rw-r--r--man/synthetic_data_for_UBA.Rd4
-rw-r--r--man/transform_odeparms.Rd6
13 files changed, 72 insertions, 43 deletions
diff --git a/man/Extract.mmkin.Rd b/man/Extract.mmkin.Rd
index 6e0c84e3..e27e83a0 100644
--- a/man/Extract.mmkin.Rd
+++ b/man/Extract.mmkin.Rd
@@ -31,8 +31,15 @@
cores = 1, quiet = TRUE)
fits["FOMC", ]
fits[, "B"]
- fits[, "B", drop = TRUE]$FOMC
fits["SFO", "B"]
- fits[["SFO", "B"]] # This is equivalent to
- fits["SFO", "B", drop = TRUE]
+
+ head(
+ # This extracts an mkinfit object with lots of components
+ fits[["FOMC", "B"]]
+ )
+
+ head(
+ # The same can be achieved by
+ fits["SFO", "B", drop = TRUE]
+ )
}
diff --git a/man/endpoints.Rd b/man/endpoints.Rd
index 08773c3e..55a4cb0a 100644
--- a/man/endpoints.Rd
+++ b/man/endpoints.Rd
@@ -23,6 +23,10 @@ endpoints(fit)
\value{
A list with the components mentioned above.
}
+\examples{
+ fit <- mkinfit("FOMC", FOCUS_2006_C, quiet = TRUE)
+ endpoints(fit)
+}
\author{
Johannes Ranke
}
diff --git a/man/mccall81_245T.Rd b/man/mccall81_245T.Rd
index 7cc5c363..656ca33f 100644
--- a/man/mccall81_245T.Rd
+++ b/man/mccall81_245T.Rd
@@ -32,10 +32,11 @@
phenol = list(type = "SFO", to = "anisole"),
anisole = list(type = "SFO"))
\dontrun{
- fit.1 <- mkinfit(SFO_SFO_SFO, subset(mccall81_245T, soil == "Commerce"))
+ fit.1 <- mkinfit(SFO_SFO_SFO, subset(mccall81_245T, soil == "Commerce"), quiet = TRUE)
summary(fit.1, data = FALSE)
}
- # No covariance matrix and k_phenol_sink is really small, therefore fix it to zero
+ # No convergence, no covariance matrix ...
+ # k_phenol_sink is really small, therefore fix it to zero
fit.2 <- mkinfit(SFO_SFO_SFO, subset(mccall81_245T, soil == "Commerce"),
parms.ini = c(k_phenol_sink = 0),
fixed_parms = "k_phenol_sink", quiet = TRUE)
diff --git a/man/mkinerrmin.Rd b/man/mkinerrmin.Rd
index 12c9ebd4..9229fc7f 100644
--- a/man/mkinerrmin.Rd
+++ b/man/mkinerrmin.Rd
@@ -4,9 +4,8 @@
Calculate the minimum error to assume in order to pass the variance test
}
\description{
-This function uses \code{\link{optimize}} in order to iteratively find the
-smallest relative error still resulting in passing the chi-squared test
-as defined in the FOCUS kinetics report from 2006.
+This function finds the smallest relative error still resulting in passing the
+chi-squared test as defined in the FOCUS kinetics report from 2006.
}
\usage{
mkinerrmin(fit, alpha = 0.05)
@@ -34,8 +33,8 @@ mkinerrmin(fit, alpha = 0.05)
This function is used internally by \code{\link{summary.mkinfit}}.
}
\examples{
-SFO_SFO = mkinmod(parent = list(type = "SFO", to = "m1"),
- m1 = list(type = "SFO"),
+SFO_SFO = mkinmod(parent = mkinsub("SFO", to = "m1"),
+ m1 = mkinsub("SFO"),
use_of_ff = "max")
fit_FOCUS_D = mkinfit(SFO_SFO, FOCUS_2006_D, quiet = TRUE)
diff --git a/man/mkinfit.Rd b/man/mkinfit.Rd
index aa38b462..8e2fbeb1 100644
--- a/man/mkinfit.Rd
+++ b/man/mkinfit.Rd
@@ -275,10 +275,10 @@ FOMC_SFO <- mkinmod(
parent = mkinsub("FOMC", "m1"),
m1 = mkinsub("SFO"))
# Fit the model to the FOCUS example dataset D using defaults
-fit.FOMC_SFO <- mkinfit(FOMC_SFO, FOCUS_2006_D)
+fit.FOMC_SFO <- mkinfit(FOMC_SFO, FOCUS_2006_D, quiet = TRUE)
# Use starting parameters from parent only FOMC fit
-fit.FOMC = mkinfit("FOMC", FOCUS_2006_D)
-fit.FOMC_SFO <- mkinfit(FOMC_SFO, FOCUS_2006_D,
+fit.FOMC = mkinfit("FOMC", FOCUS_2006_D, quiet = TRUE)
+fit.FOMC_SFO <- mkinfit(FOMC_SFO, FOCUS_2006_D, quiet = TRUE,
parms.ini = fit.FOMC$bparms.ode)
# Use stepwise fitting, using optimised parameters from parent only fit, SFORB
@@ -286,24 +286,26 @@ SFORB_SFO <- mkinmod(
parent = list(type = "SFORB", to = "m1", sink = TRUE),
m1 = list(type = "SFO"))
# Fit the model to the FOCUS example dataset D using defaults
-fit.SFORB_SFO <- mkinfit(SFORB_SFO, FOCUS_2006_D)
-fit.SFORB_SFO.deSolve <- mkinfit(SFORB_SFO, FOCUS_2006_D, solution_type = "deSolve")
+fit.SFORB_SFO <- mkinfit(SFORB_SFO, FOCUS_2006_D, quiet = TRUE)
+fit.SFORB_SFO.deSolve <- mkinfit(SFORB_SFO, FOCUS_2006_D, solution_type = "deSolve",
+ quiet = TRUE)
# Use starting parameters from parent only SFORB fit (not really needed in this case)
-fit.SFORB = mkinfit("SFORB", FOCUS_2006_D)
-fit.SFORB_SFO <- mkinfit(SFORB_SFO, FOCUS_2006_D, parms.ini = fit.SFORB$bparms.ode)
+fit.SFORB = mkinfit("SFORB", FOCUS_2006_D, quiet = TRUE)
+fit.SFORB_SFO <- mkinfit(SFORB_SFO, FOCUS_2006_D, parms.ini = fit.SFORB$bparms.ode, quiet = TRUE)
}
\dontrun{
# Weighted fits, including IRLS
SFO_SFO.ff <- mkinmod(parent = mkinsub("SFO", "m1"),
m1 = mkinsub("SFO"), use_of_ff = "max")
-f.noweight <- mkinfit(SFO_SFO.ff, FOCUS_2006_D)
+f.noweight <- mkinfit(SFO_SFO.ff, FOCUS_2006_D, quiet = TRUE)
summary(f.noweight)
-f.irls <- mkinfit(SFO_SFO.ff, FOCUS_2006_D, reweight.method = "obs")
+f.irls <- mkinfit(SFO_SFO.ff, FOCUS_2006_D, reweight.method = "obs", quiet = TRUE)
summary(f.irls)
-f.w.mean <- mkinfit(SFO_SFO.ff, FOCUS_2006_D, weight = "mean")
+f.w.mean <- mkinfit(SFO_SFO.ff, FOCUS_2006_D, weight = "mean", quiet = TRUE)
summary(f.w.mean)
-f.w.value <- mkinfit(SFO_SFO.ff, subset(FOCUS_2006_D, value != 0), err = "value")
+f.w.value <- mkinfit(SFO_SFO.ff, subset(FOCUS_2006_D, value != 0), err = "value",
+ quiet = TRUE)
summary(f.w.value)
}
@@ -312,9 +314,9 @@ summary(f.w.value)
dw <- FOCUS_2006_D
errors <- c(parent = 2, m1 = 1)
dw$err.man <- errors[FOCUS_2006_D$name]
-f.w.man <- mkinfit(SFO_SFO.ff, dw, err = "err.man")
+f.w.man <- mkinfit(SFO_SFO.ff, dw, err = "err.man", quiet = TRUE)
summary(f.w.man)
-f.w.man.irls <- mkinfit(SFO_SFO.ff, dw, err = "err.man",
+f.w.man.irls <- mkinfit(SFO_SFO.ff, dw, err = "err.man", quiet = TRUE,
reweight.method = "obs")
summary(f.w.man.irls)
}
diff --git a/man/mkinparplot.Rd b/man/mkinparplot.Rd
index 3eda08d2..34b06963 100644
--- a/man/mkinparplot.Rd
+++ b/man/mkinparplot.Rd
@@ -1,8 +1,7 @@
\name{mkinparplot}
\alias{mkinparplot}
\title{
- Function to plot the confidence intervals obtained using
- \code{\link{mkinfit}}
+ Function to plot the confidence intervals obtained using mkinfit
}
\description{
This function plots the confidence intervals for the parameters
@@ -25,9 +24,9 @@
\examples{
model <- mkinmod(
- T245 = list(type = "SFO", to = c("phenol"), sink = FALSE),
- phenol = list(type = "SFO", to = c("anisole")),
- anisole = list(type = "SFO"), use_of_ff = "max")
+ T245 = mkinsub("SFO", to = c("phenol"), sink = FALSE),
+ phenol = mkinsub("SFO", to = c("anisole")),
+ anisole = mkinsub("SFO"), use_of_ff = "max")
fit <- mkinfit(model, subset(mccall81_245T, soil == "Commerce"), quiet = TRUE)
mkinparplot(fit)
}
diff --git a/man/mmkin.Rd b/man/mmkin.Rd
index 3a8d4a1f..eb6d05eb 100644
--- a/man/mmkin.Rd
+++ b/man/mmkin.Rd
@@ -57,21 +57,22 @@ models <- list(SFO_lin = m_synth_SFO_lin, FOMC_lin = m_synth_FOMC_lin)
datasets <- lapply(synthetic_data_for_UBA_2014[1:3], function(x) x$data)
names(datasets) <- paste("Dataset", 1:3)
-time_default <- system.time(fits.0 <- mmkin(models, datasets))
-time_1 <- system.time(fits.1 <- mmkin(models, datasets, cores = 1))
+time_default <- system.time(fits.0 <- mmkin(models, datasets, quiet = TRUE))
+time_1 <- system.time(fits.4 <- mmkin(models, datasets, cores = 1, quiet = TRUE))
time_default
time_1
-endpoints(fits[["SFO_lin", 2]])
+endpoints(fits.0[["SFO_lin", 2]])
-# Plot.mkinfit handles rows or columns of mmkin result objects
+# plot.mkinfit handles rows or columns of mmkin result objects
plot(fits.0[1, ])
plot(fits.0[1, ], obs_var = c("M1", "M2"))
plot(fits.0[, 1])
# Use double brackets to extract a single mkinfit object, which will be plotted
-# by plot.mkinfit
+# by plot.mkinfit and can be plotted using plot_sep
plot(fits.0[[1, 1]], sep_obs = TRUE, show_residuals = TRUE, show_errmin = TRUE)
+plot_sep(fits.0[[1, 1]])
# Plotting with mmkin (single brackets, extracting an mmkin object) does not
# allow to plot the observed variables separately
plot(fits.0[1, 1])
diff --git a/man/plot.mmkin.Rd b/man/plot.mmkin.Rd
index 57f69c90..7f3460d3 100644
--- a/man/plot.mmkin.Rd
+++ b/man/plot.mmkin.Rd
@@ -46,13 +46,14 @@
}
\examples{
# Only use one core not to offend CRAN checks, use Levenberg-Marquardt for speed
- fits <- mmkin(c("FOMC", "HS"), list("FOCUS B" = FOCUS_2006_B, "FOCUS C" = FOCUS_2006_C),
+ fits <- mmkin(c("FOMC", "HS"),
+ list("FOCUS B" = FOCUS_2006_B, "FOCUS C" = FOCUS_2006_C), # named list for titles
cores = 1, quiet = TRUE, method.modFit = "Marq")
plot(fits[, "FOCUS C"])
plot(fits["FOMC", ])
- # We can also plot a single fit, if we like the way mmkin works, but then the plot
+ # We can also plot a single fit, if we like the way plot.mmkin works, but then the plot
# height should be smaller than the plot width (this is not possible for the html pages
- # generated by staticdocs, as far as I know).
+ # generated by pkgdown, as far as I know).
plot(fits["FOMC", "FOCUS C"]) # same as plot(fits[1, 2])
}
diff --git a/man/print.mkinmod.Rd b/man/print.mkinmod.Rd
index fa02c1cb..24555def 100644
--- a/man/print.mkinmod.Rd
+++ b/man/print.mkinmod.Rd
@@ -7,7 +7,7 @@
Print mkinmod objects in a way that the user finds his way to get to its components.
}
\usage{
-\method{print}{mkinmod}(x, ...)
+ \method{print}{mkinmod}(x, ...)
}
\arguments{
\item{x}{
@@ -17,3 +17,10 @@
Not used.
}
}
+\examples{
+ m_synth_SFO_lin <- mkinmod(parent = list(type = "SFO", to = "M1"),
+ M1 = list(type = "SFO", to = "M2"),
+ M2 = list(type = "SFO"), use_of_ff = "max")
+
+ print(m_synth_SFO_lin)
+}
diff --git a/man/schaefer07_complex_case.Rd b/man/schaefer07_complex_case.Rd
index c666d08b..50272f4e 100644
--- a/man/schaefer07_complex_case.Rd
+++ b/man/schaefer07_complex_case.Rd
@@ -36,6 +36,12 @@ model <- mkinmod(
B1 = list(type = "SFO"),
C1 = list(type = "SFO"),
A2 = list(type = "SFO"), use_of_ff = "max")
-\dontrun{mkinfit(model, data)}
+ \dontrun{
+ fit <- mkinfit(model, data, quiet = TRUE)
+ plot(fit)
+ endpoints(fit)
+ }
+ # Compare with the results obtained in the original publication
+ print(schaefer07_complex_results)
}
\keyword{datasets}
diff --git a/man/summary.mkinfit.Rd b/man/summary.mkinfit.Rd
index af09e86a..876fc362 100644
--- a/man/summary.mkinfit.Rd
+++ b/man/summary.mkinfit.Rd
@@ -70,6 +70,6 @@
Johannes Ranke
}
\examples{
- summary(mkinfit(mkinmod(parent = list(type = "SFO")), FOCUS_2006_A, quiet = TRUE))
+ summary(mkinfit(mkinmod(parent = mkinsub("SFO")), FOCUS_2006_A, quiet = TRUE))
}
\keyword{ utilities }
diff --git a/man/synthetic_data_for_UBA.Rd b/man/synthetic_data_for_UBA.Rd
index 468e3731..a9739d55 100644
--- a/man/synthetic_data_for_UBA.Rd
+++ b/man/synthetic_data_for_UBA.Rd
@@ -61,7 +61,9 @@ m_synth_DFOP_par <- mkinmod(parent = list(type = "DFOP", to = c("M1", "M2"),
M1 = list(type = "SFO"),
M2 = list(type = "SFO"), use_of_ff = "max")
-mkinfit(m_synth_SFO_lin, synthetic_data_for_UBA_2014[[1]]$data)
+fit <- mkinfit(m_synth_SFO_lin, synthetic_data_for_UBA_2014[[1]]$data, quiet = TRUE)
+plot_sep(fit)
+summary(fit)
}
}
\keyword{datasets}
diff --git a/man/transform_odeparms.Rd b/man/transform_odeparms.Rd
index 71c179d7..a1ccdf26 100644
--- a/man/transform_odeparms.Rd
+++ b/man/transform_odeparms.Rd
@@ -69,7 +69,7 @@ fit <- mkinfit(SFO_SFO, FOCUS_2006_D, quiet = TRUE)
summary(fit, data=FALSE) # See transformed and backtransformed parameters
\dontrun{
-fit.2 <- mkinfit(SFO_SFO, FOCUS_2006_D, transform_rates = FALSE)
+fit.2 <- mkinfit(SFO_SFO, FOCUS_2006_D, transform_rates = FALSE, quiet = TRUE)
summary(fit.2, data=FALSE)
}
@@ -87,7 +87,7 @@ SFO_SFO.ff <- mkinmod(
m1 = list(type = "SFO"),
use_of_ff = "max")
-fit.ff <- mkinfit(SFO_SFO.ff, FOCUS_2006_D)
+fit.ff <- mkinfit(SFO_SFO.ff, FOCUS_2006_D, quiet = TRUE)
summary(fit.ff, data = FALSE)
initials <- c("f_parent_to_m1" = 0.5)
transformed <- transform_odeparms(initials, SFO_SFO.ff)
@@ -100,7 +100,7 @@ SFO_SFO.ff.2 <- mkinmod(
use_of_ff = "max")
-fit.ff.2 <- mkinfit(SFO_SFO.ff.2, FOCUS_2006_D)
+fit.ff.2 <- mkinfit(SFO_SFO.ff.2, FOCUS_2006_D, quiet = TRUE)
summary(fit.ff.2, data = FALSE)
}
}

Contact - Imprint