Do not input private or sensitive data. View Qlik Privacy & Cookie Policy.
Skip to main content

Announcements
Qlik Open Lakehouse is Now Generally Available! Discover the key highlights and partner resources here.
cancel
Showing results for 
Search instead for 
Did you mean: 
alec1982
Specialist II
Specialist II

Create random values using NORMINV(RAND(),Mean,STD)

hi all,

wondering if someone can help on this.

I am trying to generate random values using NORMINV(RAND(),Mean,STD) where Mean and STD are values from another table.

to create 1000 random values I can use:

MonteCarlo:

Load

RecNo()  AS Instance,

NORMINV(RAND(),5,2)  AS [Assumption1]

AUTOGENERATE(1000);                      //where 5 and 2 are the mean and STD.

Now, how can I generate 1000 random values ([Assumption1]) for each ID in a resident table that looks as follow

ID, Mean, STD

1, 500,30

2,400,20

3,300,50

1 Solution

Accepted Solutions
swuehl
MVP
MVP

Just replace the INLINE table with your resident table:

LOAD

     ID,

     Iterno() as Instance,

     NORMINV(RAND(),Mean,STD) as [Assumption1]

RESIDENT MeanSTD

WHILE iterno() <=1000;

View solution in original post

3 Replies
swuehl
MVP
MVP

LOAD

     ID,

     Iterno() as Instance,

     NORMINV(RAND(),Mean,STD) as [Assumption1]

INLINE [

ID, Mean, STD

1, 500,30

2,400,20

3,300,50

]

WHILE iterno() <=1000;

alec1982
Specialist II
Specialist II
Author

Hi Swuehl,

I added the table as a sample of my original table which has about 300 lines.. so the inline load will not work. Any idea on how can i reference the table giving that the table name is MeanSTD..

swuehl
MVP
MVP

Just replace the INLINE table with your resident table:

LOAD

     ID,

     Iterno() as Instance,

     NORMINV(RAND(),Mean,STD) as [Assumption1]

RESIDENT MeanSTD

WHILE iterno() <=1000;