<< Chapter < Page | Chapter >> Page > |
As a variation of [link] , Suppose a pair of dice is rolled instead of a single die. Determine the joint distribution for the pair and from this determine the marginal distribution for Y .
% file
npr08_04.m % Solution for
[link] X = 2:12;
Y = 0:12;PX = (1/36)*[1 2 3 4 5 6 5 4 3 2 1];P0 = zeros(11,13);
for i = 1:11P0(i,1:i+2) = PX(i)*ibinom(i+1,1/2,0:i+1);
endP = rot90(P0);
PY = fliplr(sum(P'));disp('Answers are in X, Y, PY, P')
npr08_04 Answers are in X, Y, PY, P
disp(P)Columns 1 through 7
0 0 0 0 0 0 00 0 0 0 0 0 0
0 0 0 0 0 0 00 0 0 0 0 0 0
0 0 0 0 0 0 0.00050 0 0 0 0 0.0013 0.0043
0 0 0 0 0.0022 0.0091 0.01520 0 0 0.0035 0.0130 0.0273 0.0304
0 0 0.0052 0.0174 0.0326 0.0456 0.03800 0.0069 0.0208 0.0347 0.0434 0.0456 0.0304
0.0069 0.0208 0.0312 0.0347 0.0326 0.0273 0.01520.0139 0.0208 0.0208 0.0174 0.0130 0.0091 0.0043
0.0069 0.0069 0.0052 0.0035 0.0022 0.0013 0.0005Columns 8 through 11
0 0 0 0.00000 0 0.0000 0.0001
0 0.0001 0.0003 0.00040.0002 0.0008 0.0015 0.0015
0.0020 0.0037 0.0045 0.00340.0078 0.0098 0.0090 0.0054
0.0182 0.0171 0.0125 0.00630.0273 0.0205 0.0125 0.0054
0.0273 0.0171 0.0090 0.00340.0182 0.0098 0.0045 0.0015
0.0078 0.0037 0.0015 0.00040.0020 0.0008 0.0003 0.0001
0.0002 0.0001 0.0000 0.0000disp(PY)
Columns 1 through 70.0269 0.1025 0.1823 0.2158 0.1954 0.1400 0.0806
Columns 8 through 130.0375 0.0140 0.0040 0.0008 0.0001 0.0000
Suppose a pair of dice is rolled. Let X be the total number of spots which turn up. Roll the pair an additional X times. Let Y be the number of sevens that are thrown on the X rolls. Determine the joint distribution for the pair and from this determine the marginal distribution for Y . What is the probability of three or more sevens?
% file
npr08_05.m % Data and basic calculations for
[link] PX = (1/36)*[1 2 3 4 5 6 5 4 3 2 1];X = 2:12;
Y = 0:12;P0 = zeros(11,13);
for i = 1:11P0(i,1:i+2) = PX(i)*ibinom(i+1,1/6,0:i+1);
endP = rot90(P0);
PY = fliplr(sum(P'));disp('Answers are in X, Y, P, PY')
npr08_05 Answers are in X, Y, P, PY
disp(PY)Columns 1 through 7
0.3072 0.3660 0.2152 0.0828 0.0230 0.0048 0.0008Columns 8 through 13
0.0001 0.0000 0.0000 0.0000 0.0000 0.0000
The pair has the joint distribution (in m-file npr08_06.m ):
Determine the marginal distributions and the corner values for . Determine and .
npr08_06 Data are in X, Y, P
jcalcEnter JOINT PROBABILITIES (as on the plane) P
Enter row matrix of VALUES of X XEnter row matrix of VALUES of Y Y
Use array operations on matrices X, Y, PX, PY, t, u, and Pdisp([X;PX]')-2.3000 0.2300
-0.7000 0.17001.1000 0.2000
3.9000 0.20205.1000 0.1980disp([Y;PY]')1.3000 0.2980
2.5000 0.30204.1000 0.1900
5.3000 0.2100jddbn
Enter joint probability matrix (as on the plane) PTo view joint distribution function, call for FXY
disp(FXY)0.2300 0.4000 0.6000 0.8020 1.0000
0.1817 0.3160 0.4740 0.6361 0.79000.1380 0.2400 0.3600 0.4860 0.6000
0.0667 0.1160 0.1740 0.2391 0.2980P1 = total((t+u>2).*P)
P1 = 0.7163P2 = total((t>=u).*P)
P2 = 0.2799
Notification Switch
Would you like to follow the 'Applied probability' conversation and receive update notifications?