comp.lang.idl-pvwave archive
Messages from Usenet group comp.lang.idl-pvwave, compiled by Paulo Penteado

Home » Public Forums » archive » Generation of another Gaussian random variable from a given one...
Show: Today's Messages :: Show Polls :: Message Navigator
E-mail to friend 
Switch to threaded view of this topic Create a new topic Submit Reply
Generation of another Gaussian random variable from a given one... [message #94133] Fri, 27 January 2017 20:15 Go to next message
d.poreh is currently offline  d.poreh
Messages: 406
Registered: October 2007
Senior Member
Folks,
I have a Gaussian random variable with zero mean, and variance (f_x). I need to generate another Gaussian random variable with zero mean, and another variance, that would be correlated with the first one (f_x) with the correlation coefficient of say *r*.
I need some suggestions...
Thanks for any kind of helps in advances,
Cheers,
Dave
Re: Generation of another Gaussian random variable from a given one... [message #94134 is a reply to message #94133] Fri, 27 January 2017 20:29 Go to previous messageGo to next message
d.poreh is currently offline  d.poreh
Messages: 406
Registered: October 2007
Senior Member
On Saturday, January 28, 2017 at 7:45:38 AM UTC+3:30, dave poreh wrote:
> Folks,
> I have a Gaussian random variable with zero mean, and variance (f_x). I need to generate another Gaussian random variable with zero mean, and another variance, that would be correlated with the first one (f_x) with the correlation coefficient of say *r*.
> I need some suggestions...
> Thanks for any kind of helps in advances,
> Cheers,
> Dave

... I mean at the end we should have:
corr(f_x, f_y) = r
The correlation between two Gaussian random variable with zero mean, and variance should be = r
Re: Generation of another Gaussian random variable from a given one... [message #94135 is a reply to message #94134] Fri, 27 January 2017 20:54 Go to previous messageGo to next message
Jim  Pendleton is currently offline  Jim Pendleton
Messages: 165
Registered: November 2011
Senior Member
On Friday, January 27, 2017 at 9:29:50 PM UTC-7, dave poreh wrote:
> On Saturday, January 28, 2017 at 7:45:38 AM UTC+3:30, dave poreh wrote:
>> Folks,
>> I have a Gaussian random variable with zero mean, and variance (f_x). I need to generate another Gaussian random variable with zero mean, and another variance, that would be correlated with the first one (f_x) with the correlation coefficient of say *r*.
>> I need some suggestions...
>> Thanks for any kind of helps in advances,
>> Cheers,
>> Dave
>
> ... I mean at the end we should have:
> corr(f_x, f_y) = r
> The correlation between two Gaussian random variable with zero mean, and variance should be = r

If no IDL solution is quickly forthcoming, there's a similar discussion on stackexchange.com, with an algorithmic description. http://stats.stackexchange.com/questions/15011

An implementation is provided in R. I'm no expert on R syntax, but it looks like the code could be translated from R to IDL.

For validation of an IDL implementation against this reference, you could call R directly via python and the rpy2 bridge.

http://www.harrisgeospatial.com/Company/PressRoom/Blogs/IDLD ataPointDetail/TabId/902/ArtMID/2926/ArticleID/14718/Calling -the-R-Statistical-Package-from-IDL-via-Python.aspx

Jim P.
Re: Generation of another Gaussian random variable from a given one... [message #94137 is a reply to message #94135] Mon, 30 January 2017 02:54 Go to previous messageGo to next message
Markus Schmassmann is currently offline  Markus Schmassmann
Messages: 129
Registered: April 2016
Senior Member
On 01/28/2017 05:54 AM, Jim P wrote:
> On Friday, January 27, 2017 at 9:29:50 PM UTC-7, dave poreh wrote:
>> On Saturday, January 28, 2017 at 7:45:38 AM UTC+3:30, dave poreh wrote:
>>> I have a Gaussian random variable with zero mean, and variance
>>> (f_x). I need to generate another Gaussian random variable with
>>> zero mean, and another variance, that would be correlated with
>>> the first one (f_x) with the correlation coefficient of say *r*.
>>> I need some suggestions... Thanks for any kind of helps in
>>> advances,
>>
>> ... I mean at the end we should have: corr(f_x, f_y) = r The
>> correlation between two Gaussian random variable with zero mean,
>> and variance should be = r
>
> If no IDL solution is quickly forthcoming, there's a similar
> discussion on stackexchange.com, with an algorithmic description.
> http://stats.stackexchange.com/questions/15011
>
> An implementation is provided in R. I'm no expert on R syntax, but
> it looks like the code could be translated from R to IDL.
>
> For validation of an IDL implementation against this reference, you
> could call R directly via python and the rpy2 bridge.
>
> http://www.harrisgeospatial.com/Company/PressRoom/Blogs/IDLD ataPointDetail/TabId/902/ArtMID/2926/ArticleID/14718/Calling -the-R-Statistical-Package-from-IDL-via-Python.aspx
Hi Dave,

is this what you are looking for?

https://harrisgeospatial.com/docs/generate_correlated_data.h tml

http://www.cis.rit.edu/~cnspci/media/software/generate_corre lated_data.pro

If not, a while back I wrote a function to get 3d random variables given
mean, stdDev and correlations that can process multiple such triplets in
parallel and doesn't break down on impossible inputs.

If you want that I can send it to you, but you'd have to modify it
yourself to make it work in 2d.

Good Luck, Markus
Re: Generation of another Gaussian random variable from a given one... [message #94138 is a reply to message #94137] Tue, 31 January 2017 07:57 Go to previous message
d.poreh is currently offline  d.poreh
Messages: 406
Registered: October 2007
Senior Member
On Monday, January 30, 2017 at 11:54:36 AM UTC+1, Markus Schmassmann wrote:
> On 01/28/2017 05:54 AM, Jim P wrote:
>> On Friday, January 27, 2017 at 9:29:50 PM UTC-7, dave poreh wrote:
>>> On Saturday, January 28, 2017 at 7:45:38 AM UTC+3:30, dave poreh wrote:
>>>> I have a Gaussian random variable with zero mean, and variance
>>>> (f_x). I need to generate another Gaussian random variable with
>>>> zero mean, and another variance, that would be correlated with
>>>> the first one (f_x) with the correlation coefficient of say *r*.
>>>> I need some suggestions... Thanks for any kind of helps in
>>>> advances,
>>>
>>> ... I mean at the end we should have: corr(f_x, f_y) = r The
>>> correlation between two Gaussian random variable with zero mean,
>>> and variance should be = r
>>
>> If no IDL solution is quickly forthcoming, there's a similar
>> discussion on stackexchange.com, with an algorithmic description.
>> http://stats.stackexchange.com/questions/15011
>>
>> An implementation is provided in R. I'm no expert on R syntax, but
>> it looks like the code could be translated from R to IDL.
>>
>> For validation of an IDL implementation against this reference, you
>> could call R directly via python and the rpy2 bridge.
>>
>> http://www.harrisgeospatial.com/Company/PressRoom/Blogs/IDLD ataPointDetail/TabId/902/ArtMID/2926/ArticleID/14718/Calling -the-R-Statistical-Package-from-IDL-via-Python.aspx
> Hi Dave,
>
> is this what you are looking for?
>
> https://harrisgeospatial.com/docs/generate_correlated_data.h tml
>
> http://www.cis.rit.edu/~cnspci/media/software/generate_corre lated_data.pro
>
> If not, a while back I wrote a function to get 3d random variables given
> mean, stdDev and correlations that can process multiple such triplets in
> parallel and doesn't break down on impossible inputs.
>
> If you want that I can send it to you, but you'd have to modify it
> yourself to make it work in 2d.
>
> Good Luck, Markus

Thanks Markus, the one that u gave me is sufficient for me and works perfect :).
@ Jim> I do not know R, so I have to work with the IDL one, anyhow, thanks a lot for sharing :),
Cheers Guys
Dave
  Switch to threaded view of this topic Create a new topic Submit Reply
Previous Topic: GDL 0.9.7 delivered
Next Topic: How to make long program keep going if error comes??

-=] Back to Top [=-
[ Syndicate this forum (XML) ] [ RSS ] [ PDF ]

Current Time: Wed Oct 08 09:22:52 PDT 2025

Total time taken to generate the page: 0.00429 seconds