The following simple random variable is in canonical form:
Express the events
Random variable X, in canonical form, is given by
Express the events
The class
T = [1 3 2 3 4 2 1 3 5 2];
[X,I] = sort(T)
X = 1 1 2 2 2 3 3 3 4 5
I = 1 7 3 6 10 2 4 8 5 9
The class
T = [1 3 2 3 4 2 1 3 5 2];
pc = 0.01*[8 13 6 9 14 11 12 7 11 9];
[X,PX] = csort(T,pc);
disp([X;PX]')
1.0000 0.2000
2.0000 0.2600
3.0000 0.2900
4.0000 0.1400
5.0000 0.1100
A wheel is spun yielding on an equally likely basis the
integers 1 through 10. Let
Ci be the event the wheel stops at i,
p = 0.1*ones(1,10);
c = [-10 0 10 -10 0 10 -10 0 10 -1];
[X,PX] = csort(c,p);
disp([X;PX]')
-10.0000 0.3000
-1.0000 0.1000
0 0.3000
10.0000 0.3000
Pneg = (X<0)*PX'
Pneg = 0.4000
Ppos = (X>0)*PX'
Ppos = 0.300
A store has eight items for sale. The prices are $3.50, $5.00, $3.50, $7.50, $5.00, $5.00, $3.50, and $7.50, respectively. A customer comes in. She purchases one of the items with probabilities 0.10, 0.15, 0.15, 0.20, 0.10 0.05, 0.10 0.15. The random variable expressing the amount of her purchase may be written
Determine the distribution for X (a) by hand, (b) using MATLAB.
p = 0.01*[10 15 15 20 10 5 10 15];
c = [3.5 5 3.5 7.5 5 5 3.5 7.5];
[X,PX] = csort(c,p);
disp([X;PX]')
3.5000 0.3500
5.0000 0.3000
7.5000 0.3500
Suppose
The
A = [2 3 5];
B = [1 2 3];
a = rowcopy(A,3);
b = colcopy(B,3);
Z =a + b % Possible values of sum Z = X + Y
Z = 3 4 6
4 5 7
5 6 8
PA = [0.3 0.6 0.1];
PB = [0.2 0.6 0.2];
pa= rowcopy(PA,3);
pb = colcopy(PB,3);
P = pa.*pb % Probabilities for various values
P = 0.0600 0.1200 0.0200
0.1800 0.3600 0.0600
0.0600 0.1200 0.0200
[Z,PZ] = csort(Z,P);
disp([Z;PZ]') % Distribution for Z = X + Y
3.0000 0.0600
4.0000 0.3000
5.0000 0.4200
6.0000 0.1400
7.0000 0.0600
8.0000 0.0200
For the random variables in Exercise 7, let
XY = a.*b
XY = 2 3 5 % XY values
4 6 10
6 9 15
W PW % Distribution for W = XY
2.0000 0.0600
3.0000 0.1200
4.0000 0.1800
5.0000 0.0200
6.0000 0.4200
9.0000 0.1200
10.0000 0.0600
15.0000 0.0200
A pair of dice is rolled.
t = 1:6;
c = ones(6,6);
[x,y] = meshgrid(t,t)
x = 1 2 3 4 5 6 % x-values in each position
1 2 3 4 5 6
1 2 3 4 5 6
1 2 3 4 5 6
1 2 3 4 5 6
1 2 3 4 5 6
y = 1 1 1 1 1 1 % y-values in each position
2 2 2 2 2 2
3 3 3 3 3 3
4 4 4 4 4 4
5 5 5 5 5 5
6 6 6 6 6 6
m = min(x,y); % min in each position
M = max(x,y); % max in each position
s = x + y; % sum x+y in each position
d = abs(x - y); % |x - y| in each position
[X,fX] = csort(m,c) % sorts values and counts occurrences
X = 1 2 3 4 5 6
fX = 11 9 7 5 3 1 % PX = fX/36
[Y,fY] = csort(M,c)
Y = 1 2 3 4 5 6
fY = 1 3 5 7 9 11 % PY = fY/36
[Z,fZ] = csort(s,c)
Z = 2 3 4 5 6 7 8 9 10 11 12
fZ = 1 2 3 4 5 6 5 4 3 2 1 %PZ = fZ/36
[W,fW] = csort(d,c)
W = 0 1 2 3 4 5
fW = 6 10 8 6 4 2 % PW = fW/36
Minterm probabilities
Determine the distribution for random variable
% file npr06_10.m
% Data for Exercise 10
pm = [ 0.072 0.048 0.018 0.012 0.168 0.112 0.042 0.028 ...
0.062 0.048 0.028 0.010 0.170 0.110 0.040 0.032];
c = [-5.3 -2.5 2.3 4.2 -3.7];
disp('Minterm probabilities are in pm, coefficients in c')
npr06_10
Minterm probabilities are in pm, coefficients in c
canonic
Enter row vector of coefficients c
Enter row vector of minterm probabilities pm
Use row matrices X and PX for calculations
Call for XDBN to view the distribution
XDBN
XDBN =
-11.5000 0.1700
-9.2000 0.0400
-9.0000 0.0620
-7.3000 0.1100
-6.7000 0.0280
-6.2000 0.1680
-5.0000 0.0320
-4.8000 0.0480
-3.9000 0.0420
-3.7000 0.0720
-2.5000 0.0100
-2.0000 0.1120
-1.4000 0.0180
0.3000 0.0280
0.5000 0.0480
2.8000 0.0120
On a Tuesday evening, the Houston Rockets, the Orlando Magic, and the
Chicago Bulls all have games (but not with one another). Let A be the event the
Rockets win, B be the event the Magic win, and C be the
event the Bulls win. Suppose the class
Ellen's winning may be expressed as the random variable
Determine the distribution for X. What are the probabilities Ellen loses money, breaks even, or comes out ahead?
P = 0.01*[75 70 80];
c = [-15 15 -10 10];
canonic
Enter row vector of coefficients c
Enter row vector of minterm probabilities minprob(P)
Use row matrices X and PX for calculations
Call for XDBN to view the distribution
disp(XDBN)
-15.0000 0.1800
-5.0000 0.0450
0 0.4800
10.0000 0.1200
15.0000 0.1400
25.0000 0.0350
PXneg = (X<0)*PX'
PXneg = 0.2250
PX0 = (X==0)*PX'
PX0 = 0.4800
PXpos = (X>0)*PX'
PXpos = 0.2950
The class
npr06_12
Minterm probabilities in pm, coefficients in c
a = imintest(pm)
The class is NOT independent
Minterms for which the product rule fails
a =
1 1 1 1
1 1 1 1
1 1 1 1
1 1 1 1
canonic
Enter row vector of coefficients c
Enter row vector of minterm probabilities pm
Use row matrices X and PX for calculations
Call for XDBN to view the distribution
XDBN =
0 0.0050
1.0000 0.0430
2.0000 0.2120
3.0000 0.4380
4.0000 0.3020
P2 = (X>=2)*PX'
P2 = 0.9520
P13 = ((X==1)|(X==3))*PX'
P13 = 0.4810
James is expecting three checks in the mail, for $20, $26, and $33 dollars.
Their arrivals are the events
represents the total amount received. Determine the distribution for X. What is the probability he receives at least $50? Less than $30?
c = [20 26 33 0];
P = 0.01*[90 75 80];
canonic
Enter row vector of coefficients c
Enter row vector of minterm probabilities minprob(P)
Use row matrices X and PX for calculations
Call for XDBN to view the distribution
disp(XDBN)
0 0.0050
20.0000 0.0450
26.0000 0.0150
33.0000 0.0200
46.0000 0.1350
53.0000 0.1800
59.0000 0.0600
79.0000 0.5400
P50 = (X>=50)*PX'
P50 = 0.7800
P30 = (X <30)*PX'
P30 = 0.0650
A gambler places three bets. He puts down two dollars for each bet. He picks up three dollars (his original bet plus one dollar) if he wins the first bet, four dollars if he wins the second bet, and six dollars if he wins the third. His net winning can be represented by the random variable
Assume the results of the games are independent. Determine the distribution for X.
c = [3 4 6 -6];
P = 0.1*[5 4 3];
canonic
Enter row vector of coefficients c
Enter row vector of minterm probabilities minprob(P)
Use row matrices X and PX for calculations
Call for XDBN to view the distribution
dsp(XDBN)
-6.0000 0.2100
-3.0000 0.2100
-2.0000 0.1400
0 0.0900
1.0000 0.1400
3.0000 0.0900
4.0000 0.0600
7.0000 0.0600
Henry goes to a hardware store. He considers a power drill at $35, a socket wrench set at $56, a set of screwdrivers at $18, a vise at $24, and hammer at $8. He decides independently on the purchases of the individual items, with respective probabilities 0.5, 0.6, 0.7, 0.4, 0.9. Let X be the amount of his total purchases. Determine the distribution for X.
c = [35 56 18 24 8 0];
P = 0.1*[5 6 7 4 9];
canonic
Enter row vector of coefficients c
Enter row vector of minterm probabilities minprob(P)
Use row matrices X and PX for calculations
Call for XDBN to view the distribution
disp(XDBN)
0 0.0036
8.0000 0.0324
18.0000 0.0084
24.0000 0.0024
26.0000 0.0756
32.0000 0.0216
35.0000 0.0036
42.0000 0.0056
43.0000 0.0324
50.0000 0.0504
53.0000 0.0084
56.0000 0.0054
59.0000 0.0024
61.0000 0.0756
64.0000 0.0486
67.0000 0.0216
74.0000 0.0126
77.0000 0.0056
80.0000 0.0036
82.0000 0.1134
85.0000 0.0504
88.0000 0.0324
91.0000 0.0054
98.0000 0.0084
99.0000 0.0486
106.0000 0.0756
109.0000 0.0126
115.0000 0.0036
117.0000 0.1134
123.0000 0.0324
133.0000 0.0084
141.0000 0.0756
A sequence of trials (not necessarily independent) is performed. Let Ei
be the event of success on the ith component trial. We associate with each
trial a “payoff function”
A marker is placed at a reference position on a line (taken to be the origin); a coin is tossed repeatedly. If a head turns up, the marker is moved one unit to the right; if a tail turns up, the marker is moved one unit to the left.
S = 0:10;
PS = ibinom(10,0.5,0:10);
X = 2*S - 10;
disp([X;PS]')
-10.0000 0.0010
-8.0000 0.0098
-6.0000 0.0439
-4.0000 0.1172
-2.0000 0.2051
0 0.2461
2.0000 0.2051
4.0000 0.1172
6.0000 0.0439
8.0000 0.0098
10.0000 0.0010
Margaret considers five purchases in the amounts 5, 17, 21, 8, 15 dollars with respective probabilities 0.37, 0.22, 0.38, 0.81, 0.63. Anne contemplates six purchases in the amounts 8, 15, 12, 18, 15, 12 dollars, with respective probabilities 0.77, 0.52, 0.23, 0.41, 0.83, 0.58. Assume that all eleven possible purchases form an independent class.
Suggestion for part (c). Let MATLAB perform the calculations.
[r,s] = ndgrid(X,Y);
[t,u] = ndgrid(PX,PY);
z = r + s;
pz = t.*u;
[Z,PZ] = csort(z,pz);
% file npr06_18.m
cx = [5 17 21 8 15 0];
cy = [8 15 12 18 15 12 0];
pmx = minprob(0.01*[37 22 38 81 63]);
pmy = minprob(0.01*[77 52 23 41 83 58]);
npr06_18
[X,PX] = canonicf(cx,pmx); [Y,PY] = canonicf(cy,pmy);
[r,s] = ndgrid(X,Y); [t,u] = ndgrid(PX,PY);
z = r + s; pz = t.*u;
[Z,PZ] = csort(z,pz);
a = length(Z)
a = 125 % 125 different values
plot(Z,cumsum(PZ)) % See figure Plotting details omitted