summaryrefslogtreecommitdiff
path: root/docs/reference/one_box.md
diff options
context:
space:
mode:
authorRanke Johannes <johannes.ranke@agroscope.admin.ch>2026-06-22 18:01:11 +0200
committerRanke Johannes <johannes.ranke@agroscope.admin.ch>2026-06-22 18:01:11 +0200
commite0c130005ee7adbac9b832ea8157712419d51b7e (patch)
treef5c188285ee3abd9edda16a6bb96b6142c80afba /docs/reference/one_box.md
parentf8fdbc3237d12d5511058d2c0c40f3e99debe682 (diff)
Update static docs
Diffstat (limited to 'docs/reference/one_box.md')
-rw-r--r--docs/reference/one_box.md83
1 files changed, 83 insertions, 0 deletions
diff --git a/docs/reference/one_box.md b/docs/reference/one_box.md
new file mode 100644
index 0000000..0c93346
--- /dev/null
+++ b/docs/reference/one_box.md
@@ -0,0 +1,83 @@
+# Create a time series of decline data
+
+Create a time series of decline data
+
+## Usage
+
+``` r
+one_box(x, ini, ..., t_end = 100, res = 0.01)
+
+# S3 method for class 'numeric'
+one_box(x, ini = 1, ..., t_end = 100, res = 0.01)
+
+# S3 method for class 'character'
+one_box(x, ini = 1, parms, ..., t_end = 100, res = 0.01)
+
+# S3 method for class 'mkinfit'
+one_box(x, ini = "model", ..., t_end = 100, res = 0.01)
+```
+
+## Arguments
+
+- x:
+
+ When numeric, this is the half-life to be used for an exponential
+ decline. When a character string specifying a parent decline model is
+ given e.g. `FOMC`, `parms` must contain the corresponding parameters.
+ If x is an
+ [mkinfit](https://pkgdown.jrwb.de/mkin/reference/mkinfit.html) object,
+ the decline is calculated from this object.
+
+- ini:
+
+ The initial amount. If x is an
+ [mkinfit](https://pkgdown.jrwb.de/mkin/reference/mkinfit.html) object,
+ and ini is 'model', the fitted initial concentrations are used.
+ Otherwise, ini must be numeric. If it has length one, it is used for
+ the parent and initial values of metabolites are zero, otherwise, it
+ must give values for all observed variables.
+
+- ...:
+
+ Further arguments passed to methods
+
+- t_end:
+
+ End of the time series
+
+- res:
+
+ Resolution of the time series
+
+- parms:
+
+ A named numeric vector containing the model parameters
+
+## Value
+
+An object of class `one_box`, inheriting from
+[ts](https://rdrr.io/r/stats/ts.html).
+
+## Examples
+
+``` r
+# Only use a half-life
+pred_0 <- one_box(10)
+plot(pred_0)
+
+
+# Use a fitted mkinfit model
+require(mkin)
+fit <- mkinfit("FOMC", FOCUS_2006_C, quiet = TRUE)
+pred_1 <- one_box(fit)
+plot(pred_1)
+
+
+# Use a model with more than one observed variable
+m_2 <- mkinmod(parent = mkinsub("SFO", "m1"), m1 = mkinsub("SFO"))
+#> Temporary DLL for differentials generated and loaded
+fit_2 <- mkinfit(m_2, FOCUS_2006_D, quiet = TRUE)
+#> Warning: Observations with value of zero were removed from the data
+pred_2 <- one_box(fit_2, ini = "model")
+plot(pred_2)
+```

Contact - Imprint