<< Chapter < Page | Chapter >> Page > |
For simple random variables, we use the discrete alternative approach, since this may be implemented easily with MATLAB. Suppose the distribution for X is expressed in the row vectors X and .
X = -5:10; % Values of X
PX = ibinom(15,0.6,0:15); % Probabilities for XG = (X + 6).*(X - 1).*(X - 8); % Array operations on X matrix to get G = g(X)
M = (G>- 100)&(G<130); % Relational and logical operations on G
PM = M*PX' % Sum of probabilities for selected valuesPM = 0.4800
disp([X;G;M;PX]') % Display of various matrices (as columns)
-5.0000 78.0000 1.0000 0.0000-4.0000 120.0000 1.0000 0.0000
-3.0000 132.0000 0 0.0003-2.0000 120.0000 1.0000 0.0016
-1.0000 90.0000 1.0000 0.00740 48.0000 1.0000 0.0245
1.0000 0 1.0000 0.06122.0000 -48.0000 1.0000 0.1181
3.0000 -90.0000 1.0000 0.17714.0000 -120.0000 0 0.2066
5.0000 -132.0000 0 0.18596.0000 -120.0000 0 0.1268
7.0000 -78.0000 1.0000 0.06348.0000 0 1.0000 0.0219
9.0000 120.0000 1.0000 0.004710.0000 288.0000 0 0.0005
[Z,PZ]= csort(G,PX); % Sorting and consolidating to obtaindisp([Z;PZ]') % the distribution for Z = g(X)-132.0000 0.1859
-120.0000 0.3334-90.0000 0.1771
-78.0000 0.0634-48.0000 0.1181
0 0.083248.0000 0.0245
78.0000 0.000090.0000 0.0074
120.0000 0.0064132.0000 0.0003
288.0000 0.0005P1 = (G<-120)*PX ' % Further calculation using G, PX
P1 = 0.1859p1 = (Z<-120)*PZ' % Alternate using Z, PZ
p1 = 0.1859
with independent and .
We calculate the distribution for X , then determine the distribution for
c = [10 18 10 0];pm = minprob(0.1*[6 3 5]);canonic
Enter row vector of coefficients cEnter row vector of minterm probabilities pm
Use row matrices X and PX for calculationsCall for XDBN to view the distribution
disp(XDBN)0 0.1400
10.0000 0.350018.0000 0.0600
20.0000 0.210028.0000 0.1500
38.0000 0.0900G = sqrt(X) - X + 50; % Formation of G matrix
[Z,PZ]= csort(G,PX); % Sorts distinct values of g(X)
disp([Z;PZ]') % consolidates probabilities
18.1644 0.090027.2915 0.1500
34.4721 0.210036.2426 0.0600
43.1623 0.350050.0000 0.1400
M = (Z<20)|(Z>= 40) % Direct use of Z distribution
M = 1 0 0 0 1 1PZM = M*PZ'
PZM = 0.5800
Remark . Note that with the m-function csort, we may name the output as desired.
H = 2*X.^2 - 3*X + 1;
[W,PW]= csort(H,PX)
W = 1 171 595 741 1485 2775PW = 0.1400 0.3500 0.0600 0.2100 0.1500 0.0900
Suppose X has density function for . Then . Let . We may use the approximation m-procedure tappr to obtain an approximate discrete distribution. Then we work with theapproximating random variable as a simple random variable. Suppose we want . Now iff . The desired probability may be calculated to be
Using the approximation procedure, we have
tappr
Enter matrix [a b]of x-range endpoints [0 1]
Enter number of x approximation points 200Enter density as a function of t (3*t.^2 + 2*t)/2
Use row matrices X and PX as in the simple caseG = X.^(1/2);
M = G<= 0.8;
PM = M*PX'PM = 0.3359 % Agrees quite closely with the theoretical
Notification Switch
Would you like to follow the 'Applied probability' conversation and receive update notifications?