Package: cvasi 1.4.0
cvasi: Calibration, Validation, and Simulation of TKTD Models
Eases the use of ecotoxicological effect models. Can simulate common toxicokinetic-toxicodynamic (TK/TD) models such as General Unified Threshold models of Survival (GUTS) and Lemna. It can derive effects and effect profiles (EPx) from scenarios. It supports the use of 'tidyr' workflows employing the pipe symbol. Time-consuming tasks can be parallelized.
Authors:
cvasi_1.4.0.tar.gz
cvasi_1.4.0.tar.gz(r-4.5-noble)cvasi_1.4.0.tar.gz(r-4.4-noble)
cvasi_1.4.0.tgz(r-4.4-emscripten)cvasi_1.4.0.tgz(r-4.3-emscripten)
cvasi.pdf |cvasi.html✨
cvasi/json (API)
NEWS
# Install 'cvasi' in R: |
install.packages('cvasi', repos = 'https://cloud.r-project.org') |
Bug tracker:https://github.com/cvasi-tktd/cvasi/issues0 issues
- Rsubcapitata - An algae scenario
- Schmitt2013 - A Lemna data set with multiple treatment levels
- americamysis - A DEB abj scenario of Americamysis bahia
- dmagna - A DEBtox scenario of Daphnia magna
- focusd1 - A Lemna_SETAC scenario with variable environment
- metsulfuron - Lemna data published by Schmitt
- minnow_it - A fitted GUTS-RED-IT scenario of the fathead minnow
- minnow_sd - A fitted GUTS-RED-SD scenario of the fathead minnow
Last updated 30 days agofrom:6a77d67147. Checks:3 OK. Indexed: no.
Target | Result | Latest binary |
---|---|---|
Doc / Vignettes | OK | Mar 30 2025 |
R-4.5-linux-x86_64 | OK | Mar 30 2025 |
R-4.4-linux-x86_64 | OK | Mar 30 2025 |
Exports:%>%Algae_SimpleAlgae_TKTDAlgae_Weberbatchcache_controlscalibrateCalibrationSetcalisetDEB_abjDEB_DaphniaDEBtoxdose_responseeffectepxepx_mtwexplore_spaceExposureSeriesfxget_modelget_model_nameget_tagGUTS_RED_ITGUTS_RED_SDimport_morseimport_swashimport_toxswais_DEBis_GUTSis_GUTS_ITis_GUTS_SDis_Lemnais_LemnaThresholdis_scenarioLemna_SchmittLemna_SchmittTholdLemna_SETAClik_profilelog_disablelog_enablelog_envirlog_liklog_msglog_scenariosmorseMyrioMyrio_logno_exposureparameter_setpll_debugplot_epxplot_lik_profileplot_param_spaceplot_ppcplot_scenarioplot_sdpull_metadatasequenceset_boundsset_endpointsset_exposureset_forcingsset_initset_moaset_mode_of_actionset_noexposureset_notransferset_nowindowset_paramset_tagset_timesset_transferset_windowsimulatesimulate_batchsolversurvival
Dependencies:clicodetoolscolorspacecpp11crayondeSolvedigestdplyrfansifarverforcatsfurrrfuturegenericsGGallyggplot2ggstatsglobalsgluegridExtragtablehmsisobandlabelinglatticelifecyclelistenvlubridatemagrittrMASSMatrixmgcvmunsellnlmeparallellypatchworkpillarpkgconfigplyrprettyunitsprogresspurrrR6RColorBrewerRcpprlangscalesstringistringrtibbletidyrtidyselecttimechangeunitsutf8vctrsviridisLitewithr
Citation
To cite package ‘cvasi’ in publications use:
Kehrein N, Nickisch D, Vermeiren P (2025). cvasi: Calibration, Validation, and Simulation of TKTD Models. R package version 1.4.0, https://CRAN.R-project.org/package=cvasi.
Corresponding BibTeX entry:
@Manual{, title = {cvasi: Calibration, Validation, and Simulation of TKTD Models}, author = {Nils Kehrein and Dirk Nickisch and Peter Vermeiren}, year = {2025}, note = {R package version 1.4.0}, url = {https://CRAN.R-project.org/package=cvasi}, }
Readme and manuals
cvasi: Calibration, Validation, and Simulation of TKTD models in R
The cvasi
package aims to ease the use of ecotox effect models by
providing an intuitive workflow. Model inputs and parameters are
encapsulated in scenario objects which can be piped to other functions.
Operations can be chained using the tidyr
syntax. The most
time-consuming processes can be run in parallel if requested.
The package provides facilities to
- simulate effect models such as GUTS-RED, DEB, Lemna, Myriophyllum, and Algae
- calculate effect endpoints
- derive effect profiles (EPx values)
- import exposure time-series from FOCUS TOXSWA
- import fitted parameters from morse
- and more
A graphical user interface implemented in Shiny is also available, see the cvasi.ui package. Please have a look at the Changelog for an overview of user-facing updates and changes.
Installation
Install the package from CRAN:
install.packages("cvasi", dependencies=TRUE)
Or install the newest development version from GitHub:
install.packages("remotes", dependencies=TRUE)
remotes::install_github("cvasi-tktd/cvasi", dependencies=TRUE)
For installing cvasi
from GitHub on Windows computers, please make
sure that you also have
Rtools installed on
your machine. Rtools are required to compile the package’s C code.
Documentation
The package contains the following vignettes
They can also be accessed locally by executing an R statement such as:
vignette("cvasi-1-manual", package="cvasi")
Usage
Basic usage:
library(cvasi)
# create and parameterize a GUTS-RED-IT scenario
GUTS_RED_IT() %>%
set_param(c(kd=0.0005, hb=0, alpha=0.4, beta=1.5)) %>%
set_exposure(data.frame(time=c(0, 100, 101, 200, 201, 400),
conc=c(0, 0, 0.1, 0.1, 0, 0))) %>%
set_times(1:400) -> scenario
# simulate scenario
results <- scenario %>% simulate()
tail(results)
#> time D H S
#> 395 395 0.004429420 0 0.998655
#> 396 396 0.004427206 0 0.998655
#> 397 397 0.004424993 0 0.998655
#> 398 398 0.004422781 0 0.998655
#> 399 399 0.004420570 0 0.998655
#> 400 400 0.004418360 0 0.998655
# ... and plot simulation results
plot(results)

Calculation of effects:
# calculate effect level
scenario %>% effect()
#> # A tibble: 1 x 4
#> scenario L L.dat.start L.dat.end
#> <list> <dbl> <dbl> <dbl>
#> 1 <GutsRdIt> 0.00135 1 400
# create a dose-response curve
scenario %>% dose_response() -> drc
head(drc)
#> endpoint mf effect
#> 1 L 3.812500 0.009915394
#> 2 L 4.799653 0.013954569
#> 3 L 6.042405 0.019597765
#> 4 L 7.606938 0.027459877
#> 5 L 9.576567 0.038357524
#> 6 L 12.056184 0.053336214
# plot the dose-response curve
plot(drc)

# derive EPx values
scenario %>% epx()
#> # A tibble: 1 x 3
#> scenario L.EP10 L.EP50
#> <list> <dbl> <dbl>
#> 1 <GutsRdIt> 19.0 82.1
Multiple scenarios can be processed in parallel without modifications to the workflow:
# enable parallel processing
future::plan(future::multisession)
# derive EPx for a list of 100 scenarios in parallel
rep(c(scenario), 100) %>% epx()
# disable parallel processing
future::plan(future::sequential)
License
The package and its source code is free and open-source software available under the GPL-3.0 license.
Issues
If you find any issues or bugs within the package, please create a new issue on GitHub.
Contributing
Contributions to the project are welcome! Please have a look at the Contribution Guidelines before submitting a Pull Request.
Acknowledgements
Financial support for creation and release of this software project was provided by Bayer Crop Science. This R package started as an internal project at Bayer Crop Science and the project owners would like to thank the people who have contributed (in no particular order):
Nils Kehrein, Johannes Witt, André Gergs, Thomas Preuss, Julian Heinrich, Zhenglei Gao, Tjalling Jager, Dirk Nickisch, Torben Wittwer, and Peter Vermeiren.
Help Manual
Help page | Topics |
---|---|
Algae model with exponential growth but without additional forcings | AlgaeSimple-class AlgaeSimpleScenario-class Algae_Simple |
Algae model with exponential growth, forcings (P, I) and scaled damage | AlgaeTKTD-class AlgaeTKTDScenario-class Algae_TKTD |
Algae model with exponential growth and forcings (I, T) | AlgaeWeber-class AlgaeWeberScenario-class Algae_Weber |
Algae models | Algae-class Algae-models |
A DEB abj scenario of Americamysis bahia | americamysis |
Batch simulation of multiple exposure levels | batch |
Cache control simulations | cache_controls |
Fit model parameters to experimental data | calibrate calibrate,CalibrationSet-method calibrate,EffectScenario-method calibrate,list-method |
Calibration set | CalibrationSet CalibrationSet-class caliset |
DEB_abj | DebAbj-class DEB_abj |
Dynamic Energy Budget (DEB) models | Deb-class DEB-models |
DEBtox model | DebDaphnia-class DEBtox DebTox-class DEBtox2019 DEB_Daphnia |
A DEBtox scenario of Daphnia magna | dmagna |
Calculate a dose response curve | dose_response |
Effect level | effect |
Effect profiles (EPx values) | epx |
Calculate EPx values for a series of moving time window | epx_mtw |
Explore parameter space | explore_space |
Exposure time-series | ExposureSeries ExposureSeries-class |
A Lemna_SETAC scenario with variable environment | focusd1 |
Generic to calculate effects for a particular scenario | fx fx,Algae-method fx,ANY-method fx,GutsRedIt-method fx,GutsRedSd-method fx,Lemna-method fx,Myriophyllum-method |
Get model name | get_model get_model,ANY-method get_model,EffectScenario-method get_model,list-method get_model,ParameterSet-method get_model_name |
Get scenario tag | get_tag get_tag,ANY-method get_tag,EffectScenario-method get_tag,list-method get_tag,ParameterSet-method |
GUTS-RED-IT scenario | GutsRedIt-class GUTS_RED_IT |
GUTS-RED-SD scenario | GutsRedSd-class GUTS_RED_SD |
GUTS-RED models | GUTS-RED-models |
Import 'morse' model parameters | import_morse morse |
SWASH project exposure profile import | import_swash |
Import _TOXSWA_ exposure series | import_toxswa |
Test if argument is a DEB model | is_DEB |
Test if argument is a GUTS model | is_GUTS is_GUTS_IT is_GUTS_SD |
Test if argument is a Lemna model | is_Lemna |
Test if argument is a LemnaThreshold model | is_LemnaThreshold |
Test if argument is an effect scenario | is_scenario |
Lemna model (Schmitt et al. 2013) | LemnaSchmitt-class LemnaSchmittScenario-class Lemna_Schmitt Lemna_SchmittThold |
Lemna model (Klein et al. 2021) | LemnaSetac-class LemnaSetacScenario-class Lemna_SETAC |
Lemna models | Lemna-class Lemna-models |
Likelihood profiling | lik_profile |
Start and stop logging | log_disable log_enable |
Log R environment properties | log_envir |
Calculate log likelihood | log_lik |
Add a log message | log_msg |
Log scenario properties | log_scenarios |
Macrophyte models | Macrophyte-models |
Lemna data published by Schmitt (2013) | metsulfuron |
A fitted GUTS-RED-IT scenario of the fathead minnow | minnow_it |
A fitted GUTS-RED-SD scenario of the fathead minnow | minnow_sd |
Myriophyllum model with exponential growth | Myrio MyrioExp-class MyrioExpScenario-class |
Myriophyllum model with logistic growth | MyrioLog-class MyrioLogScenario-class Myrio_log |
Myriophyllum models | Myriophyllum-class Myriophyllum-models |
Zero exposure | no_exposure |
Set of model parameters | ParameterSet-class parameter_set parameter_set-class |
Disable parallelization for debugging | pll_debug |
S3 plotting functions | plot plot.cvasi.drc plot.cvasi.simulate |
Plot EPx values | plot_epx |
Plot likelihood profiles or all profiled parameters | plot_lik_profile |
Plot likelihood profiles or all profiled parameters | plot_param_space |
Creates a PPC plot for a single dataset | plot_ppc |
Create PPC plot for one or more datasets | plot_ppc_combi |
Creates a prediction plot for one effect scenario | plot_scenario |
Creates plot of model results (uncertainties optional) | plot_sd |
Pull metadata from scenarios | pull_metadata |
An algae scenario | Rsubcapitata |
Effect scenario classes | EffectScenario-class scenario Scenarios scenarios |
A Lemna data set with multiple treatment levels | Schmitt2013 |
Sequence of scenarios | ScenarioSequence-class sequence |
Set boundaries of model parameters | set_bounds set_bounds,CalibrationSet,list-method set_bounds,EffectScenario,list-method set_bounds,list,list-method |
Set effect endpoints | set_endpoints |
Set exposure time-series | set_exposure set_exposure,ANY,ANY-method set_exposure,EffectScenario,data.frame-method set_exposure,EffectScenario,ExposureSeries-method set_exposure,EffectScenario,list-method set_exposure,list,ANY-method set_exposure,list,list-method |
Set time-dependent parameters | set_forcings set_forcings,EffectScenario-method set_forcings,list-method |
Set initial state | set_init set_init,EffectScenario-method set_init,vector-method |
Set mode of action | set_moa set_mode_of_action |
Set zero exposure | set_noexposure |
Set model parameters | set_param set_param,EffectScenario,ParameterSet-method set_param,EffectScenario,vector-method set_param,list,ParameterSet-method set_param,list,vector-method set_param,ScenarioSequence,ParameterSet-method set_param,ScenarioSequence,vector-method |
Set a tag | set_tag |
Set output times | set_times |
Set transfer events | set_notransfer set_transfer set_transfer,ANY-method set_transfer,Transferable-method |
Set window length | set_nowindow set_window |
Simulate an effect scenario | simulate simulate,EffectScenario-method simulate,ScenarioSequence-method simulate,SimulationBatch-method simulate,Transferable-method |
Batch simulation using multiple exposure series | simulate_batch |
Calls ODE solver for a particular model | solver solver,AlgaeSimple-method solver,AlgaeTKTD-method solver,AlgaeWeber-method solver,ANY-method solver,DebAbj-method solver,DebDaphnia-method solver,DebTox-method solver,GutsRedIt-method solver,GutsRedSd-method solver,LemnaSchmitt-method solver,LemnaSetac-method solver,MyrioExp-method solver,MyrioLog-method |
Survival rate | survival |
Biomass transfer class | Biomass-transfer Transferable Transferable-class |