# Sheldon Ross 10: Example 4.01 (Forecasting the Weather) Question: Suppose that the chance of rain tomorrow depends on previous weather conditions only through whether or not it is raining today and not on past weather conditions. Suppose also that if it rains today, then it will rain tomorrow with probability a; and if it does not rain today, then it will rain tomorrow with probability ß. If we say that the process is in state 0 when it rains and state 1 when it does not rain, then the preceding is a two-state Markov chain whose transition probabilities are given by

 α 1 – α β 1 – β

Note: The above is a matrix but the default formatting on this site puts lines at the bottom of each of the row

Analytical Solution

N/A

Simulation Solution

Since the above is simply a demonstration of how one can represent a Markov Chain, we will run a simple simulation with some sample probabilities and look at how the states of the system look like in the long run. Code

```Table[Module[{matrix = {{\[Alpha], 1 - \[Alpha]}, {\[Beta],
1 - \[Beta]}}, data, iterations = 10000, \[ScriptCapitalP]},
\[ScriptCapitalP] = DiscreteMarkovProcess[{0, 1}, matrix];
data =
KeySort@Counts[
RandomFunction[\[ScriptCapitalP], {0, iterations}][[2, 1, 1]]];
BarChart[data, Frame -> True, ImageSize -> 199, AspectRatio -> 1,
PlotRange -> {Automatic, {0, iterations}},
ChartLabels ->
Placed[#@data & /@ {Values, Keys}, {Above, Bottom}],
Epilog ->
Text[Style[
"\[Alpha]="  ToString[\[Alpha]]  " & \[Beta]="
ToString[\[Beta]], 12], {1.5, 9750}]]
],
{\[Alpha], Range[0.2, 0.8, 0.2]}, {\[Beta], Range[0.2, 0.8, 0.2]}
] // Grid //
Labeled[#,
Rotate[Style["Number of iterations per Markov Chain: 10000", 14,
Red], 0], Top] &```

End of the post

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.