Hello list,
I am interested in learning more about bootstrapping with SPSS. Any info on how to carry out standard bootstrapping and mean bootstrapping in SPSS would be useful (is it even possible in SPSS?). Specifically, I want to use bootstrapping to calculate coefficient of variation. -jesse This communication is intended for the use of the recipient to which it is addressed, and may contain confidential, personal and privileged information. Please contact the AADAC ITS Helpdesk at 780-422-2336 immediately if you are not the intended recipient of this communication, and do not copy, distribute, or take action relying on it. Any communication received in error, or subsequent reply, should be deleted from your system. |
Hi Jesse
JJ> I am interested in learning more about bootstrapping with SPSS. Any info JJ> on how to carry out standard bootstrapping and mean bootstrapping in JJ> SPSS would be useful (is it even possible in SPSS?). Specifically, I JJ> want to use bootstrapping to calculate coefficient of variation. Although you can use OMS or Python (depending on the SPSS version you are using) to do some bootstrapping, it can easily done with MATRIX. The following example (see below) bootstraps the mean and computes a 95% robust CI (using percentyles 2.5 and 97.5, there are better methods). It can be easily adapted to bootstrap de CV (simply by adding the computation of new statistics to the MATRIX code). There is also a contributed package for bootstrapping available at devcentral: http://www.spss.com/devcentral/index.cfm?pg=downloads Regards, Marta * Simple bootstrapping of the mean *. * Sample dataset *. DATA LIST FREE/copper(F8.2). BEGIN DATA 0.70 0.45 0.72 0.30 1.16 0.69 0.83 0.74 1.24 0.77 0.65 0.76 0.42 0.94 0.36 0.98 0.64 0.90 0.63 0.55 0.78 0.10 0.52 0.42 0.58 0.62 1.12 0.86 0.74 1.04 0.65 0.66 0.81 0.48 0.85 0.75 0.73 0.50 0.34 0.88 END DATA. VARIABLE LABEL copper'Urinary copper (µmol/24hr)'. * Initialize a random seed *. CACHE. EXE. SET SEED=RANDOM. PRESERVE. SET MXLOOPS=20000. * Bootstrap CI for mean *. MATRIX. GET data /VAR=ALL /NAMES=vname. COMPUTE n=NROW(data). COMPUTE mean=CSUM(data)/n. COMPUTE variance=(CSSQ(data)-n&*(mean&**2))/(n-1). PRINT {mean,variance} /FORMAT='F8.4' /RNAME=vname /CLABEL='Mean','Variance' /TITLE='Sample statistics'. COMPUTE k=20000. /* Number of bootsamples (change it if you want) *. COMPUTE bootmean=MAKE(k,1,0). COMPUTE bootsamp=MAKE(n,1,0). LOOP i=1 TO k. /* Extracting bootstrap samples *. - LOOP j= 1 TO n. - COMPUTE flipcoin=1+TRUNC(n*UNIFORM(1,1)). - COMPUTE bootsamp(j)=data(flipcoin)). - END LOOP. - COMPUTE bootmean(i)=CSUM(bootsamp)/n. END LOOP. * Gran mean of bootstrapped means *. COMPUTE mean=CSUM(bootmean)/k. * Ordered array: sorting algorithm by R Ristow & J Peck *. COMPUTE sortedbm=bootmean. COMPUTE sortedbm(GRADE(bootmean))=bootmean. * Median of bootstrapped means *. COMPUTE median=(sortedbm(k*0.5)+sortedbm(1+k*0.5))/2. * NP confidence interval *. COMPUTE lower=sortedbm(k*0.025). COMPUTE upper=sortedbm(1+k*0.975). PRINT {mean, median,lower,upper} /FORMAT='F8.4' /CLABEL='Mean','Median','Lower CL','Upper CL' /RNAME=vname /TITLE='95% boostrapped Statistics & 95%CI'. SAVE bootmean /OUTFILE='C:\Temp\BootStrappedMeans.sav' /NAMES=vname. PRINT /TITLE='20000 bootsampled means have been saved to C:\Temp\BootStrappedMeans.sav'. END MATRIX. RESTORE. GET FILE ='C:\Temp\BootStrappedMeans.sav' . FREQUENCIES VARIABLES=copper /FORMAT=NOTABLE /PERCENTILES= 2.5 97.5 /HISTOGRAM NORMAL /ORDER= ANALYSIS . |
In reply to this post by Jesse Jahrig
You should visit Ron Levesque's website (www.spsstools.net).
There you will find special macros and syntaxes upon bootstrapping. Enjoy Eric > Hello list, > > I am interested in learning more about bootstrapping with SPSS. Any info > on how to carry out standard bootstrapping and mean bootstrapping in > SPSS would be useful (is it even possible in SPSS?). Specifically, I > want to use bootstrapping to calculate coefficient of variation. > > -jesse > > This communication is intended for the use of the recipient to which it is > addressed, and may contain confidential, personal and privileged information. > Please contact the AADAC ITS Helpdesk at 780-422-2336 immediately if you are > not the intended recipient of this communication, and do not copy, > distribute, or take action relying on it. Any communication received in > error, or subsequent reply, should be deleted from your system. > |
Thank you to all who helped with my request.
-----Original Message----- From: SPSSX(r) Discussion [mailto:[hidden email]] On Behalf Of Eric Janssen Sent: Wednesday, November 08, 2006 7:47 AM To: [hidden email] Subject: Re: Bootstrapping in SPSS You should visit Ron Levesque's website (www.spsstools.net). There you will find special macros and syntaxes upon bootstrapping. Enjoy Eric > Hello list, > > I am interested in learning more about bootstrapping with SPSS. Any info > on how to carry out standard bootstrapping and mean bootstrapping in > SPSS would be useful (is it even possible in SPSS?). Specifically, I > want to use bootstrapping to calculate coefficient of variation. > > -jesse > > This communication is intended for the use of the recipient to which it is > addressed, and may contain confidential, personal and privileged information. > Please contact the AADAC ITS Helpdesk at 780-422-2336 immediately if you are > not the intended recipient of this communication, and do not copy, > distribute, or take action relying on it. Any communication received in > error, or subsequent reply, should be deleted from your system. > This communication is intended for the use of the recipient to which it is addressed, and may contain confidential, personal and privileged information. Please contact the AADAC ITS Helpdesk at 780-422-2336 immediately if you are not the intended recipient of this communication, and do not copy, distribute, or take action relying on it. Any communication received in error, or subsequent reply, should be deleted from your system. |
Free forum by Nabble | Edit this page |