Hello, I have been trying to modify a macro from the help manual for bootstrapping equations. I would like to bootstrap samples for two equations but I would like the bootstrapped samples for equation 1 to correspond to the samples used to estimate equation 2, i.e. I would like to bootstrap B=1000 samples and run two different equations on each of the 1000 samples and I want to save the parameters from each equation in separate data files.
M = a0 + a1X
(1)Y = b0 + b1X + b2M
(2) I have been modifying the syntax but I don't know how to write macros, and I am not using the "set seed" command properly or in the right place in the macro. There may be other errors that I haven't noticed as well. I have pasted the syntax for Equation 1 that I have been using down below. If anyone can point me in the right direction I would greatly appreciate it. Lisa Lambert PRESERVE.SET TVARS NAMES.OMS /DESTINATION VIEWER=NO /TAG='SUPPRESSALL'.OMS /SELECT TABLES /IF COMMANDS=['REGRESSION'] SUBTYPES=['COEFFICIENTS'] /DESTINATION FORMAT=SAV OUTFILE='H:\ COEFF.SAV' /COLUMNS DIMNAMES=['VARIABLES' 'STATISTICS'] /TAG='REG_COEFF'. DEFINE regression_bootstrap (samples=!TOKENS(1) /depvar=!TOKENS(1) /indvars=!CMDEND) COMPUTE dummyvar=1.AGGREGATE /OUTFILE='d:\temp\med.sav' /BREAK=dummyvar /filesize=N.MATCH FILES FILE=* /TABLE='d:\temp\med.sav' /BY dummyvar.!DO !other=1 !TO !samplesSET SEED=7654321.WEIGHT OFF.FILTER OFF.DO IF $casenum=1.- COMPUTE #samplesize=filesize.- COMPUTE #filesize=filesize.END IF.DO IF (#samplesize>0 and #filesize>0).- COMPUTE sampleWeight=rv.binom(#samplesize, 1/#filesize).- COMPUTE #samplesize=#samplesize-sampleWeight.- COMPUTE #filesize=#filesize-1.ELSE.- COMPUTE sampleWeight=0.END IF.WEIGHT BY sampleWeight.FILTER BY sampleWeight.REGRESSION /STATISTICS COEFF /DEPENDENT !depvar /METHOD=ENTER !indvars.!DOEND!ENDDEFINE. GET FILE='H:\ mediation.sav'.regression_bootstrap samples=4 depvar= M indvars= X . OMSEND .
Lisa Schurer Lambert
J. Mack Robinson College of Business
Georgia State University
35 Broad Street, Room 1013
Atlanta GA 30303-4014
Phone: 404.463.9227
Email: lisalambert@gsu.edu