11 — TRANSFORMING DENSITY FUNCTIONSIt can be expedient to use a transformation function to transform one probability densityfunction into another. As an introduction to this topic, it is helpful to recapitulate themethod of integration by substitution of a new variable.Integration by Substitution of a new VariableImagine that a newcomer to integration comes across the following:Z√π202x cos x2dxAssuming that the newcomer doesn’t notice that the integrand is the derivative of sin x2,one way to proceed would be to substitute a new variable y for x2:Let y = x2Replace the limits x = 0 and x =pπ2by y = 0 and y =π2Replace 2x cos x2by 2√y cos yNote that x =√y and hencedxdy=12√yand so replace dx bydy2√yThe original problem is thereby transformed into the following integration:Zπ20cos y dy =hsin yiπ20= 1The General CaseIt is instructive to develop the general case alongside the above example:General Case Above ExampleZbaf(x) dxZ√π202x cos x2dxChoose a transformation function y(x) y(x) = x2Note its inverse x(y) x(y) =√yReplace the limits by y(a) and y(b) 0 andπ2Replace f(x) by fx(y)2√y cos yReplace dx bydxdydy12√ydyResult isZy(b)y(a)fx(y)dxdydyZπ20cos y dy– 11.1 –Application to Probability Density FunctionsThe previous section informally leads to the general formula for integration by substitutionof a new variable:Zbaf(x) dx =Zy(b)y(a)fx(y)dxdydy (11.1)This formula has direct application to the process of transforming probability densityfunctions. . .Suppose X is a random variable whose probability density function is f (x).By definition:P(a 6 X < b) =Zbaf(x) dx (11.2)Any function of a random variable is itself a random variable and, if y is taken as sometransformation function, y(X) will be a derived random variable. Let Y = y(X).Notice that if X = a the derived random variable Y = y(a) and if X = b, Y = y(b).Moreover, (subject to certain assumptions about y) if a 6 X < b then y(a) 6 Y < y(b)and Py(a) 6 Y < y(b)= P(a 6 X < b). Hence, by (11.2) and (11.1):Py(a) 6 Y < y(b)= P(a 6 X < b) =Zbaf(x) dx =Zy(b)y(a)fx(y)dxdydy (11.3)Notice that the right-hand integrand fx(y)dxdyis expressed wholly in terms of y.Calling this integrand g(y):Py(a) 6 Y < y(b)=Zy(b)y(a)g(y) dyThis demonstrates that g(y) is the probability density function associated with Y .The transformation is illustrated by the following figures in which the function f (x) (onthe left) is transformed by y(x) (centre) into the new function g(y) (right):X Yf(x) y(b) g(y)y(a)a b a b y(a) y(b)x x y– 11.2 –Observations and ConstraintsThe crucial step is (11.3). One imagines noting a sequence of values of a random variableX and for each value in the range a to b using a transformation function y(x) to computea value for a derived random variable Y .Given certain assumptions about y(x), the value of Y must be in the range y(a) to y(b)and the probability of Y being in this range is clearly the same as the probability of Xbeing in the range a to b.In summary: the shaded region in the right-hand figure has the same area as the shadedregion in the left-hand figure.There are three important conditions that any probability density function f (x) has tosatisfy:• f (x) must be single valued for all x• f (x) > 0 for all x•Z+∞−∞f(x) dx = 1Often the function usefully applies over some finite interval of x and is deemed to bezero outside this interval. The function 2x cos x2could be used in the specification of aprobability density function:f(x) =(2x cos x2, if 0 6 x <pπ20, otherwiseBy inspection, f(x) is single valued and non-negative and, given the analysis on page 11.1,the integral from −∞ to +∞ is one.The constraints on the specification of a probability density function result in implicitconstraints on any transformation function y(x), most importantly:• Throughout the useful range of x, both y(x) and its inverse x(y) must be defined andmust be single-valued.• Throughout this range,dxdymust be defined and eitherdxdy> 0 ordxdy6 0.Ifdxdywere to change sign there would be values of x for which y(x) would be multivalued(as would be the case if the graph of y(x) were an S-shaped curve).A consequence of the constraints is that any practical transformation function y(x) musteither increase monotonically over the useful range of x (in which case for any a < b,y(a) < y(b)) or decrease monotonically (in which case for any a < b, y(a) > y(b)).Noting these constraints, it is customary for the relationship between a probability densityfunction f (x), the inverse x(y) of a transformation function, and the derived probabilitydensity function g(y) to be written:g(y) = fx(y)dxdy(11.4)– 11.3 –Example ITake a particular random variable X whose probability density function f(x) is:f(x) =x2, if 0 6 x < 20, otherwiseSuppose the transformation function y(x) is:y(x) = 1 −√4 − x22Note that the useful part of the range of x is 0 to 2 and, over this range, y(x) increasesmonotonically from 0 to 1.Let Y = y(X), the derived random variable, and let g(y) be the probability density functionassociated with Y . What is the function g(y)?The problem is illustrated by the following figures:X Y2 2 21 1 g(y)f(x) y(x)0 0 00 2 0 2 0 1 2x x yFirst, derive x(y) the inverse of the function y(x).Given:y = 1 −√4 − x224(y − 1)2= 4 − x2So:4y2− 8y + 4 = 4 − x2x2= 4y(2 − y)x = 2py(2 − y)– 11.4 –Accordingly:fx(y)=py(2 − y) anddxdy=2(1 − y)py(2 − y)From (11.4):g(y) = fx(y)dxdy= 2(1 − y)As illustrated in the figures, the function y(x) transforms one triangular distribution f (x)into another g(y). The two triangles are opposite ways round and the transformationfunction y(x) has to ensure that although low values of X are relatively rare, low valuesof Y are common.Expressing this informally: y(x) stays low for most of the range of x so that even when xis well over one, the value of y is well under a half. This ensures that the transformationshifts the bias appropriately.An Alternative QuestionIn the example, a probability density function and a transformation function were givenand the requirement was to determine what new probability density function results.Suppose instead that two probability density functions are given and the requirement isto find a function which transforms one into the other.Take the particular functions used in the previous example and pose the question
View Full Document