问题标签 [stochastic-process]

For questions regarding programming in ECMAScript (JavaScript/JS) and its various dialects/implementations (excluding ActionScript). Note JavaScript is NOT the same as Java! Please include all relevant tags on your question; e.g., [node.js], [jquery], [json], [reactjs], [angular], [ember.js], [vue.js], [typescript], [svelte], etc.

0 投票
8 回答
31144 浏览

c++ - 如何生成泊松过程?

原始问题:

我想生成一个泊松过程。如果时间t的到达次数为N(t)并且我有一个参数为 λ的泊松分布,我如何生成N(t)?我将如何在 C++ 中做到这一点?

澄清:

我最初想使用泊松分布生成该过程。但是,我对我需要的过程参数感到困惑;我以为我可以使用N(t)但这告诉我在间隔(0,t]上发生了多少次到达,这不是我想要的。所以,然后我想我可以使用N(t2)-N(t1 )来获取区间[t1,t2]上的到达次数。由于N(t)~Poisson(tx λ)我可以使用Poisson(t2 x λ)-Poisson(t1 x λ)但我不想要区间内到达的次数。

相反,我想生成到达发生的明确时间。

我可以通过使间隔[t2,t1]足够小来做到这一点,以便每个间隔只有一次到达(发生为|t2-t1| -> 0)。

0 投票
5 回答
3401 浏览

python - python中的随机微积分库

我正在寻找一个 python 库,它可以让我计算随机微积分的东西,比如我定义扩散的随机过程的(条件)期望。我看了一下 simpy (simpy.sourceforge.net),但它似乎不能满足我的需求。

这是为了快速原型设计和实验。在 java 中,我成功地使用了(现在不活动的)http://martingale.berlios.de/Martingale.html库。

这个问题本身并不难,但是有很多不平凡的样板工作要做(有效的内存使用,变量减少技术等)。

理想情况下,我可以写出这样的东西(只是说明性的):

例如,除了在 numpy 中重新实现它之外,还有其他人知道吗?

0 投票
5 回答
1675 浏览

unit-testing - 随机过程的单元测试?

有没有一种健全的方法来对随机过程进行单元测试?例如,假设您已经为特定系统模型编写了模拟器。模拟器根据 rngs 的种子随机工作,因此无法预测系统的状态,如果可以,则每次测试都应在尝试测试类的任何方法之前将系统置于特定状态。有一个更好的方法吗?

0 投票
4 回答
2176 浏览

algorithm - 在无限一维图中找到洞的算法

一头牛站在无限的栅栏前。另一边是草。母牛想要到达这片草地。沿着这个栅栏的某个地方有一个洞,牛可以通过这个洞到达另一边。从牛到洞的距离 d 具有与之相关的概率分布 f(d),即洞距离牛 k 步的概率由 f(k) 给出。请注意,我们认为所有距离都是离散的,即它们始终以奶牛所走的步数来衡量。奶牛可以走负整数步数以及正整数步数,即分别向左走 k 步和向右走 k 步。此外,我们知道 ∑(k=-∞)^∞|k|⋅f(k)<∞。我们想描述一种可以找到概率为 1 的洞的算法。

问题 1 算法能够以概率 1 找到洞的充分条件是什么?问题 2 描述这样一个算法。

0 投票
2 回答
9387 浏览

r - 使用 R 生成泊松过程

我想生成一个过程,其中每一步都有一个泊松随机变量的实现,这个实现应该被保存,然后它应该实现下一个泊松随机变量并将其添加到之前所有实现的总和中。此外,应该有机会在每个步骤中停止此过程。希望这对你们有意义......任何想法表示赞赏!

0 投票
1 回答
2064 浏览

matlab - How to add white noise process term for a couple of ODEs, assuming the Gaussian distribution?

This question has already confused me several days. While I referred to senior students, they also cannot give a reply.

We have ten ODEs, into which each a noise term should be added. The noise is defined as follows. since I always find that I cannot upload a picture, the formula below maybe not very clear. In order to understand, you can either read my explanation or go the this address: Plos one. You could find the description of the equations directly above the Support Information in this address

  1. The white noise term epislon_i(t) is assumed with Gaussian distribution. epislon_i(t) means that for equation i, and at t timepoint, the value of the noise.
  2. the auto-correlation of noise are given:

(EQ.1) eq1

where delta(t) is the Dirac delta function and the diffusion matrix D is defined by

(EQ.2) eq2

