[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: normal_inv behavior
From: |
Mikko Leppänen |
Subject: |
Re: normal_inv behavior |
Date: |
Tue, 8 Jul 2003 00:46:11 -0500 |
User-agent: |
Mutt/1.3.28i |
Hi,
On Mon, Jul 07, 2003 at 10:12:45PM -0500, Claude Gamache wrote:
> I am getting what I think to be a bug with the function normal_inv.
Fortunately this is not the case.
> When you run the following lines:
>
> dist_sigma = 0.7;
> dist = normal_inv( dist_rand, dist_mean, dist_sigma);
> dist_calc_std = std(dist)
>
> I get the following results:
> dist_calc_std = 0.82814
>
> But the standard deviation should be very close to 0.7, not 0.82...
>
> I get the same kind of error with dist_sigma=3.5
> dist_calc_std = 1.8623 <---- this should be very close to 3.5...
>
> Am I doing something wrong or is this really a bug?
It seems that you have slightly missread the documentation for
normal_inv. The third parameter of the function is the variance, not the
standard deviation. As you probably know, variance is the square of
standard deviation, so you should probably call
normal_inv( dist_rand, dist_mean, dist_sigma.^2);
And indeed, 0.82814^2 ~ 0.686, and 1.8623^2 ~ 3.47.
Hope this helps,
--
Mikko Leppänen
-------------------------------------------------------------
Octave is freely available under the terms of the GNU GPL.
Octave's home on the web: http://www.octave.org
How to fund new projects: http://www.octave.org/funding.html
Subscription information: http://www.octave.org/archive.html
-------------------------------------------------------------
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- Re: normal_inv behavior,
Mikko Leppänen <=