<< Chapter < Page Chapter >> Page >
% file jdemo3.m % data for joint simple distributionX = [-4 -2 0 1 3];Y = [0 1 2 4];P = [0.0132 0.0198 0.0297 0.0209 0.0264; 0.0372 0.0558 0.0837 0.0589 0.0744;0.0516 0.0774 0.1161 0.0817 0.1032; 0.0180 0.0270 0.0405 0.0285 0.0360]; jdemo3 % Call for datajcalc % Set up of calculating matrices t, u. Enter JOINT PROBABILITIES (as on the plane) PEnter row matrix of VALUES of X X Enter row matrix of VALUES of Y YUse array operations on matrices X, Y, PX, PY, t, u, and P G = t.^2 -3*u; % Formation of G = [g(ti,uj)]M = G>= 1; % Calculation using the XY distribution PM = total(M.*P) % Alternately, use total((G>=1).*P) PM = 0.4665[Z,PZ] = csort(G,P);PM = (Z>=1)*PZ' % Calculation using the Z distribution PM = 0.4665disp([Z;PZ]') % Display of the Z distribution-12.0000 0.0297 -11.0000 0.0209-8.0000 0.0198 -6.0000 0.0837-5.0000 0.0589 -3.0000 0.1425-2.0000 0.1375 0 0.04051.0000 0.1059 3.0000 0.07444.0000 0.0402 6.0000 0.10329.0000 0.0360 10.0000 0.037213.0000 0.0516 16.0000 0.0180
Got questions? Get instant answers now!

We extend the example above by considering a function W = h ( X , Y ) which has a composite definition.

Continuation of [link]

Let

W = X for X + Y 1 X 2 + Y 2 for X + Y < 1 Determine the distribution for W
H = t.*(t+u>=1) + (t.^2 + u.^2).*(t+u<1); % Specification of h(t,u)[W,PW] = csort(H,P); % Distribution for W = h(X,Y)disp([W;PW]')-2.0000 0.0198 0 0.27001.0000 0.1900 3.0000 0.24004.0000 0.0270 5.0000 0.07748.0000 0.0558 16.0000 0.018017.0000 0.0516 20.0000 0.037232.0000 0.0132 ddbn % Plot of distribution functionEnter row matrix of values W Enter row matrix of probabilities PWprint % See [link]
A graph of distribution function for random variable W. This graph is a series of plotted points with lines drawn between them. The line goes up and to the right. A graph of distribution function for random variable W. This graph is a series of plotted points with lines drawn between them. The line goes up and to the right.
Distribution for random variable W in [link] .
Got questions? Get instant answers now!

Joint distributions for two functions of ( X , Y )

In previous treatments, we use csort to obtain the marginal distribution for a single function Z = g ( X , Y ) . It is often desirable to have the joint distribution for a pair Z = g ( X , Y ) and W = h ( X , Y ) . As special cases, we may have Z = X or W = Y . Suppose

Z has values [ z 1 z 2 z c ] and W has values [ w 1 w 2 w r ]

The joint distribution requires the probability of each pair, P ( W = w i , Z = z j ) . Each such pair of values corresponds to a set of pairs of X and Y values. To determine the joint probability matrix P Z W for ( Z , W ) arranged as on the plane, we assign to each position ( i , j ) the probability P ( W = w i , Z = z j ) , with values of W increasing upward. Each pair of ( W , Z ) values corresponds to one or more pairs of ( Y , X ) values. If we select and add the probabilities corresponding to the latter pairs, we have P ( W = w i , Z = z j ) . This may be accomplished as follows:

  1. Set up calculation matrices t and u as with jcalc.
  2. Use array arithmetic to determine the matrices of values G = [ g ( t , u ) ] and H = [ h ( t , u ) ] .
  3. Use csort to determine the Z and W value matrices and the P Z and P W marginal probability matrices.
  4. For each pair ( w i , z j ) , use the MATLAB function find to determine the positions a for which
    ( H = = W ( i ) ) & ( G = = Z ( j ) )
  5. Assign to the ( i , j ) position in the joint probability matrix P Z W for ( Z , W ) the probability
    P Z W ( i , j ) = t o t a l ( P ( a ) )

Get Jobilize Job Search Mobile App in your pocket Now!

Get it on Google Play Download on the App Store Now




Source:  OpenStax, Applied probability. OpenStax CNX. Aug 31, 2009 Download for free at http://cnx.org/content/col10708/1.6
Google Play and the Google Play logo are trademarks of Google Inc.

Notification Switch

Would you like to follow the 'Applied probability' conversation and receive update notifications?

Ask