BFA_1

advertisement
COMMENT Bootstrap Factor Analysis Program I.
COMMENT by Linda Reichwein Zientek and Bruce Thompson
COMMENT The assistance of Raynald Levesque with the algorithm for adding the bootstrapped files is.
COMMENT gratefully appreciated.
COMMENT Highlighted portions of the program will need to be changed according to the data set,.
COMMENT number of factors, and variables. The color coding scheme is listed below. Once the.
COMMENT changes have been made, copy and paste the program into SPSS and run. This program is set.
COMMENT up to run 3 factors and calls a second program.
COMMENT Call Data Set.
COMMENT Variables.
COMMENT Number of loops.
COMMENT Corresponds to the number of factors. If more or less than 4 factors then add or subtract.
COMMENT variables to the target matrix and means and standard deviations.
COMMENT Calling Program II ('BFA_2.SPS').
COMMENT If you are running MORE THAN 2000 loops, ADD SET
MITERATE = # of loops. after SET MPRINT=yes. !boot nb=# of loops. SET
MPRINT=no. This is highlighted in red in the document.
COMMENT First save the data as a data file with the extension “sav”. This is important because otherwise
COMMENT there will be 2 active data files.
set mxloop=50000 results=none highres=off cache 100000 mprint=off.
set workspace= 100000 compressed=on printback=none.
get file='c:\holzinger.sav'
/keep= T6 T7 T9 T10
save outfile='c:\holz.sav'.
T12 T13 T14 T15 T17
.
get file='s:\holz.sav'.
dataset name active1 .
FACTOR
/MATRIX=OUT (FAC='c:\bootfac.sav')
/VARIABLES T6 T7 T9 T10 T12 T13 T14 T15 T17
/MISSING listwise
/ANALYSIS T6 T7 T9 T10 T12 T13 T14 T15 T17
/Print UNIVARIATE CORRELATION EXTRACTION ROTATION
/plot eigen
/FORMAT Sort /CRITERIA FACTORS 3 ITERATE(25)
/EXTRACTION PC /CRITERIA ITERATE(25)
/ROTATION VARIMAX
/METHOD=CORRELATION
/PRINT=extraction rotation.
dataset close active1 .
execute .
get file='c:\holz.sav'.
dataset name active2 .
numeric seqnum(f1) .
leave seqnum.
compute seqnum=sum(seqnum,1).
leave seqnum.
execute.
dataset close active2.
save outfile='c:\holz.sav'.
COMMENT CREATE TARGET MATRIX.
COMMENT bs and var001 etc correspond to the factor .
COMMENT Be sure to Add Commas between Abs(var00n)
get file='c:\bootfac.sav'.
dataset name active3.
FLIP
VARIABLES= T6 T7
T9 T10 T12 T13 T14 T15 T17
compute b1=0.
IF (ABS(var001)=max (ABS(var001), abs(var002)
IF (b1=1 and var001<0) b1=-1.
compute b2=0.
IF (ABS(var002)=max (ABS(var001), abs(var002)
IF (b2=1 and var002<0) b2=-1.
compute b3=0.
IF (ABS(var003)=max (abs(var001), abs(var002)
IF (b3=1 and var003<0) b3=-1.
.
, abs(var003) ) ) b1 = 1 .
, abs(var003) ) ) b2 = 1.
, abs(var003) ) ) b3 = 1.
COMMENT IF four factors, make the following adjustments:
COMMENT. compute b4=0.
COMMENT IF (ABS(var004)=max (abs(var001), abs(var002)
COMMENT IF (b4=1 and var004<0) b4=-1.
, abs(var003) , abs(var004) ) ) b4 = 1.
EXECUTE .
numeric seqnum(f1) .
leave seqnum.
compute seqnum=sum(seqnum,1).
leave seqnum.
execute.
save /outfile='c:\b1.sav'.
dataset close active3.
execute.
COMMENT Be sure to save the Program II to the correct drive.
COMMENT Following algorithm concatenating bootstrap results contributed by Raynald Levesque.
*//////////////////.
DEFINE !boot (nb=!TOKENS(1))
!DO !cnt=1 !TO !nb
INCLUDE 'c:\BFA_2.sps'.
!IF (!cnt=1) !THEN
GET FILE='C:\brotorig.SAV'.
!ELSE
ADD FILES FILE='c:\Tbrotorig.SAV'
/FILE='C:\brotorig.SAV'.
!IFEND
SAVE OUTFILE='c:\Tbrotorig.SAV'.
!IF (!cnt=1) !THEN
GET FILE='C:\eigenvorig.SAV'.
!ELSE
ADD FILES FILE='c:\Teigenvorig.SAV'
/FILE='C:\eigenvorig.SAV'.
!IFEND
SAVE OUTFILE='c:\Teigenvorig.SAV'.
!DOEND
!ENDDEFINE.
*//////////////////.
*The following macro call will do nb number of resampling. Add ADD SET MITERATE = # of loops. after
set mprint=no if you are running more than 1000 loops.
SET MPRINT=yes.
!boot nb=1000 .
SET MPRINT=no.
COMMENT Mean Bootstrap Results for Factor I.
COMMENT If var1000 corresponds to 1000 loops. If for example 10 loops are run.
COMMENT then change var1000 to var010.
get file='c:\Tbrotorig.sav'.
select if (seqnum=1).
rename variables col1=col01 col2=col02 col3=col03 col4=col04 col5=col05 col6=col06 col7=col07
col8=col08 col9=col09.
flip variables=col01 to col09.
compute mfac1=mean(var001 to var1000).
compute sdfac1=sd(var001 to var1000).
compute t_fac1=mfac1/sdfac1.
execute.
save outfile='c:\mfac1.sav'.
COMMENT Mean Bootstrap Results for Factor II.
get file='c:\Tbrotorig.sav'.
select if (seqnum=2).
rename variables col1=col01 col2=col02 col3=col03 col4=col04 col5=col05 col6=col06 col7=col07
col8=col08 col9=col09.
flip variables=col01 to col09.
compute mfac2=mean(var001 to var1000).
compute sdfac2=sd(var001 to var1000).
compute t_fac2=mfac2/sdfac2.
execute.
save outfile='c:\mfac2.sav'.
COMMENT Mean Bootstrap Results for Factor III.
COMMENT If more than three factors add the highlighted section and change seqnum to the.
COMMENT corresponding factor.
get file='c:\Tbrotorig.sav'.
dataset name active6.
select if (seqnum=3).
rename variables col1=col01 col2=col02 col3=col03 col4=col04 col5=col05 col6=col06 col7=col07
col8=col08 col9=col09.
flip variables=col01 to col09.
compute mfac3=mean(var001 to var1000).
compute sdfac3=sd(var001 to var1000).
compute t_fac3=mfac3/sdfac3.
execute.
dataset close active6.
save outfile='c:\mfac3.sav'.
COMMENT Mean Bootstrap Results for Eigenvalues.
get file='c:\Teigenvorig.sav'.
rename variables col1=col01 col2=col02 col3=col03 col4=col04 col5=col05 col6=col06 col7=col07
col8=col08 col9=col09.
flip variables=col01 to col09 .
compute meigenv=mean(var001 to var1000).
compute sdeigenv=sd(var001 to var1000).
compute t_eigen=meigenv/sdeigenv.
execute.
save outfile='c:\eigenv.sav'.
COMMENT If more than three factors then for each additional factor add (file=’c:\mfacnumber.sav’) .
COMMENT between file mfac3 and c:eigenv.
COMMENT Then add the corresponding mean sd and t_scores for each factor after t_fac3.
sort cases by case_lbl.
match files
file='c:\mfac1.sav' /
file='c:\mfac2.sav' /
file='c:\mfac3.sav' /
file='c:\eigenv.sav' /
by case_lbl /
keep=mfac1 sdfac1 t_fac1 mfac2 sdfac2 t_fac2
execute.
mfac3 sdfac3 t_fac3 meigenv sdeigenv t_eigen.
Download