Re: Understanding TransformedDistribution

*To*: mathgroup at smc.vnet.net*Subject*: [mg131897] Re: Understanding TransformedDistribution*From*: Itai Seggev <itais at wolfram.com>*Date*: Mon, 28 Oct 2013 23:21:15 -0400 (EDT)*Delivered-to*: l-mathgroup@mail-archive0.wolfram.com*Delivered-to*: l-mathgroup@wolfram.com*Delivered-to*: mathgroup-outx@smc.vnet.net*Delivered-to*: mathgroup-newsendx@smc.vnet.net*References*: <20131028044008.90A2A6A13@smc.vnet.net>

On Mon, Oct 28, 2013 at 12:40:08AM -0400, Ernst H.K. Stelzer wrote: > Through a question on StackExchange I came to know TransformedDistribution, which allows me to sort of develop new distributions based on the ones defined in Mathematica. Instead of using my own functions, which work perfectly well, I now tried to repeat a number of older calculations using e.g. UniformDistribution. > > When I combine two via > > TransformedDistribution[2 (x - 4/5 y), {x \[Distributed] UniformDistribution[{-1, 1}], y \[Distributed] UniformDistribution[{-(4/5), 4/5}]}] > > to generate a kind of annular function and then look at the PDF, I get > > PDF[%, x] > > \[Piecewise] 1/4 -(18/25)<=x<=18/25 > 1/256 (82-25 x) 18/25<x<82/25 > 1/256 (82+25 x) -(82/25)<x<-(18/25) > 0 True > > However, I expect, what I get when I enter > > 2 (PDF[UniformDistribution[{-1, 1}], x] - > 4/5 PDF[UniformDistribution[{-(4/5), 4/5}], x]) > > 2 ((\[Piecewise] 1/2 -1<=x<=1 > 0 True > )-4/5 (\[Piecewise] 5/8 -(4/5)<=x<=4/5 > 0 True > )) > > Does anybody have a clue which mistake I made? For one thing, your expectation isn't the PDF of anything--it's integral is 2/5, not 1. PDF is not in any sense a linear operation, because it must always integrate to 1. TransformedDistribution[expr, dists] represnets the distribution of the values of expr, given that its components are distribution according to dists. This means your first input represent a distribution ranging from -82/25 (when x is -1 and y 4/5) to 82/5 (when x is 1 and y 4/5). Since x and y are independent of piecewise constant distributions, you get a constant expectation in the "middle" going up from and back down to zero linearly as you go the maximum negative and positive values. -- Itai Seggev Mathematica Algorithms R&D 217-398-0700

**References**:**Understanding TransformedDistribution***From:*"Ernst H.K. Stelzer" <ernst.stelzer@physikalischebiologie.de>