The only think that can help is to create a Minimal Working Example (MWE). And we provide here a set of MWE you can modify to obtain yours.
Feel free to ask question here: New Issue for morse R package
Below is reported a set of minimal examples where each
chunk (piece of R
code in grey area) work on its
own.
morse
and its dependencies (JAGS, C++)Use the two classical R
commands:
install.packages(morse) # install the package
library(morse) # load the package
Recently, a lot of warning messages have appeared when downloading
the morse
package due to an update in its dependencies. We
fix these warnings and we’ll try to do so as soon as possible when new
ones will appear.
Again, feel free to report such messages if they disturb your data processing: New Issue for morse R package
The morse
package is linked to JAGS and C++.
JAGS is the Bayesian sampler used to make inference with survival models.
Download JAGS: https://sourceforge.net/projects/mcmc-jags/
Test and find JAGS
Once installed, JAGS can be lost in the PATH. To help solving this
issue, you can use package runjags
which is not within
morse
so you have to install it.
install.packages("runjags")
library("runjags")
testjags()
We assume hereafter that the morse
package is already
installed.
The output should look like this:
You are using R version 4.0.2 (2020-06-22) on a windows machine, with the RStudio GUI
JAGS version 4.3.0 found successfully using the command 'C:/Program Files/JAGS/JAGS-4.3.0/x64/bin/jags-terminal.exe'
The rjags package is installed
Otherwise, you can tell your system where JAGS executable is
(somewhere in
'C:/Program Files/JAGS/JAGS-4.3.0/x64/bin/jags-terminal.exe'
on windows machines):
testjags(jags=runjags.getOption('jagspath')) # replace jagspath by the PATH to JAGS
# FOR INSTANCE, on the current machine I do:
testjags(jags=runjags.getOption('C:/Program Files/JAGS/JAGS-4.3.0/x64/bin/jags-terminal.exe'))
C++ is used for running simulations. In R, you should not have issue with C++ requirement since it is very well integrated (many R functions are simple interfaces to C++ functions).
For now, we do not have any trouble reported on this use. But feel free to report if there is one: New Issue for morse R package
library(morse)
data("propiconazole")
= survData(propiconazole)
survData_PRZ = survFit(survData_PRZ, model_type = "SD") fit_cstSD
library(morse)
data("propiconazole")
= survData(propiconazole)
survData_PRZ = survFit(survData_PRZ, model_type = "SD")
fit_cstSD plot(fit_cstSD)
library(morse)
data("propiconazole")
= survData(propiconazole)
survData_PRZ = survFit(survData_PRZ, model_type = "SD")
fit_cstSD LCx(fit_cstSD, X = 50)
library(morse)
data("propiconazole")
= survData(propiconazole)
survData_PRZ = survFit(survData_PRZ, model_type = "SD")
fit_cstSD = LCx(fit_cstSD, X = 50)
LCX_cstSD plot(LCX_cstSD)
library(morse)
data("propiconazole")
= survData(propiconazole)
survData_PRZ = survFit(survData_PRZ, model_type = "SD")
fit_cstSD <- data.frame(time = 1:10,
data_4MFx conc = c(0,0.5,8,3,0,0,0.5,8,3.5,0))
<- MFx(object = fit_cstSD, data_predict = data_4MFx, ode = TRUE) MFx_PRZ_cstSD
library(morse)
data("propiconazole")
= survData(propiconazole)
survData_PRZ = survFit(survData_PRZ, model_type = "SD")
fit_cstSD <- data.frame(time = 1:10,
data_4MFx conc = c(0,0.5,8,3,0,0,0.5,8,3.5,0))
<- MFx(object = fit_cstSD, data_predict = data_4MFx, ode = TRUE)
MFx_PRZ_cstSD plot(MFx_PRZ_cstSD)
library(morse)
data("propiconazole")
= survData(propiconazole)
survData_PRZ = survFit(survData_PRZ, model_type = "SD")
fit_cstSD <- data.frame(
data_example time = c(1,1.9,2,15,15.1,20),
conc = c(0,0,20,20,0,0),
replicate = rep("example", 6)
)= predict_ode(
predict_example_NULL object = fit_cstSD,
data_predict = data_example,
mcmc_size = 10,
interpolate_length = NULL)
with few exposure profile time points:
plot(predict_example_NULL)
test option interpolate_length
= predict_ode(
predict_example_100 object = fit_cstSD,
data_predict = data_example,
mcmc_size = 10,
interpolate_length = 100)
plot(predict_example_100)
and with a very detailed exposure profile
data("FOCUSprofile")
= predict_ode(
predict_FOCUS object = fit_cstSD,
data_predict = FOCUSprofile,
mcmc_size = 10,
interpolate_length = NULL)
plot(predict_FOCUS)
library(morse)
data("propiconazole")
= survData(propiconazole)
survData_PRZ = survFit(survData_PRZ, model_type = "SD")
fit_cstSD data("propiconazole_pulse_exposure")
= predict_Nsurv_ode(
predict_Nsurv object = fit_cstSD,
data_predict = propiconazole_pulse_exposure
)
library(morse)
data("propiconazole")
= survData(propiconazole)
survData_PRZ = survFit(survData_PRZ, model_type = "SD")
fit_cstSD data("propiconazole_pulse_exposure")
= predict_Nsurv_ode(
predict_Nsurv object = fit_cstSD,
data_predict = propiconazole_pulse_exposure
)plot(predict_Nsurv)