Observable Markov Model
Given the observable Markov Model with three states, S1, S2, S3,
initial probabilities \pi = [0.5, 0.2, 0.3]^T
and transition probabilities
A = [0.4 0.3 0.3
0.2 0.6 0.2
0.1 0.1 0.8]
write a code that generates
i) 20 sequences of 100 states,
ii) 20 sequences of 1000 states,
iii) 100 sequences of 100 states,
iv) 100 sequences of 1000 states.
Java or R implementation
/*
* To change this template, choose Tools | Templates
* and open the template in the editor.
*/
/**
*
* @author RAM
*/
import java.text.*;
import java.util.*;
class Observable {
// State names and state-to-state transition probabilities
int nstate; // number of states (incl initial state)
String[] state; // names of the states
double[][] loga;
// Emission names and emission probabilities
int nesym; // number of emission symbols
String esym;
double[][] loge; // loge[k][ei] = log(P(emit ei in state k))
// Input:
// state = array of state names (except initial state)
// amat = matrix of transition probabilities (except initial state)
// esym = string of emission names
// emat = matrix of emission probabilities
public Observable(String[] state, double[][] amat,
String esym, double[][] emat) {
if (state.length != amat.length)
throw new IllegalArgumentException("Observable: state and amat disagree");
if (amat.length != emat.length)
throw new IllegalArgumentException("Observable: amat and emat disagree");
for (int i=0; i<amat.length; i++) {
if (state.length != amat[i].length)
throw new IllegalArgumentException("Observable: amat non-square");
if (esym.length() != emat[i].length)
throw new IllegalArgumentException("Observable: esym and emat disagree");
}
// Set up the transition matrix
nstate = state.length + 1;
this.state = new String[nstate];
loga = new double[nstate][nstate];
this.state[0] = "S1"; // initial state
loga[0][0] = Double.NEGATIVE_INFINITY; // = log(0)
double fromstart = Math.log(1.0/state.length);
for (int j=1; j<nstate; j++)
loga[0][j] = fromstart;
for (int i=1; i<nstate; i++) {
// Reverse state names for efficient backwards concatenation
this.state[i] = new StringBuffer(state[i-1]).reverse().toString();
loga[i][0] = Double.NEGATIVE_INFINITY; // = log(0)
for (int j=1; j<nstate; j++)
loga[i][j] = Math.log(amat[i-1][j-1]);
}
}
}
class MarklovState {
public static void main(String[] args) {
dice();
}
static void dice() {
String[] state = { "S1", "S2","S3" };
double[][] aprob = { { 0.4, 0.3,0.3},
{ 0.2,0.6,0.2 },
{0.1,0.1,0.8}
};
String esym = "20";
double[][] eprob = { { 0.5,0.2,0.3}};
Observable Observable = new Observable(state, aprob, esym, eprob);
}
}
Observable Markov Model Given the observable Markov Model with three states, S1, S2, S3, initial probabilities...
(MATLAB Question) Assume s1 = sin(2*(pi)*f1*t), s2 = sin(2*(pi)*f2*t + 0.4) and s3 = s1 + s2, where f1 = 0.2 and f2 = 0.425. Plot s1, s2 and s3 vs t with t=0:0.1:10 on the same graph (you have to use hold on command). Label the axes and create legends for each graph.
Three decision makers have assessed payoffs for the following decision problem (payoff in dollars). Decision Alternative State of Nature s1 s2 s3 d1 15 40 –20 d2 60 80 –80 The indifference probabilities are as follows: Indifference Probability (p) Payoff Decision Maker A Decision Maker B Decision Maker C 80 Does not apply Does not apply Does not apply 60 0.7 0.95 0.85 40 0.5 0.9 0.7 15 0.3 0.8 0.55 –20 0.15 0.6 0.35 –80...
An absorbing Markov Chain has 5 states where states #1 and #2 are absorbing states and the following transition probabilities are known: p3,2=0.1, p3, 3=0.4, p3,5=0.5 p4,1=0.1, p4,3=0.5, p4,4=0.4 p5,1=0.3, p5,2=0.2, p5,4=0.3, p5,5 = 0.2 (a) Let T denote the transition matrix. Compute T3. Find the probability that if you start in state #3 you will be in state #5 after 3 steps. (b) Compute the matrix N = (I - Q)-1. Find the expected value for the number of...
your initial probabilities of S1 and S2 are 0.7 and 0.3. track
record is p(f|s1)=0.9 and p(f|s2)=0.05. compute p(s1|f), p(s2|f),
p(s1|u), p(s2|u), p(f) and p(u)
Profit Payoff 0.85 2650(+5) Build Complex IF6 一 0.15 650 C1s) Favorable report issued P(F) 0.60 Sell IF 1150 Market Research 0.20 2650 Build Complex | U 0.80 650 Unfavorable report issued P(U)-040E Sell IU 1150 2650 S1 0.6 Build Comple 8S2 650 0.4 No Market Research 1150 Sell
Profit Payoff 0.85 2650(+5) Build Complex...
For the next three problems, consider a Markov chain (Xn n2o with three states 1,2,3: 「0.5 0.3 0.2 P 0.1 0.4 0.5 0 0.2 0.8 ANDREY SARANTSEV Problem 11.24. Calculate the probability P(X2X 1) Problem 11.25. For the initial distribution x(0) 10.6, 0.1,이, find the distribution of Xi Problem 11.26. Find the stationary distribution
3. [20 Points] Assume that we have the Hidden Markov Model (HMM) depicted in the figure below [4 Points] If each of the states can take on k different values and a total of m a. possible (across all states), how many parameters are different observations are required to fully define this HMM? Justify your answer b. [4 Points] What conditional independences hold in this HMM? Justify your answer [12 Points] Suppose that we have binary states (labeled A and...
Problem 13-01 (Algorithmic) The following payoff table shows profit for a decision analysis problem with two decision alternatives and three states of nature: State of Nature Decision Alternative 210 130 75 130 280 75 a. Choose the correct decision tree for this problem 210 210 di S1 S1 280 280 130 130 S2 130 130 d2 d2 75 75 di S3 75 (iv) 130 210 S2 210 di S1 130 75 S2 130 210 210 S1 di $1 130 75...
1. Let {Xt,t 0,1,2,...J be a Markov chain with three states (S 1,2,3]), initial distribution (0.2,0.3,0.5) and transition probability matrix P0.5 0.3 0.2 0 0.8 0.2 (a) Find P(Xt+2 1, Xt+1-2Xt 3) (b) Find the two step transition probability matrix P2) and specifically (e) Find P(X2-1 (d) Find EXi.
Given the finite state machine: (c) 0,0 1,1 So Start S1 1,1 0,0 0,0 1,0 S2 S3 0,0 (i) Determine the transition table associated with the given state machine above (10/100) (ii) Write the simplest phrase structure grammar, G=(V,T,S,P), for the machine in 4(c)(i) (10/100) (iii Rewrite the grammar you found in 4(c)(ii) in BNF notation. (10/100) (iv) Determine the output for input string 1111, of the finite state machine in 4(c)i) (10/100)
Given the finite state machine: (c) 0,0...
An oil company has to transport oil products from three sites (S1, S2, S3), through two refineries (R1, R2) and finally to three markets (C1, C2, C3). The supply(in 1,000 barrels per day) are given in Table 1. Table 1. (Site supply) Site Supply S1 1,500 S2 750 S3 1,200 Table 2 below shows the costs in $1,000 of transporting 1,000 barrels of crude oil between sites and refineries. It also has the costs of refining 1,000 barrels of crude...