Prev: saving variables
Next: 1 integer 4 bytes
From: Ged Ridgway on 22 Jul 2010 13:04 Hi Paulo, For mode=mean, how about just: p = @(x) sin(pi*x)*pi/2 which is zero at 0 and 1, otherwise positive, and integrates to 1, so seems to be a valid PDF satisfying your domain and mode=mean requirements. To have the mean in the shorter tail, it seems you'd need the PDF to fall off much more quickly in the longer tail. Perhaps you could start with the above and look at various nonlinear mappings of x, that map (0,1) onto itself... Note though that you'll have to renormalise the resultant function, e.g. quadgk(p, 0, 1) is 1, but for: p2 = @(x) sin(pi*x.^2)*pi/2 quadgk(p2,0,1) it's about 0.793, and I haven't stopped to think if this can be found in closed form... I hope that helps a little though. Good luck, Ged
From: Paulo Andrade on 22 Jul 2010 21:12 Thanks Ged, you got it right: the PDF I need should to fall off much more quickly in the longer tail. The problem I see, with the function you suggest, is that it is always symmetrical around the mean (unless a nonlinear mapping of x is used). I was hoping that there were a common usage PDF that fulfills my needs. Besides, I will need a method to calculate the Mean and the Variance for the PDF, and, of course, as you put it, its integral in [0, 1] must be 1. I was thinking of using a nonlinear mapping of x with the Beta Distribution but my math knowledge is not enough to renormalise the resulting function. Thank you, once again. Paulo. "Ged Ridgway" <Gerard.Ridgway(a)ucl.ac.uk> wrote in message <i29tmk$rct$1(a)fred.mathworks.com>... > Hi Paulo, > > For mode=mean, how about just: > p = @(x) sin(pi*x)*pi/2 > which is zero at 0 and 1, otherwise positive, and integrates to 1, so seems to be a valid PDF satisfying your domain and mode=mean requirements. > > To have the mean in the shorter tail, it seems you'd need the PDF to fall off much more quickly in the longer tail. Perhaps you could start with the above and look at various nonlinear mappings of x, that map (0,1) onto itself... Note though that you'll have to renormalise the resultant function, e.g. quadgk(p, 0, 1) is 1, but for: > p2 = @(x) sin(pi*x.^2)*pi/2 > quadgk(p2,0,1) > it's about 0.793, and I haven't stopped to think if this can be found in closed form... > > I hope that helps a little though. Good luck, > Ged
From: John D'Errico on 22 Jul 2010 23:30 "Paulo Andrade" <pandre45(a)gmail.com> wrote in message <i2aq95$fsa$1(a)fred.mathworks.com>... > Thanks Ged, > > you got it right: the PDF I need should to fall off much more quickly in the longer tail. > > The problem I see, with the function you suggest, is that it is always symmetrical around the mean (unless a nonlinear mapping of x is used). I was hoping that there were a common usage PDF that fulfills my needs. Besides, I will need a method to calculate the Mean and the Variance for the PDF, and, of course, as you put it, its integral in [0, 1] must be 1. > I was thinking of using a nonlinear mapping of x with the Beta Distribution but my math knowledge is not enough to renormalise the resulting function. > Just use a spline. x = 0:.2:1; y = [0 .75 1 .2 .1 0]; pp = pchip(x,y); The use of pchip here ensures that the spline PDF never goes negative, as well, the maximum values occurs exactly at x = 0.4. Normalize the spline to have unit area. ppint = fnint(pp); pp.coefs = pp.coefs /ppval(ppint,1); What is the mean? quadgk(@(x) x.*ppval(pp,x),0,1) ans = 0.357492437908425 As required, less than 0.4. HTH, John
From: Paulo Andrade on 23 Jul 2010 08:30 John, thank you. That is closer to fulfill my requirements. As I will use the PDF in a simulation I will need the following: 1. The CDF (Cumulative Distribution Function) 2. An inverse function for the CDF 3. A formula to calculate the Variance of the PDF Do you have any further suggestion? Once again, thank you, Paulo "John D'Errico" <woodchips(a)rochester.rr.com> wrote in message <i2b2bs$ajc$1(a)fred.mathworks.com>... > "Paulo Andrade" <pandre45(a)gmail.com> wrote in message <i2aq95$fsa$1(a)fred.mathworks.com>... > > Thanks Ged, > > > > you got it right: the PDF I need should to fall off much more quickly in the longer tail. > > > > The problem I see, with the function you suggest, is that it is always symmetrical around the mean (unless a nonlinear mapping of x is used). I was hoping that there were a common usage PDF that fulfills my needs. Besides, I will need a method to calculate the Mean and the Variance for the PDF, and, of course, as you put it, its integral in [0, 1] must be 1. > > I was thinking of using a nonlinear mapping of x with the Beta Distribution but my math knowledge is not enough to renormalise the resulting function. > > > > Just use a spline. > > x = 0:.2:1; > y = [0 .75 1 .2 .1 0]; > pp = pchip(x,y); > > The use of pchip here ensures that the spline PDF never > goes negative, as well, the maximum values occurs > exactly at x = 0.4. > > Normalize the spline to have unit area. > > ppint = fnint(pp); > pp.coefs = pp.coefs /ppval(ppint,1); > > What is the mean? > > quadgk(@(x) x.*ppval(pp,x),0,1) > ans = > 0.357492437908425 > > As required, less than 0.4. > > HTH, > John
|
Pages: 1 Prev: saving variables Next: 1 integer 4 bytes |