大数定理的MATLAB编程,强大数定律和弱大数定律的图示

In the following we're talking about a simple random walk,

$X_i=\pm 1$ with equal probability, and we are calculating running

averages,

\[

\frac{S_n}{n}=\frac{1}{n}\sum_{i=1}^{n}X_i, n=1,2,\ldots

\]

a4c26d1e5885305701be709a3d33442f.png

The SLLN (convergence almost surely) says that we can be 100% sure

that this curve stretching off to the right will eventually, at

some finite time, fall entirely within the bands forever afterward

(to the right).

The R code used to generate this graph is below (plot labels

omitted for brevity).

n

s

plot(s/seq.int(n), type = "l", ylim = c(-0.4, 0.4))

abline(h = c(-e,e), lty = 2)

a4c26d1e5885305701be709a3d33442f.png

The WLLN (convergence in probability) says that a large proportion

of the sample paths will be in the bands on the right-hand side, at

time n

n

(for the above it looks like around 48 or 9 out

of 50). We can never be sure that any particular curve will be

inside at any finite time, but looking at the mass of noodles above

it'd be a pretty safe bet. The WLLN also says that we can make the

proportion of noodles inside as close to 1 as we like by making the

plot sufficiently wide.

The R code for the graph follows (again, skipping labels).

x

m)

y

matplot(y, type = "l", ylim = c(-0.4,0.4))

abline(h = c(-e,e), lty = 2, lwd = 2)

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值