Algorithm 184. Computing Conditional Distributions D. Trenlder ' g ( x , l ) ] 1 '. For instance the dis~budon of .Y*2 is 1 0.13 i~ 0.27 ' ~ - 2 [ 1 ' CONDESTR NAT 9 16 25 0.21 0.23 0.16 Let us be Oven a mBdom vector ( X , ] r ) whose probubifity fuBcton P ( X = x , X : y ) is completely chm'acterizcd by a flints number of mass points. Detemdmng the condifioeml disldbufion of g(X,]~) wbe~ ( X , ~ ) is subject to some con- Note how the function copes with (xlX=o) whose distribution does not exist: q ' X I Z : o ' C O N D E S T R mAT DESTBIBUTEON I S NO~' DEPZNED. straints often is a tedious task. The function CONDESTB was devised to do this: 9 R EXP CONDISTR I : g M ~ ; A ; B ; C ; P ; X ; Z ; $ P [Ol] [o2] [o3] B 0 2 PO To compute a conditional expected value any of the above expressions should be preceded by +/,,/. Fachbereich Wirt. Universitat Osnabruck Rolandstr. 8 D-4500 Osnabruck West Germany X , (Z -I+PPMA~')Pl+PXAT[1 ; ] lv+, tl (~lv)p I+PI/AI'[ : 1 ] C+a(B gXPt ' I ' )+EXP X+C/X ¢ 74-C/Z B+a-I+B+EXP o A BC,~B] [oq] [o5] [o6] [o7] lOB] [o9] [lO] 9 + ( O : $ P + / P C / , I 0 + 0 1 +Z~AT)/ALAPJf LOOP:B+B, [1],/111], ( + / ( B 5 A [ 1 ] ) / P ) S P ¢ (O:pA (A~A[1])/A)/O ¢ LOOP AZ~A.qM: I DIS~'R.Z'BUTION I 8 NOT DEFINED.' Eommple. J/AT describes the joint distribution of the vector (x .y ). o 1 2 3 q //AT o 0.01 0.06 0.07 0.07 1 0.03 0.06 0.06 0.09 0.02 2 0.05 3 0.Oq. 0.06 0.06 0.05 0.05 0.07 0.02 0.02 0.06 0.01 For instance P ( X : 3 , 1 r : l ) : 0 . 0 ~ . The folJowing ¢xpr-,~,sions yield conditional disldbufions which are seB- explanatory: ~'XxZI121X-Z'COWDZSTB MA~ 0 0.025 1 0.075 2 0.275 ; 0.2 6 0.325 9 0.05 12 0.05 0.25 q'XlY>>2'CONDZSTRIL4T 1 2 3 0.2833 0.3333 0.08;51 0.2667 0.2 0,5 0.15;9 0.6667 0.06~51 ~'X ZI(X:2)v((O<~)^CZg3))'CORDISTBJtM~ 0 0.1972 O.q 0.070q2 0.1831 1.5 0.09859 0.070q2 0.0563q The left argument of COifDZSTB is a string consisting of two APL-expressions separated by magnitude I. The first describes g(X,lr) and the second the conditions the vector (X,1r) is subject to. The result is a matrix with two columns displaying the conditional wobaldfity hmcton of g(X,lV). To determine an 1.mcondifional dis~bufion simply enter A P L Quote Quad 19 3 March 1 9 8 9
/lp/association-for-computing-machinery/computing-conditional-distributions-FXKM49CcBY