|
Hello,
I am new to this list (and SPSS) and have the following problem: I have a database out of which we are trying to predict death of children with pneumonia in the developing world. As we luckily do nto ahve that many deaths 43 out of 958 we would like to do the bootstrapping procedure to develop a repdcition model. We tried to split the database but the model gets too unstable... So< here is my coding (adjusted from what the help function in sPSS provides and it just does not work, any suggestions? Alternatively if this is easier for you you might send me your coding so I can adjust mine. PRESERVE. SET TVARS NAMES. DATASET DECLARE bootstrap_example. OMS /DESTINATION VIEWER=NO /TAG='suppressall'. OMS /SELECT TABLES /IF COMMANDS=['Regression'] SUBTYPES=['Coefficients'] /DESTINATION FORMAT=SAV OUTFILE='bootstrap_example' /COLUMNS DIMNAMES=['Variables' 'Statistics'] /TAG='reg_coeff'. DATASET ACTIVATE DataSet1. DEFINE regression_bootstrap (samples=!TOKENS(1) /depvar=!TOKENS(1) /indvars=!CMDEND) COMPUTE dummyvar=1. AGGREGATE /OUTFILE=* MODE=ADDVARIABLES /BREAK=dummyvar /filesize=N. DO REPEAT !other=1 !TO !samples. SET SEED RANDOM. 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. DATASET ACTIVATE DataSet1. Regression_bootstrap samples=100 depvar=Earlydeath indvars=Leucocytosis(1)Pulse(1) Treatmentarm(1)hypotensive (1). OMSEND. DATASET ACTIVATE bootstrap_example. FREQUENCIES VARIABLES=Leucocytosis_B Leucocytosis_BetaPulse_B Pulse_Beta Treatmentarm_B Treatmentarm_Beta hypotensive_B hypotensive_Beta meanO2_10percentdecrements_B meanO2_10percentdecrements_Beta /FORMAT NOTABLE /PERCENTILES= 2.5 97.5 /HISTOGRAM NORMAL. RESTORE. I have also added the coding for the logistic regression from the full dataset, just so you can see what the regression is supposed to look like: DATASET ACTIVATE DataSet1. LOGISTIC REGRESSION VARIABLES Earlydeath /METHOD=ENTER Leucocytosis Treatmentarm meanO2_10percentdecrements hypotensive Pulse /CONTRAST (Leucocytosis)=Indicator(1) /CONTRAST (Pulse)=Indicator(1) /CONTRAST (Treatmentarm)=Indicator(1) /CONTRAST (hypotensive)=Indicator(1) /PRINT=GOODFIT CI(95) /CRITERIA=PIN(0.05) POUT(0.10) ITERATE(20) CUT(0.5). Thanks! Miriam ===================== To manage your subscription to SPSSX-L, send a message to [hidden email] (not to SPSSX-L), with no body text except the command. To leave the list, send the command SIGNOFF SPSSX-L For a list of commands to manage subscriptions, send the command INFO REFCARD |
|
Miriam,
I don't know if this helps but I have attached the syntax for a bootstrapped logistic regression that I used on a research project earlier this year. I found the basic code for it on Raynald SPSS Tools website that I have placed the link for below: http://pages.infinit.net/rlevesqu/SampleSyntax.htm#Bootstrap The last portion of the syntax that begins with the AGGREGATE command was used to create a data file with specific portions of the output that I wanted to save to a new SPSS data file to obtain specific parameter estimates. Good luck. Michael Kruger > > PRESERVE. > SET TVARS NAMES. > > ***first OMS command just suppresses Viewer output***. > OMS /DESTINATION VIEWER=YES. > > DATASET DECLARE bootstrap_example. > > ***select regression coefficients tables and write to data file***. > ***Note that DIMNAMES values vary based on output language***. > ***/COLUMNS SEQUENCE=[R2 C1] will achieve the same result in all languages***. > > OMS /SELECT TABLES > /IF COMMANDS=['Logistic Regression'] SUBTYPES = ['Variables in the Equation'] > /DESTINATION FORMAT=SAV OUTFILE='bootstrap_example' > /COLUMNS DIMNAMES=['Variables' 'Statistics'] > /TAG='logeg_coeff'. > > ***define a macro to draw samples with replacement and run Regression commands***. > DEFINE regression_bootstrap (samples=!TOKENS(1) > /depvar=!TOKENS(1) > /indvars=!CMDEND) > > COMPUTE dummyvar=1. > AGGREGATE > /OUTFILE = * MODE = ADDVARIABLES > /BREAK=dummyvar > /filesize=N. > !DO !other=1 !TO !samples > SET SEED RANDOM. > 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. > > LOGISTIC REGRESSION VARIABLES survival > /METHOD = ENTER Race_Cat Best_GA Steroid AC PPROM FL_Cat > /CONTRAST (Race_Cat)=Deviation(1) /CONTRAST (Steroid)=Indicator(1) /CONTRAST (PPROM)=Indicator(1) > /CONTRAST (FL_Cat)=Indicator(1) > /PRINT = CI(95) > /CRITERIA = PIN(.05) POUT(.10) ITERATE(20) CUT(.5) . > > !DOEND > !ENDDEFINE. > > ***insert any valid path\data file name***. > GET FILE='e:\miscellaneous\ms_rbs_2009.sav'. > ***Call the macro, and specify number of samples, dependent variable, and independent variables***. > regression_bootstrap > samples=1000 > > OMSEND. > > DATASET ACTIVATE bootstrap_example. > > RESTORE. > > AGGREGATE > /OUTFILE='J:\Documents\FILES\RBS\MS_RBS_2009_AGGR.sav' > /BREAK=Var2 > /B_mean=MEAN(B) > /B_mi=Min(B) > /B_max=Max(B) > /ExpB_mean=MEAN(ExpB) > /Exp_B_min=Min(ExpB) > /Exp_B_max=Max(ExpB) > /Sig_mean=mean(Sig) > /S.E_mean=MEAN(S.E) > /Upper_mean=MEAN(Upper) > /Lower_mean=MEAN(Lower) > /N_BREAK=N. > ===================== To manage your subscription to SPSSX-L, send a message to [hidden email] (not to SPSSX-L), with no body text except the command. To leave the list, send the command SIGNOFF SPSSX-L For a list of commands to manage subscriptions, send the command INFO REFCARD |
|
Administrator
|
That is the old version of Raynald's site, and I don't think it is maintained any longer. For the new version, go to: http://www.spsstools.net/ http://www.spsstools.net/SampleSyntax.htm#Bootstrap
--
Bruce Weaver bweaver@lakeheadu.ca http://sites.google.com/a/lakeheadu.ca/bweaver/ "When all else fails, RTFM." PLEASE NOTE THE FOLLOWING: 1. My Hotmail account is not monitored regularly. To send me an e-mail, please use the address shown above. 2. The SPSSX Discussion forum on Nabble is no longer linked to the SPSSX-L listserv administered by UGA (https://listserv.uga.edu/). |
| Free forum by Nabble | Edit this page |