Our problem focuses on how to explain the Dirac delta function in the diffusion matrix. Since the property of Dirac delta function is delta(0) = Inf and delta(t) = 0 if t neq 0, we don't know how to calculate the epislonif we try to sqrt of 2D(x, t)delta(t-t'). So we simply assume that delta(0) = 1 and delta(t) = 0 if t neq 0; But we don't know whether or not this is right. Could you please tell me how to use Delta function of diffusion equation in MATLAB?

This question associates with the stochastic process in MATLAB. So we review different stochastic process to inspire our ideas. In MATLAB, the Wienner process is often defined as a = sqrt(dt) * rand(1, N). N is the number of steps, dt is the length of the steps. Correspondingly, the Brownian motion can be defined as: b = cumsum(a); All of these associate with stochastic process. However, they doesn't related to the white noise process which has a constraints on the matrix of auto-correlation, noted by D.

Then we consider that, we may simply use randn(1, 10) to generate a vector representing the noise. However, since the definition of the noise must satisfy the equation (2), this cannot enable noise term in different equation have the predefined partial correlation (D_ij). Then we try to use mvnrnd to generate a multiple variable normal distribution at each time step. Unfortunately, the function mvnrnd in MATLAB return a matrix. But we need to return a vector of length 10.

We are rather confused, so could you please give me just a light? Thanks so much!

0 投票
1 回答
275 浏览

stochastic-process - 布朗运动的打击时间是否独立

假设$B_t$ 是一个标准的布朗运动。$T_a$ $T_b$ 是击球时间,而 $a<0$, $b>0$。那么这两个随机变量是独立的吗?

0 投票
2 回答
2377 浏览

statistics - 预测泊松过程

我想用泊松分布预测道路交通的到达间隔时间。目前,我使用泊松过程产生(合成)到达时间,以便到达间隔时间呈指数分布。

观察过去的数据,我想预测下一个/未来的到达间隔时间。为此,我想实现一个学习算法。

我使用了各种方法,例如贝叶斯预测器(最大后验)和多层神经网络。在这两种方法中,我都使用输入特征的一定长度n的移动窗口(到达间隔时间)。

在贝叶斯预测器中,我使用到达间隔时间作为二元特征(1->long,0->short 来预测下一个到达间隔时间是long还是short),而对于n 个神经元输入层的神经网络和m - 神经元隐藏层(n=13, m=20),我输入n 个之前的到达间隔时间并生成未来估计的到达时间(权重是阈值,由反向传播算法更新)。

贝叶斯方法的问题在于,如果的到达间隔时间的数量高于的数量,它就会变得有偏差。因此,它永远不会预测空闲期(因为short的后验总是保持较大。而在多层神经预测器中,预测精度不够。特别是对于较高的到达间隔时间,预测精度急剧下降。

我的问题是“随机过程(泊松)不能准确预测吗?还是我的方法不正确?” . 任何帮助将不胜感激。

0 投票
11 回答
19535 浏览

algorithm - 是否有已知的技术可以生成逼真的假股票数据?

我最近编写了一些 Javascript 代码来生成随机的虚假股票数据,因为我想展示一个乍看之下看起来像真实股票数据的图表 - 但我想出的只是点头。我只是想知道是否有一些资源可以解释如何“正确”完成此操作,即您可以获得与真实股票数据具有相同模式的逼真数据?

0 投票
2 回答
449 浏览

shared-ptr - boost::shared_ptr / QuantLib / 随机过程 / 路径生成

祝大家节日快乐!

我正在尝试使用 QuantLib/Boost C++ 库生成平方根进程的路径,并且遇到了一个我认为是一个快速简单的解决方案的恼人的小问题!我对编程很陌生,所以请不要对我太苛刻 :) 这是我所知道的: 1. 构造函数如下所示:

SquareRootProcess( Real b, Real a, Volatility sigma, Real x0 = 0.0, const boost::shared_ptr<discretization>& d = boost::shared_ptr<discretization>(new EulerDiscretization))

  1. 使用 QuantLib 模拟随机过程时要使用的关键函数是 Evolution(t,x,dt,dw)。

  2. 这是我的代码的样子:

    `


编译/运行代码时我没有收到任何错误,但结果是一个常量值,即明显有问题。我认为问题在于我定义随机过程的方式,我不太清楚如何用 boost::shared_ptr 解释构造函数的最后一部分。

我很高兴听到任何建议和提示,并感谢您花时间阅读我的问题!

此致 :)