<< Chapter < Page | Chapter >> Page > |
There are three types. In all types, we need the following:
PX = PH*PXH
File dec.m
% file dec.m
% Version of 12/12/95disp('Decision process with experimentation')
disp('There are three types, according to the data provided.')disp('In all types, we need the row vector A of actions,')
disp('the row vector PH with PH(i) = P(H = u_i),')disp('the row vector X of test random variable values, and')
disp('the matrix PXH with PXH(i,j) = P(X = x_j|H = u_i).')disp('Type 1. Loss matrix L of L(a,k)')
disp(' Matrix PYH with PYH(i,k) = P(Y = y_k|H = u_i)')disp('Type 2. Matrix RH of r(a,i) = E[L(a,Y)|H = u_i].')disp(' L and PYH are not needed for this type.')
disp('Type 3. Y = H, so that only RH = L is needed.')c = input('Enter type number ');
A = input('Enter vector A of actions ');PH = input('Enter vector PH of parameter probabilities ');
PXH = input('Enter matrix PXH of conditional probabilities ');X = input('Enter vector X of test random variable values ');
s = length(PH);q = length(X);
if c == 1 L = input('Enter loss matrix L ');
PYH = input('Enter matrix PYH of conditional probabilities '); RH = L*PYH';
elseif c == 2 RH = input('Enter matrix RH of expected loss, given H ');
else L = input('Enter loss matrix L ');
RH = L;end
PX = PH*PXH; % (1 x s)(s x q) = (1 x q)[a,b] = meshgrid(PH,PX);PHX = PXH'.*a./b; % (q x s)
RX = RH*PHX'; % (m x s)(s x q) = (m x q)[RD D] = min(RX); % determines min of each col % and row on which min occurs
S = [X; A(D); RD]';
BD = RD*PX'; % Bayesian riskh = [' Optimum losses and actions'];
sh = [' Test value Action Loss'];
disp(' ')disp(h)
disp(sh)disp(S)
disp(' ')disp(['Bayesian risk B(d*) = ',num2str(BD),])
% file dec1.m
% Data for Problem 22-11type = 1;
A = [10 15]; % Artificial actions list
PH = [0.3 0.2 0.5]; % PH(i) = P(H = i)
PXH = [0.7 0.2 0.1; % PXH(i,j) = P(X = j|H= i) 0.2 0.6 0.2;
0.1 0.1 0.8];
X = [-1 0 1];
L = [1 0 -2; % L(a,k) = loss when action number is a, outcome is k 3 -1 -4];PYH = [0.5 0.3 0.2; % PYH(i,k) = P(Y = k|H = i)
0.2 0.5 0.3; 0.1 0.3 0.6];
dec1dec
Decision process with experimentationThere are three types, according to the data provided.
In all types, we need the row vector A of actions,the row vector PH with PH(i) = P(H = i),
the row vector X of test random variable values, andthe matrix PXH with PXH(i,j) = P(X = j|H = i).
Type 1. Loss matrix L of L(a,k) Matrix PYH with PYH(i,k) = P(Y = k|H = i)
Type 2. Matrix RH of r(a,i) = E[L(a,Y)|H = i].
L and PYH are not needed in this case.Type 3. Y = H, so that only RH = L is needed.
Enter type number typeEnter vector A of actions A
Enter vector PH of parameter probabilities PHEnter matrix PXH of conditional probabilities PXH
Enter vector X of test random variable values XEnter loss matrix L L
Enter matrix PYH of conditional probabilities PYH
Optimum losses and actions Test value Action Loss
-1.0000 15.0000 -0.2667 0 15.0000 -0.9913
1.0000 15.0000 -2.1106
Bayesian risk B(d*) = -1.3
Intermediate steps in solution of Example 1, to show results of various operations
RH
RH = 0.1000 -0.4000 -1.1000 0.4000 -1.1000 -2.4000
PXPX = 0.3000 0.2300 0.4700
aa = 0.3000 0.2000 0.5000
0.3000 0.2000 0.5000 0.3000 0.2000 0.5000
bb = 0.3000 0.3000 0.3000
0.2300 0.2300 0.2300 0.4700 0.4700 0.4700
PHXPHX = 0.7000 0.1333 0.1667
0.2609 0.5217 0.2174 0.0638 0.0851 0.8511
RXRX = -0.1667 -0.4217 -0.9638
-0.2667 -0.9913 -2.1106
% file dec2.m
% Data for type in which RH is giventype = 2;
A = [1 2];
X = [-1 1 3];
PH = [0.2 0.5 0.3];
PXH = [0.5 0.4 0.1; % PXH(i,j) = P(X = j|H = i) 0.4 0.5 0.1;
0.2 0.4 0.4];
RH = [-10 5 -12; 5 -10 -5]; % r(a,i) = expected loss when % action is a, given H = i
dec2
decDecision process with experimentation
------------------- Instruction lines edited outEnter type number type
Enter vector A of actions AEnter vector PH of parameter probabilities PH
Enter matrix PXH of conditional probabilities PXHEnter vector X of test random variable values X
Enter matrix RH of expected loss, given H RH
Optimum losses and actions Test value Action Loss
-1.0000 2.0000 -5.0000 1.0000 2.0000 -6.0000
3.0000 1.0000 -7.3158
Bayesian risk B(d*) = -5.89
Carnival example (type in which )
A carnival is scheduled to appear on a given date. Profits to be earned depend heavily on the weather. If rainy, the carnivalloses $15 (thousands); if cloudy, the loss is $5 (thousands); if sunny, a profit of $10 (thousands) is expected. If thecarnival sets up its equipment, it must give the show; if it decides not to set up, it forfeits $1,000. For an additional cost of $1,000, it candelay setup until the day before the show and get the latest weather report.
Actual weather is 1 rainy, 2 cloudy, or 3 sunny.
The weather report X has values 1, 2, or 3, corresponding to predictions rainy, cloudy, or sunny respectively.
Reliability of the forecast is expressed in terms of – see matrix
Two actions: 1 set up; 2 no set up.
Possible losses for each action and weather condition are in matrix L .
% file dec3,m
% Carnival problemtype = 3; % Y = H (actual weather)
A = [1 2]; % 1: setup 2: no setup
X = [1 2 3]; % 1; rain, 2: cloudy, 3: sunny
L = [16 6 -9; % L(a,k) = loss when action number is a, outcome is k 2 2 2]; % --with premium for postponing setupPH = 0.1*[1 3 6]; % P(H = i)PXH = 0.1*[7 2 1; % PXH(i,j) = P(X = j|H = i)
2 6 2; 1 2 7];
dec3dec
Decision process with experimentation------------------- Instruction lines edited out
Enter case number caseEnter vector A of actions A
Enter vector PH of parameter probabilities PHEnter matrix PXH of conditional probabilities PXH
Enter vector X of test random variable values XEnter loss matrix L L
Optimum losses and actions
Test value Action Loss 1.0000 2.0000 2.0000
2.0000 1.0000 1.0000 3.0000 1.0000 -6.6531
Bayesian risk B(d*) = -2.56
Notification Switch
Would you like to follow the 'Topics in applied probability' conversation and receive update notifications?