StepSDE(smfsb)
StepSDE()所属R语言包:smfsb
Create a function for advancing the state of an SDE model by using a simple Euler-Maruyama integration method
通过使用一个简单的欧拉 - 丸山集成方法创建一个函数,为推动国家的SDE模型
译者:生物统计家园网 机器人LoveR
描述----------Description----------
This function creates a function for advancing the state of an SDE model using a simple Euler-Maruyama integration method. The resulting function (closure) can be used in conjunction with other functions (such as simTs) for simulating realisations of SDE models.
这个函数创建一个函数使用一个简单的欧拉 - 丸山集成方法,为推进国家的SDE模型。可用于结合其他功能(如simTs)SDE模型来模拟实现的功能(关闭)。
用法----------Usage----------
StepSDE(drift,diffusion,dt=0.01)
参数----------Arguments----------
参数:drift
A function representing the drift vector of the SDE model (corresponding roughly to the RHS of an ODE model). drift should have prototype drift(x,t,...), with x representing current system state and t representing current system time. The value of the function should be a vector of the same dimension as x, representing the infinitesimal mean of the Ito SDE.
的的漂移向量的SDE模型(大体相当于一个ODE模型的RHS)的功能。 drift应该有原型drift(x,t,...),与x表示当前系统状态和t表示当前系统时间。函数的值应该是相同的尺寸x的向量,较伊藤SDE的无穷小的平均。
参数:diffusion
A function representing the diffusion matrix of the SDE model (the square root of the infinitesimal variance matrix). diffusion should have prototype diffusion(x,t,...), with x representing current system state and t representing current system time. The value of the function should be a square matrix with both dimensions the same as the length of x.
函数代表的SDE模型(无限小方差矩阵的平方根)的扩散基质。 diffusion应该有原型diffusion(x,t,...),与x表示当前系统状态和t表示当前系统时间。该函数的值应该是两个维度的长度相同x的正方形矩阵。
参数:dt
Time step to be used by the simple Euler-Maruyama integration method. Defaults to 0.01.
时间步骤,以用于通过简单的欧拉丸山集成方法。默认值为0.01。
值----------Value----------
参见----------See Also----------
StepEuler, StepCLE, simTs, simSample
StepEuler,StepCLE,simTs,simSample
实例----------Examples----------
# Immigration-death diffusion approx with death rate a CIR process[移民死亡的扩散,死亡率一个CIR过程大约]
myDrift <- function(x,t,th=c(lambda=1,alpha=1,mu=0.1,sigma=0.1))
{
with(as.list(c(x,th)),{
c( lambda - x*y ,
alpha*(mu-y) )
})
}
myDiffusion <- function(x,t,th=c(lambda=1,alpha=1,mu=0.1,sigma=0.1))
{
with(as.list(c(x,th)),{
matrix(c( sqrt(lambda + x*y) , 0,
0, sigma*sqrt(y) ),ncol=2,nrow=2,byrow=TRUE)
})
}
# create a stepping function[创建一个步进功能]
stepProc = StepSDE(myDrift,myDiffusion)
# integrate the process and plot it[整合的过程,并绘制]
out = simTs(c(x=5,y=0.1),0,20,0.1,stepProc)
plot(out)
转载请注明:出自 生物统计家园网(http://www.biostatistic.net)。
注:
注1:为了方便大家学习,本文档为生物统计家园网机器人LoveR翻译而成,仅供个人R语言学习参考使用,生物统计家园保留版权。
注2:由于是机器人自动翻译,难免有不准确之处,使用时仔细对照中、英文内容进行反复理解,可以帮助R语言的学习。
注3:如遇到不准确之处,请在本贴的后面进行回帖,我们会逐渐进行修订。
|