From: BobC Cadenza on
Given a normal distribution with mu,sigma. How can I find the mean between two points? So for example I want to find the mean value between -.5 *sigma to +2 sigma?

Thanks
From: Walter Roberson on
BobC Cadenza wrote:
> Given a normal distribution with mu,sigma. How can I find the mean
> between two points? So for example I want to find the mean value
> between -.5 *sigma to +2 sigma?

cdf() to +2 sigma, minus the cdf() to -1/2 sigma.

This is, of course, exactly equivalent to integrating the pdf between
-1/2 sigma and +2 sigma.
From: Wayne King on
"BobC Cadenza" <bobc(a)mailinator.com> wrote in message <i371ts$ht3$1(a)fred.mathworks.com>...
> Given a normal distribution with mu,sigma. How can I find the mean between two points? So for example I want to find the mean value between -.5 *sigma to +2 sigma?
>
> Thanks

Bob, Just to clarify, do you want to find the probability that a random variable with a N(mu,\sigma^2) distribution lies in the interval [mu-0.5*sigma, mu+2*sigma]?

Or are you really asking for the mean value of the pdf between [mu-0.5*sigma, mu+2*sigma]? (Not sure what the use case is for this... so that's why I'm hesitant to conclude this is really what you're looking for)

In either case, I'm assuming you want to include the mean in the expression because depending on the value of mu and sigma, you may not have any probability in the interval [-0.5*sigma, 2*sigma], or equivalently any nonzero value for the pdf.

To find the probability in the interval [mu-0.5*sigma, mu+2*sigma], if you have the Statistics Toolbox, enter

% for example
mu = 10;
sigma = 2;
normcdf(mu+2*sigma,mu,sigma)-normcdf(mu-0.5*sigma,mu,sigma)

% Note this is the same as
normcdf(2,0,1)-normcdf(-0.5,0,1)
% for a N(0,1) distribution
% or just normcdf(2)-normcdf(-0.5)

Write back if you really did not want the probability.

Wayne
From: BobC Cadenza on
"Wayne King" <wmkingty(a)gmail.com> wrote in message <i373ij$428$1(a)fred.mathworks.com>...
> "BobC Cadenza" <bobc(a)mailinator.com> wrote in message <i371ts$ht3$1(a)fred.mathworks.com>...
> > Given a normal distribution with mu,sigma. How can I find the mean between two points? So for example I want to find the mean value between -.5 *sigma to +2 sigma?
> >
> > Thanks
>
> Bob, Just to clarify, do you want to find the probability that a random variable with a N(mu,\sigma^2) distribution lies in the interval [mu-0.5*sigma, mu+2*sigma]?
>
> Or are you really asking for the mean value of the pdf between [mu-0.5*sigma, mu+2*sigma]? (Not sure what the use case is for this... so that's why I'm hesitant to conclude this is really what you're looking for)
>
> In either case, I'm assuming you want to include the mean in the expression because depending on the value of mu and sigma, you may not have any probability in the interval [-0.5*sigma, 2*sigma], or equivalently any nonzero value for the pdf.
>
> To find the probability in the interval [mu-0.5*sigma, mu+2*sigma], if you have the Statistics Toolbox, enter
>
> % for example
> mu = 10;
> sigma = 2;
> normcdf(mu+2*sigma,mu,sigma)-normcdf(mu-0.5*sigma,mu,sigma)
>
> % Note this is the same as
> normcdf(2,0,1)-normcdf(-0.5,0,1)
> % for a N(0,1) distribution
> % or just normcdf(2)-normcdf(-0.5)
>
> Write back if you really did not want the probability.
>
> Wayne

Yes I actually want mean. If the values represent equity returns, the mean is the average return. The above finds the median value, which is useful also, but I am trying to find the mean. Do you know how to calculate this?

Thanks.
From: Roger Stafford on
"BobC Cadenza" <bobc(a)mailinator.com> wrote in message <i371ts$ht3$1(a)fred.mathworks.com>...
> Given a normal distribution with mu,sigma. How can I find the mean between two points? So for example I want to find the mean value between -.5 *sigma to +2 sigma?
>
> Thanks
- - - - - - - - - -
If p(x) is the pdf of the original normal distribution with mu and sigma from -infinity to +infinity, but you want the mean value of that distribution restricted to some finite range, [a,b], then you can do the following.

mean value = int(x*p(x),'x',a,b)/int(p(x),'x',a,b)

The denominator is just the cdf difference between its value at b from that at a. In the case of the numerator you can write

int(x*p(x),'x',a,b) = int((x-mu)*p(x),'x',a,b) + mu*int(p(x),'x',a,b)

Since this is the normal distribution, the first of these terms is easy to integrate and gives sigma^2*(p(a)-p(b)), while the second term is again obtained from the difference between cdf's.

Roger Stafford
 |  Next  |  Last
Pages: 1 2
Prev: Movie out of .fig files?
Next: Size of Hex Strings