Friday 9 March 2007

SEED to produce random samples of values

When you want to produce a random set of numbers - e.g.: randomly assigning cases to experimental treatments of group - one should set random number seed value if you want to get the same result.

Random generator is used by SAMPLE command to generate random samples and is used by several distribution functions (NORMAL, UNIFORM). Integer begins with SEED - large integer. At the start SEED is set to a value that may vary or may be fixed, depending on your current setting. The seed value changes each time a series of transformations contains one or more commands that use the random number generator.

To use the same random distribution within a session on in subsequent session, use SET SEED before each series of transformations that use the random number generator to explicitly set the seed value to a constant value.

[SPSS Syntax]
GET FILE = 'c:\file.sav'.
SET SEED = 123456789.
SAMPLE .1.
LIST.
SHOW SEED.
GET FILE = 'c:\file.sav'.
SET SEED = 123456789.
SAMPLE .1.
LIST.
[/SPSS Syntax]

Before the first sample is taken for the first time, the SET SEED is set. The LIST command causes data to be read and the generator number to be invoked once for each original case.

7 comments:

Anonymous said...

Do you have any advice on writing syntax in order to generate 2500 cases, with values ranging from 1 to 4 in spss?

I am a real novice with spss syntax so any advice you can offer would be greatly appreciated.

Thanks,

stace

jladyl@yahoo.com

Anonymous said...

stace,

Sure, no problem! you can contact me ilovespss -at- yahoo -dot- de.

normally generating 2500 cases is matter of loop function and generating cases from 1 to 4 is not a problem. You should only decide distribution of cases. SPSS by default uses NORM distribution so on 2500 cases you would have 1/4 of cases with value 1, 1/4 of 2, 1/4 of 3 and 1/4 of 4. which might be useless.

gethqnet said...

Thanks for such a great post and the review, I am totally impressed! Keep stuff like this coming.
Michael Jackson

Anonymous said...

Many women want Hardy clothing
. If you like vibrant fashion that is also edgy and sexy, you would certainly need to check out the ED Hardy Shoes
collection. Go for the sexy hardy shirt
and turn heads with your attitude and flamboyant style! Choose the beautiful ED Hardy Shoes

ugg boots günstig said...

Looking forward to a master to answer this question!

ugg boots günstig said...

View this article useful insights and support!

Cheap jordan said...

Have a look:
[b][url=http://www.newamytrade.com]Gucci shoes,cheap Gucci shoes,only 55USD[/url][/b]
If u want to order cheap
We offer the largest winter wear clothing collection in tht world for men, women and children, covering all forms of Overcoats, Jackets and Sweaters. Basic inner wear such as long johns in cotton, wool mix and accompanied by socks, shawls, gloves, shoes and even winter lip balm to ensure warm and complete fashionable winter attire. Combat the winter cold in warm style; our winter jackets and accessories are of top quality wool and leather, offered in various designs, texture and color.

We also carry a comprehensive selection of winter sports clothing and accessories from winter wear, underwear, sportwear, boots and caps to ski socks and sunglass. Hit the things in style.jerseys,cheap handbags,cheap winter coats,cheap shirts,cheap jewelry,
come here: [b][url=http://www.wearfoot.com]cheap oakley sunglasses, cheap tiffany jewelry, burberry ladies caots[/url][/b]
[url=http://www.handbags-zone.com]sell coach bags,buy designer handbags[/url]