* Encoding: UTF-8. preserve. set printback=on. * Simulation of the Aronson & Mills (1959) Experiment Valentim R. Alferes, University of Coimbra (Portugal), 2019. * PART 1 - Randomization. * SIMPLE AND COMPLEX RANDOM ASSIGNMENT IN EXPERIMENTAL DESIGN (Version 4.0 / 2019) * BETWEEN-SUBJECTS DESIGNS. * Program: SRA-es.sps Method 3: Simple Random Assignment (Forced equal sizes) Completely Randomized Designs (Designs 1, 7, 14, 18, and 20). set printback=off. set ovars Both onumbers Both tvars Both tnumbers Both. set olang=English small=0 errors=none decimal=dot. data list list/nunit(f8.0) ntreat(f8.0). /* User's Specifications /* * Enter number of units per experiment and number of treatments. begin data 63 3 end data. save outfile='%temp%\fout0'. loop tperm=1 to ntreat. xsave outfile='%temp%\fout1'. end loop. get file='%temp%\fout1'. set rng=mt mtindex=random. compute rnperm=rv.uniform(0,1). execute. sort cases by rnperm(a). compute idperm=$casenum. execute. variable labels tperm"Random Permutation". save outfile='%temp%\fout2'. compute modsel=mod(nunit,ntreat). execute. sel if(idperm<=modsel). execute. save outfile='%temp%\fout3'/keep idperm tperm. get file='%temp%\fout0'. loop x=1 to nunit. xsave outfile='%temp%\fout4'/keep=ntreat nunit. end loop. get file='%temp%\fout4'. compute x=$casenum. compute Treatment=mod((x-1),ntreat)+1. if(x>nunit-mod(nunit,ntreat)) lrc=1. if(x<=nunit-mod(nunit,ntreat)) lrc=0. value labels Treatment 1"Control" 2"Mild" 3"Severe". execute. rank variables=x(a) by lrc/rank/print=no/ties=condense. if(lrc=1) idperm=rx. execute. match files/file=*/file='%temp%\fout3'/by idperm . execute. if(lrc=1) treatment=tperm. execute. sort cases by treatment(a) x(a). set rng=mt mtindex=random. compute rn=rv.uniform(0,1). execute. sort cases by rn(a). compute Unit=$casenum. execute. formats all(f8.0). save outfile='%temp%\fout0'. oms/select tables/if commands=["summarize"] subtypes=["case processing summary"]/destination viewer=no. oms/select tables/if commands=["crosstabs"] subtypes=["case processing summary"]/destination viewer=no. variable labels lrc"Last Replication Correction". value labels lrc 0"No" 1"Yes". get file='%temp%\fout2'. formats all(f8.0). summarize/tables=tperm/format=list nocasenum nototal /title='Last Replication Correction'/cells=none/footnote "Random Permutation = Order of treatments in the last replication "+ "when the Last Replication Correction is applied (see note at the "+ "botton of the output).". get file='%temp%\fout0'. summarize/tables=unit treatment/format=validlist nocasenum nototal /title='Simple Random Assignment \n Sorted by Unit \n'+ '(Sequential Assignment)'/cells=none. sort cases by treatment(a) unit(a). summarize/tables=treatment unit/format=validlist nocasenum nototal /title='Simple Random Assignment \n Sorted by Treatment/Unit \n'+ '(Captive Assignment)'/cells=none. summarize/tables=unit by treatment/format=nolist total /title='Number of Units per Treatment'/cells=count npct/footnote "If the number of units per experiment specified by the user is not "+ "a multiple of the number of treatments, Last Replication Correction "+ "is applied [see Procedure (c), Alferes, 2012, p. 27].". set printback=on. * PART 2 - Simulation of data. set printback=off. if (treatment=1) DV1=RV.NORMAL(80.2,13.2). if (treatment=1) DV2=RV.NORMAL(89.9,10.9). if (treatment=1) DV3=RV.NORMAL(170.1,21.6). if (treatment=2) DV1=RV.NORMAL(81.8,21.0). if (treatment=2) DV2=RV.NORMAL(89.3,14.1). if (treatment=2) DV3=RV.NORMAL(171.1,34.0). if (treatment=3) DV1=RV.NORMAL(97.6,16.6). if (treatment=3) DV2=RV.NORMAL(97.7,13.2). if (treatment=3) DV3=RV.NORMAL(195.3,31.9). execute. SORT CASES BY Treatment. SPLIT FILE LAYERED BY Treatment. OMS /SELECT TABLES /IF COMMANDS=['Descriptives'] SUBTYPES=['Descriptive Statistics'] /DESTINATION VIEWER=NO. DESCRIPTIVES VARIABLES=DV1 DV2 DV3 /SAVE /STATISTICS=MEAN STDDEV MIN MAX. SPLIT FILE OFF. if (treatment=1) Discussion=ZDV1*13.2+80.2. if (treatment=1) Participants=ZDV2*10.9+89.9. if (treatment=1) Total=ZDV3*21.6+170.1. if (treatment=2) Discussion=ZDV1*21.0+81.8. if (treatment=2) Participants=ZDV2*14.1+89.3. if (treatment=2) Total=ZDV3*34.0+171.1. if (treatment=3) Discussion=ZDV1*16.6+97.6. if (treatment=3) Participants=ZDV2*13.2+97.7. if (treatment=3) Total=ZDV3*31.9+195.3. execute. SPLIT FILE OFF. SORT CASES BY Treatment. SPLIT FILE LAYERED BY Treatment. OMS /SELECT TABLES /IF COMMANDS=['Descriptives'] SUBTYPES=['Descriptive Statistics'] /DESTINATION VIEWER=YES. DESCRIPTIVES VARIABLES=Discussion Participants Total /STATISTICS=MEAN STDDEV. SPLIT FILE OFF. set printback=on. * PART 3 - Running the t Tests. set printback=off. T-TEST GROUPS=Treatment(1 2) /MISSING=ANALYSIS /VARIABLES=Discussion /CRITERIA=CI(.95). T-TEST GROUPS=Treatment(1 3) /MISSING=ANALYSIS /VARIABLES=Discussion /CRITERIA=CI(.95). T-TEST GROUPS=Treatment(2 3) /MISSING=ANALYSIS /VARIABLES=Discussion /CRITERIA=CI(.95). T-TEST GROUPS=Treatment(1 2) /MISSING=ANALYSIS /VARIABLES=Participants /CRITERIA=CI(.95). T-TEST GROUPS=Treatment(1 3) /MISSING=ANALYSIS /VARIABLES=Participants /CRITERIA=CI(.95). T-TEST GROUPS=Treatment(2 3) /MISSING=ANALYSIS /VARIABLES=Participants /CRITERIA=CI(.95). T-TEST GROUPS=Treatment(1 2) /MISSING=ANALYSIS /VARIABLES=Total /CRITERIA=CI(.95). T-TEST GROUPS=Treatment(1 3) /MISSING=ANALYSIS /VARIABLES=Total /CRITERIA=CI(.95). T-TEST GROUPS=Treatment(2 3) /MISSING=ANALYSIS /VARIABLES=Total /CRITERIA=CI(.95). set printback=on. * PART 4 - Saving the data file. * See in the desktop the file "DesignData.sav". set printback=off. save outfile='%userprofile%\desktop\DesignData.sav'/keep=Unit Treatment Discussion Participants Total. get file='%userprofile%\desktop\DesignData.sav'. erase file='%temp%\fout0'. erase file='%temp%\fout1'. erase file='%temp%\fout2'. erase file='%temp%\fout3'. erase file='%temp%\fout4'. restore.