Unlock a world of possibilities! Login now and discover the exclusive benefits awaiting you.
I am working on a sampling routine.
Our statistician wants to know if we can adjust the seed - his words not mine.
His expectation is if I re-load the data in the same order and pick a random row using the same seed then it would yield the same results.
I am not sure that's going to work but figured I would post in the community to see what everyone has to say.
Thanks
Dan
You can test with the QlikView Test Script and you'll see that with every reload it generates independent random values.
So the answers for your statistician are :
No: You cannot adjust the seed
No: It will not yield the same results when reloaded again
I ain't got clue how rand() actually works under the bonnet though.
***************************************************
Characters:
Load Chr(RecNo()+Ord('A')-1) as Alpha, RecNo() as Num autogenerate 26;
ASCII:
Load
if(RecNo()>=65 and RecNo()<=90,RecNo()-64) as Num,
Chr(RecNo()) as AsciiAlpha,
RecNo() as AsciiNum
autogenerate 255
Where (RecNo()>=32 and RecNo()<=126) or RecNo()>=160 ;
Transactions:
Load
TransLineID,
TransID,
mod(TransID,26)+1 as Num,
Pick(Ceil(3*Rand1),'A','B','C') as Dim1,
Pick(Ceil(6*Rand1),'a','b','c','d','e','f') as Dim2,
Pick(Ceil(3*Rand()),'X','Y','Z') as Dim3,
Round(1000*Rand()*Rand()*Rand1) as Expression1,
Round( 10*Rand()*Rand()*Rand1) as Expression2,
Round(Rand()*Rand1,0.00001) as Expression3;
Load
Rand() as Rand1,
IterNo() as TransLineID,
RecNo() as TransID
Autogenerate 1000
While Rand()<=0.5 or IterNo()=1;
I have never done it, but tried looking it up on Google and QV's help. From the looks of it, it doesn't seem it is possible, unless there is a work around available.
You can test with the QlikView Test Script and you'll see that with every reload it generates independent random values.
So the answers for your statistician are :
No: You cannot adjust the seed
No: It will not yield the same results when reloaded again
I ain't got clue how rand() actually works under the bonnet though.
***************************************************
Characters:
Load Chr(RecNo()+Ord('A')-1) as Alpha, RecNo() as Num autogenerate 26;
ASCII:
Load
if(RecNo()>=65 and RecNo()<=90,RecNo()-64) as Num,
Chr(RecNo()) as AsciiAlpha,
RecNo() as AsciiNum
autogenerate 255
Where (RecNo()>=32 and RecNo()<=126) or RecNo()>=160 ;
Transactions:
Load
TransLineID,
TransID,
mod(TransID,26)+1 as Num,
Pick(Ceil(3*Rand1),'A','B','C') as Dim1,
Pick(Ceil(6*Rand1),'a','b','c','d','e','f') as Dim2,
Pick(Ceil(3*Rand()),'X','Y','Z') as Dim3,
Round(1000*Rand()*Rand()*Rand1) as Expression1,
Round( 10*Rand()*Rand()*Rand1) as Expression2,
Round(Rand()*Rand1,0.00001) as Expression3;
Load
Rand() as Rand1,
IterNo() as TransLineID,
RecNo() as TransID
Autogenerate 1000
While Rand()<=0.5 or IterNo()=1;
Thanks.
That is what I expected just needed some backup to explain to the statistician that we can't do that.
Well, if you need the same sequence of "random" numbers on every reload, you could probably either
a) use a small VBScript calling RND / Randomize
or
b) create a set of numbers using QV script Rand() function, write this to a QVD and use this file