楼主: 蔡小虎670
1873 2

[金融学] 求助一道马尔科夫链的习题 [推广有奖]

  • 0关注
  • 0粉丝

初中生

95%

还不是VIP/贵宾

-

威望
0
论坛币
39 个
通用积分
0
学术水平
0 点
热心指数
0 点
信用等级
0 点
经验
784 点
帖子
9
精华
0
在线时间
32 小时
注册时间
2017-5-14
最后登录
2024-3-30

楼主
蔡小虎670 发表于 2018-11-5 18:26:58 来自手机 |只看作者 |坛友微信交流群|倒序 |AI写论文
100论坛币
Ona4x4board,eachcellhasonemouseattime0.Eachsecond,themicewill
jumprandomlyintoaneighboringcell.Compute:
a)Theexpectednumberofemptycellsattime1.
b)Thestationarydistributionofnumberofemptycellsattimeinfinity.(Hint:usesimulation)
c)Theexpectednumberofemptycellsattimeinfinity(Youcanusesimulation).

关键词:马尔科夫链 马尔科夫 马尔科 distribution Simulation
沙发
zhangRands 发表于 2018-11-6 17:24:16 |只看作者 |坛友微信交流群
不会,帮你加了空格,让别人看看吧。

On a 4x4 board,each cell has one mouse at time 0.Each second,the mice will jump randomly into a neighboring cell.Compute:
a)The expected number ofempty cells at time 1.
b)The stationary distribution of number of empty cells at time infinity. (Hint:use simulation)
c)The expected number of empty cells at time infinity(You can use simulation).


已有 1 人评分论坛币 收起 理由
admin_kefu + 20 热心帮助其他会员

总评分: 论坛币 + 20   查看全部评分

使用道具

藤椅
xiawei918 发表于 2018-11-9 11:27:51 |只看作者 |坛友微信交流群
这题要好好做还是要花一点时间,我只做第一问,后面的你自己再加一点就好了。
先上第一问的答案
Let $X_{ij}$ be a Bernoulli random variable where
\begin{align*}
x_{ij} = \begin{cases} 1 \text{ if cell $(i,j)$ is empty at time 1}\\ 0 \text{ if cell $(i,j)$ is nonempty at time 1, }\end{cases}
\end{align*}
then we know that $E[X_{ij}] = p_{ij}$, where $p_{ij}$ is the probability that cell $(i,j)$ is empty at time 1.

There are 3 types of cells: Cell with 2 neighbors (corner cells: (0,0),(0,3),(3,0),(3,3))
\begin{align*}
p_{00} &= P(\text{mouse in cell (0,1) does not jump to (0,0)})\times P(\text{mouse in cell (1,0) does not jump to (0,0)})\\
&= \frac{2}{3}\times \frac{2}{3} = \frac{4}{9}.
\end{align*}
So by similar reasoning we have
\begin{align*}
p_{30}  = \frac{4}{9},\quad p_{03}  = \frac{4}{9},\quad p_{33}  = \frac{4}{9}.
\end{align*}
Cell with 3 neighbors (boarder cells: (0,1)(0,2),(1,0),(2,0),(3,1)(3,2),(1,3),(2,3))
\begin{align*}
p_{01} =& P(\text{mouse in cell (0,0) does not jump to (0,1)})\times P(\text{mouse in cell (1,1) does not jump to (0,1)})\\ &\times P(\text{mouse in cell (0,2) does not jump to (0,1)})\\
=& \frac{1}{2}\times \frac{3}{4}\times \frac{2}{3} = \frac{1}{4}.
\end{align*}
So by similar reasoning we have
\begin{align*}
p_{01}  = p_{02} = p_{10} = p_{20} = p_{31} = p_{31} = p_{13} = p_{23}  = \frac{1}{4}.
\end{align*}
Cell with 4 neighbors (boarder cells: (1,1)(1,2),(2,1),(2,2))
\begin{align*}
p_{01} =& P(\text{mouse in cell (0,1) does not jump to (1,1)})\times P(\text{mouse in cell (1,0) does not jump to (1,1)})\\ &\times P(\text{mouse in cell (1,2) does not jump to (1,1)})\times P(\text{mouse in cell (2,1) does not jump to (1,1)})\\
=& \frac{2}{3}\times \frac{2}{3}\times \frac{3}{4}\times \frac{3}{4} = \frac{1}{4}.
\end{align*}
So by similar reasoning we have
\begin{align*}
p_{11}  = p_{12} = p_{21} = p_{22} = \frac{1}{4}.
\end{align*}

Now, let $Y$ be the random variable of the number of empty cells at time 1, then we have
\begin{align*}
E[Y] = E\left[\sum\limits_{i=0}^3\sum\limits_{j=0}^3X_{ij}\right] = \sum\limits_{i=0}^3\sum\limits_{j=0}^3E[X_{ij}] = \sum\limits_{i=0}^3\sum\limits_{j=0}^3p_{ij} = \frac{43}{9} \approx 4.78.
\end{align*}

再给你贴一段验证第一问答案的代码
  1. import random

  2. possible_moves = [[-1, 0], [1, 0], [0, -1], [0, 1]]


  3. def is_valid(i, j):
  4.     return i >= 0 and i <= 3 and j >= 0 and j <= 3


  5. def moves(i, j):
  6.     res = []
  7.     for k in possible_moves:
  8.         s, t = k
  9.         if is_valid(i + s, t + j):
  10.             res.append([i + s, t + j])
  11.     return res


  12. def print_board(a):
  13.     for i in range(len(a)):
  14.         print
  15.         for j in range(len(a[0])):
  16.             print a[i][j],
  17.     print
  18.     print


  19. def count_zeros(a):
  20.     res = 0
  21.     for i in range(len(a)):
  22.         for j in range(len(a[0])):

  23.             if a[i][j] == 0:
  24.                 res += 1
  25.     return res


  26. total_zeros = 0
  27. experiment = 10000
  28. for k in range(experiment):
  29.     a = [[1, 1, 1, 1], [1, 1, 1, 1], [1, 1, 1, 1], [1, 1, 1, 1]]
  30.     print_board(a)

  31.     for i in range(4):
  32.         for j in range(4):
  33.             moves_set = moves(i, j)

  34.             b = random.randint(0, len(moves_set) - 1)

  35.             a[i][j] -= 1
  36.             m_a, m_b = moves_set[b]
  37.             a[m_a][m_b] += 1

  38.     # print_board(a)
  39.     # print count_zeros(a)
  40.     total_zeros += count_zeros(a)
  41. print total_zeros
  42. print total_zeros / float(experiment)
复制代码


实验10000次得到的第一问的答案是4.7732.
第二三问都需要simulation了,在我贴的代码基础上再加改进就好。
已有 1 人评分论坛币 学术水平 热心指数 信用等级 收起 理由
admin_kefu + 50 + 2 + 2 + 2 热心帮助其他会员

总评分: 论坛币 + 50  学术水平 + 2  热心指数 + 2  信用等级 + 2   查看全部评分

使用道具

您需要登录后才可以回帖 登录 | 我要注册

本版微信群
加JingGuanBbs
拉您进交流群

京ICP备16021002-2号 京B2-20170662号 京公网安备 11010802022788号 论坛法律顾问:王进律师 知识产权保护声明   免责及隐私声明

GMT+8, 2024-11-6 08:08