Re: Multivariate Random Number Generator

From: Dennis Shea <shea_at_nyahnyahspammersnyahnyah>
Date: Tue, 20 May 2008 09:47:21 -0600

You can not pass in a covariance matrix
but you could create your own multivariate random number genereator.

EG

function multiVarRanNumGen( vAvg[*], vStd[*] , N[1]:integer)
local nAvg, nStd, x, nv
begin
    nAvg = dimsizes(vAvg)
    nStd = dimsizes(vStd)
    if (nAvg.ne.nStd) then
        print("multiVarRanNumGen: dimension mismatch: nAvg="+nAvg+" :
nStd="+nStd)
        exit
   end if

   x = new ( (/nAvg,N/), typeof(vAvg), getFillValue(vAvg) )
   do nv=0,nAvg-1
        x(nv,:) = random_normal( vAvg(nv), vStd(nv), N)
   end do

   return( x )
end
Bart Forman wrote:
> [snip]
> I have used these functions, but I was under the impression that these
> were only for the univariate case. Namely, I thought I could only
> pass in scalars. Is this not the case (i.e., I can actually specify a
> vector of mean quantities and a covariance matrix)?
>
> - Bart
>
>
>
>
> On May 20, 2008, at 8:12 AM, Dennis Shea wrote:
>
>> http://www.ncl.ucar.edu/Document/Functions/random.shtml
>>
>> Specidically:
>> http://www.ncl.ucar.edu/Document/Functions/Built-in/random_normal.shtml
>>
>> Good luck
>> Bart Forman wrote:
>>> Hello -
>>>
>>> Does a multivariate Gaussian (or log-normal) random number generator
>>> exist in NCL?
>>
>>> Any and all help would be greatly appreciated. Thank you in advance.
>>>
>>> Sincerely,
>>> Bart Forman

_______________________________________________
ncl-talk mailing list
ncl-talk_at_ucar.edu
http://mailman.ucar.edu/mailman/listinfo/ncl-talk
Received on Tue May 20 2008 - 09:47:21 MDT

This archive was generated by hypermail 2.2.0 : Mon Jun 02 2008 - 16:43:00 MDT