0

Weather is modelled as a Markov chain(first row corresponds to state $0$ (sunny), second row to state $1$(rainy)):

$$ \begin{bmatrix} 0.8 & 0.2 \\ 0.4 & 0.6 \end{bmatrix} $$

The problem is to find the average length of a rainy period. Now the hint given was to find: $$ \sum_{k=1}^\infty kP(X_{k}=0,X_{k-1}=1\dots,X_1=1|X_0=1) \\ =\sum_{k=1}^\infty k 0.4(0.6)^{k-1}\\ $$

I found this to be $2.5$. But I am not comfortable with that expression because it does not impose a restriction on the state of the chain before $X_0$. If the state were $1$, the length of this rainy period would be longer! So instead I evaluated this: $$ \sum_{k=1}^\infty kP(X_{k+1}=0,X_{k}=1\dots,X_1=1|X_0=0) \\ \sum_{k=1}^\infty k 0.4(0.6)^{k-1}0.2\\ $$ which is $0.5$.

But it cannot be 0.5 because the minimum length of rainy period is 1!

I simulated this process in MATLAB and the value seemed to be around $1.5$. (I will post my code if you think this is incorrect)

One other way to do this is to find the expected return time from state $0$ to $0$ and then subtract $1$. Because the return time is $\frac{1}{\frac{2}{3}} = 1.5$, this method gives me $0.5$.(see EDIT)

I am totally confused as to which is right and why the others are wrong.

Any help is greatly appreciated. Thanks.

EDIT: I just realised that the average return time method is wrong because going from state $0$ to $0$ is taken into account when calculating the average return time (in this case the return time is 1), but it should not appear in computing average rainy period as there is no rainy period in 2 consecutive sunny days.

EDIT: Here is the code I wrote to simulate the chain:


n = 10000;
P = [0.8 0.2;0.4 0.6];
mun = [0.9 0.1];
X = zeros(n+2,1);
for i=1:n
    t = rand;
    if t > mun(1)
        X(i+1) = 1;
    end
    mun = mun * P;
end
% find the starting and ending of rainy periods
A = find(diff(X));
% every even position in A has the end of a rainy period and every
% odd position has the start of a rainy period
rainyPeriods = A(2:2:end) - A(1:2:end);
mean(rainyPeriods)
Priyatham
  • 2,607
  • "it does not impose a restriction on the state of the chain before $X_0$. If the state were $1$, the length of this rainy period would be longer!" No, the length of the rainy period starting at time $0$ if $X_0=1$ is exactly the same whatever the state occupied before $X_0=1$ (and every other event before time $0$) is. This is the Markov property. – Did Jan 22 '16 at 07:21
  • The second computation is the length of a rainy period starting at time $1$ times the probability of a transition $0\to1$, that is, 20% of the desired result. The Matlab simulation should be expanded upon to see what is wrong with it. – Did Jan 22 '16 at 07:24
  • @Did, I understand that If the state before $X_0$ is $1$ or $0$ or anything the probability that $X_1$ is $1$ does not depend on it provided we know what $X_0$ is, which is actually the Markov property. But I don't get how it wont affect the length of rainy period. If $X_{-1}$ is one the length is actually $\geq k+1$ isn't it? – Priyatham Jan 22 '16 at 07:28
  • The thing is that $P(X_{n+1}=0,X_n=\ldots=X_1=1\mid X_0=1,X_{-1}=x_1,\ldots,X_{-n}=x_n)$ does not depend on $n$ or $(x_1,\ldots,x_n)$ and that all these are equal to $P(X_{n+1}=0,X_n=\ldots=X_1=1\mid X_0=1)$. Thus, no, $P(X_{n+1}=0,X_n=\ldots=X_1=1\mid X_0=1,X_{-1}=1)$ is no different from $P(X_{n+1}=0,X_n=\ldots=X_1=1\mid X_0=1)$. In your parlance, this does not affect the length of the remaining rainy period. In the end, (Markov property) implies (geometric distributions) and (loss of memory). – Did Jan 22 '16 at 09:54

0 Answers0