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.

8 comments:

Stace 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

marcus 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!

Microsoft Office 2007 said...

NEVERTHELESS, THE CIVIL LAW is and must be neutral about who has a more noble or rewarding faith. The breakaway parishes ought to win every Office 2010facet of the lawsuit not becauseMicrosoft Office 2010 their beliefs or their politics are better, Microsoft wordbut because both lawOffice 2007and equity, along with common sense, are on Microsoft Officetheir side.Microsoft Office 2007 Not only does Virginia state law (the Division Statute)Office 2007 keyexplicitly apply to just such a Office 2007 downloadsituation as now exists, but the history Office 2007 Professionalespecially of The Falls Church argues against the claims of Outlook 2010the Virginia Diocese with which theyMicrosoft outlookhave disassociated.Microsoft outlook 2010First, The Falls Church wasWindows 7 founded, formed, and developed long before the diocese, or the national Episcopal Church, even existed.

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]