Description Usage Arguments Value Note Author(s) See Also Examples
The system of ODEs is solved subject to initial conditions and the estimates of the mean, the variance, the macroscopic equations and the transition density are returned.
1 2 3 4 |
initdata |
A numerical vector indicating the initial point. It is unscaled, e.g. expressed as number of molecules. |
edata |
Optional, a numerical vector indicating the ending point. It also is unscaled, e.g. expressed as number of molecules. |
tstart |
The starting time, defaults to 0. |
tend |
Either a vector or a scalar with the time-points to be estimated. |
initode |
Optional, the initial values of the macroscopic ODEs, defaults to
the scaled |
initmean |
A numerical vector indicating the initial values for the means. Defaults to a vector of zeroes, otherwise it is expected to be scaled by the inverse of the square root of the system size. |
initvar |
Either a matrix indicating the initial Variance-Covariance matrix or a vector representing the upper diagonal (including the main diagonal) following a row orientation. Defaults to a matrix of zeroes and is expected to be on the scale of macroscopic ODEs. |
thetas |
A numerical vector with the parameter values. |
relerr |
Numerical, the relative error for the numerical ordinary differential equations (ODEs) solver. |
abserr |
Numerical, the absolute error for the numerical ordinary differential equations (ODEs) solver. |
logprob |
Boolean, indicate if the log of the probability should be returned. |
syssize |
Numerical, indicating the system size. |
dfunction |
The compiled function, given as a loaded dynamic library
in R or as a character string of the symbol's name (similar to the
|
A list of the following components, estimated at each tend
time-point:
Time |
The time instance of the estimates. |
ODE |
The value of the ODE equation (the macroscopic model), expressed in concentration. |
MEAN |
The mean of the SDE process, expressed in mesoscopic units (multiply by sqrt(system size) to convert to original units). |
VAR |
The covariance of the SDE process (multiply by system size to convert to original units). |
prob |
Optional, expresses the estimated transition probability
density, available only if |
All densities are conditioned on the initial time-point
tstart
. The MEAN
and VAR
elements are not
at the same scale but they depend on the scale of the initial
values. We assume that the initial values are given as number of
molecules.
Vasileios Giagos
The model parsing is described in parsemod
.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 | ## Not run:
require(lnar)
##We consider the Lotka-Volterra Model
tt <- matrix(c(1,-1,0,0,1,-1),nrow=2,ncol=3,byrow=TRUE)
rfun <- c("con1 * Prey","con2 * Prey * Predator","con3 * Predator")
thetas <- paste("con",1:3,sep="")
species <- c("Prey","Predator")
cout <- parsemod(tt,rfun,thetas,species) #Parse the model
##Inputs a dataset
initdata<-c(50.0, 30)
data2<-c(51, 28)
compmod(cout,"derivs") #Compile the model
##Test that derivs is working.
derivs(1,c(initdata[1],initdata[2],c(0,0,0,0,0)),
rep(0,7),c(.1,.0001,.1))
syssize=sum(initdata)
thetas <- c(0.25,0.20,0.125) #scaled kinetic constants
##Calculate Transition Density
(calc1<-calcdens(initdata,data2,tstar=0,tend=.1,
thetas=thetas,
syssize=syssize,
dfunction=derivs))
##Test:
log(calc1[[1]]$prob) # -4.835931
##Calculate the trans. dens. parameters in some time points
(calc2<-calcdens(initdata,tstar=0,tend=c(.1,.5,3),
thetas=thetas,
syssize=syssize,
dfunction=derivs))
## End(Not run)
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.