LISTSERV at the University of Georgia
Menubar Imagemap
Home Browse Manage Request Manuals Register
Previous messageNext messagePrevious in topicNext in topicPrevious by same authorNext by same authorPrevious page (May 2001)Back to main SPSSX-L pageJoin or leave SPSSX-L (or change settings)ReplyPost a new messageSearchProportional fontNon-proportional font
Date:         Thu, 10 May 2001 10:25:07 -0500
Reply-To:     "Marso, David" <dmarso@SPSS.COM>
Sender:       "SPSSX(r) Discussion" <SPSSX-L@LISTSERV.UGA.EDU>
From:         "Marso, David" <dmarso@SPSS.COM>
Subject:      Re: bootstrap

>Date: Wed, 9 May 2001 23:01:20 +0200 >From: Jan Ivanouw <ivanouw@POST8.TELE.DK> >Subject: bootstrap

>Hi >I have been wondering if there is an easy way to make bootstrap >calculations with SPSS. The problem is that the bootstrap uses >repeated resampling *with* replacement, meaning that the same >cases may contribute several times to the calculation.

>I am thinking about possible solutions: >1. you could use a laborious procedure: first to replicate each >case a lot of times (how to do that with a macro?), and then take >random samples from this worksheet. >2. is there a more elegant way

>Jan Ivanouw >ivanouw@post8.tele.dk

Here is something I whipped together ages ago. HTH David Marso SPSS BI Consulting Consultant ------------------------- data list free/ x y z. begin data 1 2 1 2 2 3 1 2 3 4 1 2 4 1 2 2 4 1 3 2 1 5 4 2 3 4 2 2 3 4 3 1 2 3 1 2 3 1 2 3 2 3 5 1 2 5 2 3 5 2 5 4 2 3 3 5 4 3 2 1 end data. DESC X Y .

* Turn the data sideways * . VECTOR CASEX (20)/CASEY(20). COMPUTE CASEX($CASENUM)=X . COMPUTE CASEY($CASENUM)=Y . COMPUTE NOBREAK=0.

AGGREGATE OUTFILE * / BREAK NOBREAK / CASEX01 TO CASEX20=MAX(CASEX1 TO CASEX20) / CASEY01 TO CASEY20=MAX(CASEY1 TO CASEY20).

VECTOR CASEX=CASEX01 TO CASEX20. VECTOR CASEY=CASEY01 TO CASEY20. VECTOR SUBX(20) SUBY(20) SUBXY(20).

Loop SAMPLE=1 To 2000. + * Initialize a vector of Case indicators * . + LOOP #INDEX=1 TO 20. + COMPUTE CASE=TRUNC(UNIFORM(20)+1). + COMPUTE SUBX(#INDEX)=CASEX(CASE). + COMPUTE SUBY(#INDEX)=CASEY(CASE). + COMPUTE SUBXY(#INDEX)=SUBX(#INDEX)* SUBY(#INDEX). + END LOOP.

+ * Crunch our numbers * . + COMPUTE MeanX=MEAN(SUBX1 TO SUBX20). + COMPUTE SDX=SD(SUBX1 TO SUBX20). + COMPUTE MeanY=MEAN(SUBY1 TO SUBY20). + COMPUTE SDY=SD(SUBY1 TO SUBY20). + COMPUTE SUMXY=SUM( SUBXY1 TO SUBXY20). + COMPUTE COV=((SUMXY-20*MeanX*MEANY)/19). + COMPUTE COR=COV/(SDX*SDY).

+ * Dump out the result * . + XSAVE OUTFILE 'SuffStat.SAV' / KEEP MEANX MEANY SDX SDY COV COR. END LOOP.

EXECUTE. GET FILE 'SuffStat.SAV' .

* Play around * .

FREQUENCIES VARIABLES meanx meany sdx sdy cov cor / FORMAT NOTABLE / stat MEAN STDDEV / HISTOGRAM.


Back to: Top of message | Previous page | Main SPSSX-L page