11.1

It is raining in the Land of Oz. Determine a tree and a tree measure for thenext three days’ weather. Find w(1), w(2), and w(3) and compare with theresults obtained from P, P2, and P3.

require(markovchain)
## Loading required package: markovchain
## Package:  markovchain
## Version:  0.6.9.8-1
## Date:     2017-08-15
## BugReport: http://github.com/spedygiorgio/markovchain/issues
weatherStates <- c("Rain", "Nice", "Snow")
byRow <- TRUE
weatherMatrix <- matrix(data = c(0.5, 0.25, 0.25,
                                  0.5, 0.0, 0.5,
                                  0.25, 0.25, 0.5), byrow = byRow, nrow = 3,
                        dimnames = list(weatherStates, weatherStates))
mcWeather <- new("markovchain", states = weatherStates, byrow = byRow, transitionMatrix = weatherMatrix, name = "Weather")

initialState<- c(1,0,0)
day_one <- initialState * mcWeather
day_two <-initialState* (mcWeather*mcWeather)
day_three <-  initialState * (mcWeather^3)

Day One: 0.5, 0.25, 0.25
P1 from Book

The computed probblities agree with theprbabilites in row one of P1

Day Two: 0.4375, 0.1875, 0.375
P2 from Book

The computed probblities agree with theprbabilites in row one of P2

Day Three: 0.40625, 0.203125, 0.390625
P3 from Book

The computed probblities agree with theprbabilites in row one of P3