aboutsummaryrefslogtreecommitdiff
path: root/R/mkinpredict.R
AgeCommit message (Collapse)AuthorFilesLines
2023-02-13WIP adapting to new deSolve with faster lsodaJohannes Ranke1-75/+15
2022-11-16We get about 25% performance gainJohannes Ranke1-24/+83
with the custom lsoda call, avoiding repeated getNativeSymbolInfo calls. It's just that we should not be calling foreign functions from different packages, because the may change without notice. Using getNativeSymbolInfo for "call_lsoda" avoids the CRAN note, and a similar call could probably be used for "unlock_solver", avoiding the NOTE in checks for cran, but we should not do this in a CRAN package.
2022-11-04Make it easy to override maxsteps for lsodaJohannes Ranke1-23/+26
The hope was to be more successful in saemix fits, but I did not notice an improvement (e.g. for a failing likelihood calculation with importance sampling, where the error message suggested to increase maxsteps).
2022-07-08Store DLL info in mkinmod objects for performanceJohannes Ranke1-1/+2
Thanks to Tomas Kalibera for his analysis of the problem on the r-package-devel mailing list and for the suggestion on how to fix it. See the current benchmark vignette for the new data on mkin 1.1.1 with R 4.2.1, with unprecedented performance.
2020-12-09Make saem using mkinpredict work againJohannes Ranke1-1/+3
I threw out mclapply as it did not play well with the linear algebra routines used in the saemix code. Most of the change is actually indentation in the code creating the model function. But there is an important fix in mkinpredict which I had broken.
2020-12-07Attempt to be more failsafe in saemix runsJohannes Ranke1-2/+8
2020-11-27Improved way to have persistent DLLs for mkinmodJohannes Ranke1-7/+2
Depends on inline >= 0.16.2 (including the bug fixes from eddelbuettel/inline#18), which provides 'moveDLL' to store the DLL for a compiled function in a safe place in case the argument 'dll_dir' is specified in the call to 'mkinmod'. Huge thanks to Dirk @eddelbuettel for his review and support for the work on the inline package.
2020-11-24Support storing mkinmod compiled code as CFunc objectsJohannes Ranke1-6/+11
With automatic reloading in mkinfit and mkinpredict in case the DLL is not loaded and the original DLL path has been cleaned up. Depends on jranke/inline@974bdea04fcedfafaab231e6f359c88270b56cb9 See inline#13
2020-11-07Create saem generic for fitting saemix modelsJohannes Ranke1-7/+3
The reasons for this decision were - Creating an saemix generic in the saemix package caused problems with roxygen, because functions like saemix.plot.xy were documented in their help files as S3 methods, although explicitly exported with @export - Creating an saemix generic in this package is possible, but would make it necessary to load samix with exclude = "saemix" in order to avoid overwriting the generic when loading saemix. - The return object of such an saemix generic in this package cannot be an S3 class with class attribute c("saemix.mmkin", "SaemixObject") similar to nlme.mmkin, as saemix returns an S4 class. - Extending the S4 class SaemixObject using simple inheritance to a class SaemixMmkinObject with additional slots did not work as expected. When the initialize method was left untouched, it prevented creation of an SaemixMmkinObject even if it was based on an initialised SaemixObject, as the initialize method seems to always be called by new(). This could potentially be circumvented by a coerce method. If an alternative initialize method was used, an SaemixMmkinObject could be created. However, the methods written for SaemixObjects only worked in some instances, either because they checked for the class, and not for class inheritance (like compare.saemix), or because the initialize method was called for some reason. Therefore, the idea of creating a derived S4 class was abandoned. - A side effect of this decision is that the introduction of the saem generic opens the possibility to use the same generic also for other backends like nlmixr with the SAEM algorithm.
2020-11-07Make deSolve predictions within saemix robustJohannes Ranke1-2/+11
Also, exclude the saemix function when loading saemix in the example code, to prevent overriding our generic
2020-05-18Add commentJohannes Ranke1-1/+2
2020-05-12Improve documentation, now using a spell checkerJohannes Ranke1-1/+1
2020-05-11Avoid merge() and data.frame() in cost functionJohannes Ranke1-22/+26
also for deSolve and eigenvalue based solutions. This noticeably increases performance for these methods, see test.log and benchmark vignette.
2020-05-09Avoid the call to merge for analytical solutionsJohannes Ranke1-2/+15
This increases performance up to a factor of five!
2020-05-09Make mkinpredict consistently return a dataframeJohannes Ranke1-16/+16
2020-05-07Another overhaul of analytical solutionsJohannes Ranke1-11/+11
Still in preparation for analytical solutions of coupled models
2020-05-06Change implementation of analytical solutionsJohannes Ranke1-91/+61
Preparing for symbolic solutions for more than one compound
2020-05-06Formatting, README update, color palette of R 4.xJohannes Ranke1-32/+32
2019-10-25Use roxygen for functions and methodsJohannes Ranke1-19/+100
2019-02-21Add the logistic modelJohannes Ranke1-2/+6
2018-09-18Make mkinpredict generic and write a method for fitsJohannes Ranke1-25/+52
2016-11-17Remove trailing whitespace, clean headersJohannes Ranke1-13/+13
Also ignore test.R in the top level directory, as it is not meant to be public
2015-06-20Low-level generation of compiled modelsJohannes Ranke1-16/+27
As it is unclear if and when ccSolve will be published on CRAN, the generation, compilation and use of the C version of the system of differential equations was developed for mkin, inspired and guided by the code from the ccSolve package. Many thanks again to Karline Soetaert for all of her work on this and other R packages. Now all model types, including the Hockey-Stick model for the parent compund and the IORE model for parent and/or metabolites can be compiled.
2015-04-16Order of parameters needs to be right for compiled modelsJohannes Ranke1-1/+1
2015-04-16Update copyright header, improve documentation of solution_typeJohannes Ranke1-1/+1
2015-04-16Check compiled mkinmod versions in examples and testsJohannes Ranke1-1/+2
Tests all pass (Linux)
2015-04-14Compile differential equation models with ccSolve packageJohannes Ranke1-9/+13
If the ccSolve package is available, and time is not in the right hand side of the equations (i.e. if only SFO and SFORB models are used), the differential equation model is compiled from auto-generated C code. Currently, one test (FOCUS 2006 D SFO_SFO) fails
2014-07-14Nearly complete support for IORE, pending mkinerrminJohannes Ranke1-0/+4
2014-07-12First working fits with IORE modelJohannes Ranke1-0/+6
2014-02-27Format of gmkin workspace files, copyright, updatesJohannes Ranke1-1/+2
- Change the format of the workspace files of gmkin so they can be distributed in the mkin package - Add gmkin workspace datasets FOCUS_2006_gmkin and FOCUS_2006_Z_gmkin - Restrict the unit test with the Schaefer data to parent and primary metabolites as formation fraction and DT50 for A2 are higly correlated and passing the test is platform dependent. For example, the test fails in 1 out of 14 platforms on CRAN as of today - Add Eurofins Regulatory AG copyright notices - Import FME and deSolve instead of depending on them to have cleaner startup
2013-12-04Make it possible to use different ode solvers=1-4/+6
2013-11-04Complete the fix for fixing initial values for state variablesjranke1-0/+5
git-svn-id: svn+ssh://svn.r-forge.r-project.org/svnroot/kinfit/pkg/mkin@133 edb9625f-4e0d-4859-8d74-9fd3b1da38cb
2012-07-03- Add rtol argument in order to increase the precision of deSolve basedjranke1-1/+2
predictions for complex models - Improve default values for atol and set rtol default to 1e-10 git-svn-id: svn+ssh://svn.r-forge.r-project.org/svnroot/kinfit/pkg/mkin@49 edb9625f-4e0d-4859-8d74-9fd3b1da38cb
2012-04-25- Transferred some testing code from test.R to unit tests for mkinpredictjranke1-4/+4
- Fixed the output format of mkinpredict to be uniform across solution types git-svn-id: svn+ssh://svn.r-forge.r-project.org/svnroot/kinfit/pkg/mkin@33 edb9625f-4e0d-4859-8d74-9fd3b1da38cb
2012-04-24- Added the reference fit data for FOCUS 2006 datasets from the kinfit packagejranke1-1/+21
- Used these data in unit tests for parent only models - Fixed SFORB data and calculation of formation fractions along the way - Reintroduced the test for the Schaefer 2007 data - Got rid of the mkinmod unit tests - they are too hard to maintain and the mkinfit tests test the model definitions as well git-svn-id: svn+ssh://svn.r-forge.r-project.org/svnroot/kinfit/pkg/mkin@32 edb9625f-4e0d-4859-8d74-9fd3b1da38cb
2012-04-23- Fixed a couple of thingsjranke1-1/+3
- Now the eigenvalue based solutions are nicely consistent with the deSolve solutions, if enough output times are specified (100, sometimes more are needed, see test.R) - Workaround for invilr not to produce NaN values so often - Still a lot to do (see TODO) git-svn-id: svn+ssh://svn.r-forge.r-project.org/svnroot/kinfit/pkg/mkin@30 edb9625f-4e0d-4859-8d74-9fd3b1da38cb
2012-04-10- Fitting and summaries now work with the new parameter transformations.jranke1-0/+90
- The SFORB models with metabolites is broken (see TODO) - Moved the vignette to the location recommended since R 2.14 - Added the missing documentation - Commented out the schaefer_complex_case test, as this version of mkin is not able to fit a model without sink and therefore mkin estimated parameters are quite different git-svn-id: svn+ssh://svn.r-forge.r-project.org/svnroot/kinfit/pkg/mkin@22 edb9625f-4e0d-4859-8d74-9fd3b1da38cb

Contact - Imprint