As you pointed out, to sample individual entries of the transition matrix independently from normal distribution is problematic as row sums can be larger than one.
One way is to run markovchainFit
with bootstrap
method toTo stochastically generate multiplea transition matrix, whichwe can be useduse bootstrap
method provided in simulationmarkovchainFit
.
B <- markovchainFit(data=c(A[1,], NA, A[2,], NA, A[3,], NA, A[4,], NA, A[5,]),
name="weather",
method='bootstrap',
nboot=1000) #number of models generated
#Check the row sums are indeed 1s
rowSums(B$bootStrapSamples[[1]])
#cloudy rain sunny
# 1 1 1
So, to simulate with both (1) and (2) uncertainties, we may first sample a transition matrix from normal distribution with mean
andbootstrapping SE
provided by the modelnormal distribution with . ThenAnd followed by your method for random Markov chain sampling.mean
and SE
provided by the model