<< Chapter < Page | Chapter >> Page > |
We have m-procedures for performing the calculations necessary to determine the distribution for a composite demand D when the counting random variable N and the individual demands Y k are simple random variables with not too many values. In some cases, such as for a Poisson counting random variable, we are able to approximate by a simple random variable.
The procedure gend
If the Y i are nonnegative, integer valued, then so is D , and there is a generating function. We examine a strategy for computation which is implemented inthe m-procedure gend . Suppose
The coefficients of g N and g Y are the probabilities of the values of N and Y , respectively. We enter these and calculate the coefficients for powers of g Y :
We wish to generate a matrix P whose rows contain the joint probabilities. The probabilities in the i th row consist of the coefficients for the appropriate power of g Y multiplied by the probability N has that value. To achieve this, we need a matrix, each of whose rows has elements, the length of . We begin by “preallocating” zeros to the rows. That is, we set . We then replace the appropriate elements of the successive rows. The replacement probabilitiesfor the i th row are obtained by the convolution of g Y and the power of g Y for the previous row. When the matrix P is completed, we remove zero rows and columns, corresponding to missing values of N and D (i.e., values with zero probability). To orient the joint probabilities as on the plane, we rotate P ninety degrees counterclockwise. With the joint distribution, we may then calculate any desired quantities.
The number of customers in a major appliance store is equally likely to be 1, 2, or 3. Each customer buys 0, 1, or 2 items with respective probabilities 0.5, 0.4, 0.1.Customers buy independently, regardless of the number of customers. First we determine the matrices representing g N and g Y . The coefficients are the probabilities that eachinteger value is observed. Note that the zero coefficients for any missing powers must be included.
gN = (1/3)*[0 1 1 1]; % Note zero coefficient for missing zero powergY = 0.1*[5 4 1]; % All powers 0 thru 2 have positive coefficientsgend
Do not forget zero coefficients for missing powersEnter the gen fn COEFFICIENTS for gN gN % Coefficient matrix named gN
Enter the gen fn COEFFICIENTS for gY gY % Coefficient matrix named gYResults are in N, PN, Y, PY, D, PD, P
May use jcalc or jcalcf on N, D, PTo view distribution for D, call for gD
disp(gD) % Optional display of complete distribution 0 0.2917
1.0000 0.3667 2.0000 0.2250
3.0000 0.0880 4.0000 0.0243
5.0000 0.0040 6.0000 0.0003
EN = N*PN'EN = 2
EY = Y*PY'EY = 0.6000
ED = D*PD'ED = 1.2000 % Agrees with theoretical EN*EY
P3 = (D>=3)*PD'
P3 = 0.1167 [N,D,t,u,PN,PD,PL] = jcalcf(N,D,P);EDn = sum(u.*P)./sum(P);
disp([N;EDn]')
1.0000 0.6000 % Agrees with theoretical E[D|N=n] = n*EY
2.0000 1.2000 3.0000 1.8000
VD = (D.^2)*PD' - ED^2VD = 1.1200 % Agrees with theoretical EN*VY + VN*EY^2
Notification Switch
Would you like to follow the 'Applied probability' conversation and receive update notifications?