* For the trial analyses, the program was set to read a raw data file and then process the active SPSS data file -- see the "GET data" command near the start of the program. However, any SPSS system file can be specified on the GET statement; Alternatively, the READ statement (a MATRIX--END MATRIX command) can also be used to read a raw data file. A data matrix can also be entered directly, within the MATRIX--END MATRIX program (see the example further below). * DETECT Data Set A, from www.LevelsOfAnalysis.com variables: DYAD NEGOT SATIS PERF. data list free / DYAD NEGOT SATIS PERF. begin data. 1 14 14 32 1 22 28 33 3 13 16 39 3 26 26 39 4 26 22 36 4 16 20 35 6 16 16 26 6 24 22 27 7 23 24 27 7 15 22 26 2 20 23 22 2 13 19 22 5 18 15 20 5 22 23 20 8 21 25 4 8 14 17 3 9 27 24 2 9 14 19 4 10 25 25 18 10 15 17 20 31 14 14 32 31 22 28 33 33 13 16 39 33 26 26 39 34 26 22 36 34 16 20 35 36 16 16 26 36 24 22 27 37 23 24 27 37 15 22 26 32 20 23 22 32 13 19 22 35 18 15 20 35 22 23 20 38 21 25 4 38 14 17 3 39 27 24 2 39 14 19 4 40 25 25 18 40 15 17 20 end data. descriptives var = all. sort cases by dyad. set length=none printback = off width = 120 mxloops = 9000. matrix. * WABA - Moderated Regression Analysis. * Sources: * Schriesheim (1995) Leadership Quarterly, 6, 1-8. * Schriesheim et al (1995) Leadership Quarterly, 6, 111-145. * Schriesheim et al (1998) Academy of Management Journal, 41, 298-318. * This WABA program focuses on the interaction between two variables in the prediction of a third. It is a WABA extension of regular moderated multiple regression. All variables must be continuous. * Prepare a raw data matrix for analysis, where rows = cases, & columns = variables. * Each row contains the data from a single individual. * The values/variables in each row are separated from each other by one or more spaces. * Cases with missing values are not permitted in the data file. * The first value in each row (i.e., the first column of values in the data file) must be the individuals' group numbers/codes, which must be integers. The program sorts individuals into groups on the basis of these numbers/codes. * Variable scores appear in subsequent columns. * The second value in each row (i.e., the second column of values in the data file) are treated by the program as the Dependent/Outcome variable. * The third value in each row (i.e., the third column of values in the data file) are treated by the program as the Independent/Predictor variable. * The fourth value in each row (i.e., the fourth column of values in the data file) are treated by the program as the Moderator variable (technically also an IDV/predictor). * There is no need to enter product term variables or to enter composite variable scores. The program takes care of these aspects of the analyses internally. * Use the following name for the raw data matrix: "alldata". * The following command causes the program to process the currently active SPSS data file. get alldata / file = *. * Data can also be entered into the program directly, as in the following example using the "compute alldata = {" command. * DETECT Data Set A, from www.LevelsOfAnalysis.com variables: DYAD NEGOT SATIS PERF. compute alldata = { 1, 14, 14, 32; 1, 22, 28, 33; 3, 13, 16, 39; 3, 26, 26, 39; 4, 26, 22, 36; 4, 16, 20, 35; 6, 16, 16, 26; 6, 24, 22, 27; 7, 23, 24, 27; 7, 15, 22, 26; 2, 20, 23, 22; 2, 13, 19, 22; 5, 18, 15, 20; 5, 22, 23, 20; 8, 21, 25, 4; 8, 14, 17, 3; 9, 27, 24, 2; 9, 14, 19, 4; 10, 25, 25, 18; 10, 15, 17, 20; 31, 14, 14, 32; 31, 22, 28, 33; 33, 13, 16, 39; 33, 26, 26, 39; 34, 26, 22, 36; 34, 16, 20, 35; 36, 16, 16, 26; 36, 24, 22, 27; 37, 23, 24, 27; 37, 15, 22, 26; 32, 20, 23, 22; 32, 13, 19, 22; 35, 18, 15, 20; 35, 22, 23, 20; 38, 21, 25, 4; 38, 14, 17, 3; 39, 27, 24, 2; 39, 14, 19, 4; 40, 25, 25, 18; 40, 15, 17, 20 }. * Remove the above "alldata" matrix before attempting to process your own data. * Done: The program will can now analyze the data. * specifying/creating the data for each set of analyses. * creating the IDV/Moderator Composite Variable. compute x = { make(nrow(alldata),1,1), alldata(:,3:4) }. compute y = alldata(:,2). compute b = inv(t(x) * x) * t(x) * y. compute comp = alldata(:,3) * b(2,1) + alldata(:,4) * b(3,1). compute alldata = { alldata, comp }. * creating the IDV/Moderator Product Term Composite Variable. compute product = alldata(:,3)&*alldata(:,4). compute x = { make(nrow(alldata),1,1), alldata(:,3:4), product }. compute y = alldata(:,2). compute b = inv(t(x) * x) * t(x) * y. compute comp=alldata(:,3)*b(2,1)+alldata(:,4)*b(3,1)+product*b(4,1). compute data = { alldata, comp }. * start of regular WABA analyses. compute nss = nrow(data). compute totmn = csum(data(:,2:ncol(data))) / nss. compute totdev = make( nss, ncol(data)-1, -9999). compute withdev = make( nss, ncol(data)-1, -9999). compute betwdev = make( nss, ncol(data)-1, -9999). compute grpns = make( 1, 1, -9999). compute first = 1. compute ngrps = 0. loop #luper1 = 2 to nss. do if data((#luper1),1) ne data((#luper1-1),1) or #luper1 = nss. do if #luper1 ne nss. compute last = #luper1 - 1. end if. do if #luper1 = nss. compute last = #luper1. end if. compute ngrps = ngrps + 1. compute tempdat = data(first:last,2:ncol(data)). compute cmean = csum(tempdat) / nrow(tempdat). compute grpns = { grpns ; (last - first) + 1 }. loop #luper2 = first to last. compute totdev(#luper2,:) = data(#luper2,2:ncol(data)) - totmn. compute withdev(#luper2,:) = data(#luper2,2:ncol(data)) - cmean. compute betwdev(#luper2,:) = cmean - totmn. end loop. compute first = #luper1. end if. end loop. * correlation matrix -- via z scores. compute tempdat = { totdev, betwdev, withdev }. compute sd = make(1, ncol(tempdat), -9999). compute zscores = make(nrow(tempdat), ncol(tempdat), -9999). compute n = nrow(tempdat). compute nm1 = n - 1. compute mean = csum(tempdat) / n. loop #aa = 1 to ncol(tempdat). compute sd(1,#aa) =sqrt (cssq((tempdat(:,#aa)- mean(1,#aa))) / nm1). compute zscores(:,#aa) = (tempdat(:,#aa) - mean(1,#aa)) / sd(1,#aa). end loop. compute cormat = (1 / nm1 ) * ( t(zscores) * zscores ) . compute nvars = nrow(cormat) / 3. * mean, sd, & correlation matrix -- via z scores. compute tempdat = data(:,2:ncol(data)). compute sd = make(1, ncol(tempdat), -9999). compute mean = csum(tempdat) / n. loop #aa = 1 to ncol(tempdat). compute sd(1,#aa) = sqrt (cssq((tempdat(:,#aa)- mean(1,#aa))) / nm1). end loop. print /title="WABA -- Moderated Regression" /spaces=2. print nss /title="Number of Individual Cases in the Data File:". print ngrps/title="Number of Groups in the Data File:". print nvars/title="Number of Variables for the Analyses:". print /title="All Significance Tests Are Two-Tailed". print { t(1:nvars), t(mean), t(sd) }/ /title="Variable Means and Standard Deviations" /clabels="Variable" "Mean" "Std. Dev."/format "f8.4". * Within- and Between-Groups Analysis of Variance. compute etabetw = diag( cormat( (nvars+1):(nvars*2), 1:nvars) ). compute etawith = diag( cormat( (nvars*2+1):(nvars*3), 1:nvars) ). compute etasq = { etabetw, etawith }&**2. * E tests. compute etests = etabetw &/ etawith. * dfs for the F values (Dansereau et al 1984, p. 125, 128, 172). compute dfnumt = make(5,1,(ngrps - 1)). compute dfdemt = make(5,1,(nss - ngrps)). compute dfnumc = make(5,1,(nss - ngrps)). compute dfdemc = make(5,1,(ngrps - 1)). * adjusting the dfs for the composite variables (Shriesheim 1995 p 11). compute dfdemt(4,1) = dfdemt(4,1) - 1. compute dfdemt(5,1) = dfdemt(5,1) - 2. compute dfdemc(4,1) = dfdemc(4,1) - 1. compute dfdemc(5,1) = dfdemc(5,1) - 2. * F tests. compute ftrad = (etests&**2) &* (dfdemt &/ dfnumt). compute fcrctd = ((etawith &/etabetw)&**2) &* (dfdemc &/ dfnumc). * sig levels for F. compute pftrad = 1 - fcdf(abs(ftrad),dfnumt(1,1),dfdemt(1,1)). compute pfcrctd = 1 - fcdf(abs(fcrctd),dfnumc(1,1),dfdemc(1,1)). * for displaying only the appropriate F results. compute fetas = { t(1:nvars), ftrad, dfnumt, dfdemt, pftrad }. loop #lupev = 1 to nvars. do if etawith(#lupev,1) > etabetw(#lupev,1). compute fetas(#lupev,2) = fcrctd(#lupev,1). compute fetas(#lupev,3) = dfnumc(#lupev,1). compute fetas(#lupev,4) = dfdemc(#lupev,1). compute fetas(#lupev,5) = pfcrctd(#lupev,1). end if. end loop. * Within- and Between-Groups Analysis of Covariance Analyses. compute rbetw=cormat( (nvars+1):(nvars*2) , (nvars+1):(nvars*2)). compute rwith=cormat( (nvars*2+1):(nvars*3) , (nvars*2+1):(nvars*3)). compute rbw = make(1, 4, -9999). loop #luper = 2 to 5. compute rbw = {rbw; 1, #luper, rbetw(1,#luper), rwith(1,#luper) }. end loop. compute rbw = rbw(2:nrow(rbw),:). * A test. compute atests=arsin(sqrt(1-(rbw(:,4)&**2)))- arsin(sqrt(1-(rbw(:,3)&**2))). * Z test. compute zbw = make(4, 1, -9999). do if ngrps > 3. loop #luper = 1 to 4. do if abs(rbw(#luper,3)) < 1 and abs(rbw(#luper,4)) < 1. compute zbxy =abs( 0.5* ((ln(1+abs(rbw(#luper,3)))) - (ln(1-abs(rbw(#luper,3))))) ). compute zwxy =abs( 0.5* ((ln(1+abs(rbw(#luper,4)))) - (ln(1-abs(rbw(#luper,4))))) ). compute zbw(#luper,1) = (zbxy - zwxy) / sqrt( (1/(nss-ngrps-2))+(1/(ngrps-3)) ). do if #luper = 3. compute zbw(#luper,1) = (zbxy - zwxy) / sqrt( (1/(nss-ngrps-2))+(1/(ngrps-3-1)) ). end if. do if #luper = 4. compute zbw(#luper,1) = (zbxy - zwxy) / sqrt( (1/(nss-ngrps-2))+(1/(ngrps-3-2)) ). end if. end if. end loop. end if. compute pzbw = 1 - cdfnorm(abs(zbw)) . * R test of practical sigificance. compute rbig = make(nrow(rbw), 2, -9999). loop #luper = 1 to nrow(rbw). loop #lupec = 3 to 4. do if abs(rbw(#luper,#lupec)) < 1. * rbig formula from Dansereau 1984 p 131. compute rbig(#luper,#lupec-2) = abs( rbw(#luper,#lupec) &/ sqrt ( 1 - rbw(#luper,#lupec)&**2 ) ). * rbig formula from Yamarino & Markham, 1992 p 170 = slightly diff. * compute rbig(#luper,#lupec-2) = rbw(#luper,#lupec) &/ ( ( (1 - (rbw(#luper,#lupec)&**2) )&**.6667) ). end if. end loop. end loop. * t-tests of statistical significance (Yamarino & Markham, 1992 p 170). compute dftb = make(4,1,(ngrps - 2)). compute dftw = make(4,1,(nss - ngrps - 1)). * adjusting the dfs for the composite variables (Shriesheim 1995 p 11). compute dftb(3,1) = dftb(3,1) - 1. compute dftb(4,1) = dftb(4,1) - 2. compute tb = rbig(:,1) &* sqrt(dftb). compute tw = rbig(:,2) &* sqrt(dftw). compute ptb = make( nrow(tb), 1, -9999 ). compute ptw = make( nrow(tw), 1, -9999 ). loop #luper = 1 to nrow(tb). compute ptb(#luper,1)=(1-tcdf(abs(tb(#luper,1)),dftb(#luper,1))) *2. compute ptw(#luper,1)=(1-tcdf(abs(tw(#luper,1)),dftw(#luper,1))) *2. end loop. * Within- and Between-Groups Components and Raw (Total) Correlations. compute compons = rbw. loop #luper = 1 to nrow(rbw). compute compons(#luper,3) = etabetw(rbw(#luper,1),1) * etabetw(rbw(#luper,2),1) * rbw(#luper,3). compute compons(#luper,4) = etawith(rbw(#luper,1),1) * etawith(rbw(#luper,2),1) * rbw(#luper,4). end loop. compute compons = { compons , (compons(:,3) + compons(:,4)) }. * A test of the between vs within components difference . compute aradians = arsin(sqrt(1-(compons(:,4)&**2))) - arsin(sqrt(1-(compons(:,3)&**2))). * Z test of the between vs within components difference . compute zbwc = make(nrow(compons), 1, -9999). do if ngrps > 3. loop #luper = 1 to nrow(compons). do if abs(compons(#luper,3)) < 1 and abs(compons(#luper,4)) < 1. compute zbxyc =abs( 0.5* ((ln(1+abs(compons(#luper,3)))) - (ln(1-abs(compons(#luper,3))))) ). compute zwxyc =abs( 0.5* ((ln(1+abs(compons(#luper,4)))) - (ln(1-abs(compons(#luper,4))))) ). compute zbwc(#luper,1) = (zbxyc - zwxyc) / sqrt( (1/(nss-ngrps-2))+(1/(ngrps-3)) ). do if #luper = 3. compute zbw(#luper,1) = (zbxy - zwxy) / sqrt( (1/(nss-ngrps-2))+(1/(ngrps-3-1)) ). end if. do if #luper = 4. compute zbw(#luper,1) = (zbxy - zwxy) / sqrt( (1/(nss-ngrps-2))+(1/(ngrps-3-2)) ). end if. end if. end loop. end if. compute pzbwc = (1 - cdfnorm(abs(zbwc))) * 2. print { etabetw(1,1), etawith(1,1), etests(1,1), fetas(1,2:5) } /title="WABA 1 Results -- Dependent Variable:" /spaces=1 /clabels= "Eta-Betw" "Eta-With" "E Test" "F" "df num" "dfdem" "p" /format "f8.4". print { etabetw(2,1), etawith(2,1), etests(2,1), fetas(2,2:5) } /title="WABA 1 Results -- Independent Variable:" /spaces=1 /clabels= "Eta-Betw" "Eta-With" "E Test" "F" "df num" "dfdem" "p" /format "f8.4". print { etabetw(3,1), etawith(3,1), etests(3,1), fetas(3,2:5) } /title="WABA 1 Results -- Moderator Variable:" /spaces=1 /clabels= "Eta-Betw" "Eta-With" "E Test" "F" "df num" "dfdem" "p" /format "f8.4". print { etabetw(4,1), etawith(4,1), etests(4,1), fetas(4,2:5) } /title="WABA 1 Results -- IDV+Moderator Composite Variable:" /spaces=1 /clabels= "Eta-Betw" "Eta-With" "E Test" "F" "df num" "dfdem" "p" /format "f8.4". print { etabetw(5,1), etawith(5,1), etests(5,1), fetas(5,2:5) } /title= "WABA 1 Results -- IDV+Moderator+Product Term Composite Variable:" /spaces=1 /clabels= "Eta-Betw" "Eta-With" "E Test" "F" "df num" "dfdem" "p" /format "f8.4". print /title=' E-test practical significance criteria & inductions:' /spaces=2. print /title=' E >= 1.30323 = Wholes - 15; E >= 1.73205 = Wholes - 30;'. print /title=' E <= 0.76733 = Parts - 15; E <= 0.57735 = Parts - 30;'. print /title= "WABA 2 Results: Independent Variable Predicting the Dependent Variable:". print { rbw(1,3:4), atests(1,1), zbw(1,1), pzbw(1,1) } /title=" " /clabels="r-Betw" "r-With" "A-test" "Z-test" "p"/format "f8.4". print { rbw(1,3), rbig(1,1), tb(1,1), dftb(1,1), ptb(1,1) } /title=" " /clabels="r-Betw" "R" "t-test" "df" "p"/format "f8.4". print { rbw(1,4), rbig(1,2), tw(1,1), dftw(1,1), ptw(1,1) } /title=" " /clabels="r-With" "R" "t-test" "df" "p"/format "f8.4". print /title= "WABA 2 Results: Moderator Variable Predicting the Dependent Variable:". print { rbw(2,3:4), atests(2,1), zbw(2,1), pzbw(2,1) } /title=" " /clabels="r-Betw" "r-With" "A-test" "Z-test" "p"/format "f8.4". print { rbw(2,3), rbig(2,1), tb(2,1), dftb(2,1), ptb(2,1) } /title=" " /clabels="r-Betw" "R" "t-test" "df" "p"/format "f8.4". print { rbw(2,4), rbig(2,2), tw(2,1), dftw(2,1), ptw(2,1) } /title=" " /clabels="r-With" "R" "t-test" "df" "p"/format "f8.4". print /title="WABA 2 Results: IDV+Moderator Composite Variable". print /title=" Predicting the Dependent Variable:". print { rbw(3,3:4), atests(3,1), zbw(3,1), pzbw(3,1) } /title=" " /clabels="r-Betw" "r-With" "A-test" "Z-test" "p"/format "f8.4". print { rbw(3,3), rbig(3,1), tb(3,1), dftb(3,1), ptb(3,1) } /title=" " /clabels="r-Betw" "R" "t-test" "df" "p"/format "f8.4". print { rbw(3,4), rbig(3,2), tw(3,1), dftw(3,1), ptw(3,1) } /title=" " /clabels="r-With" "R" "t-test" "df" "p"/format "f8.4". print /title="WABA 2 Results: IDV+Moderator+Product Term Composite Variable". print /title=" Predicting the Dependent Variable:". print { rbw(4,3:4), atests(4,1), zbw(4,1), pzbw(4,1) } /title=" " /clabels="r-Betw" "r-With" "A-test" "Z-test" "p"/format "f8.4". print { rbw(4,3), rbig(4,1), tb(4,1), dftb(4,1), ptb(4,1) } /title=" " /clabels="r-Betw" "R" "t-test" "df" "p"/format "f8.4". print { rbw(4,4), rbig(4,2), tw(4,1), dftw(4,1), ptw(4,1) } /title=" " /clabels="r-With" "R" "t-test" "df" "p"/format "f8.4". print /title="A-test practical significance criteria & inductions:". print /title=" A >= 0.2618 = Wholes - 15; A >= 0.5236 = Wholes - 30;". print /title=" A <= -0.2618 = Parts - 15; A <= -0.5236 = Parts - 30;". print /title="-9999 indicates the Z test could not be computed.". print /title="R-test practical significance criteria & inductions:". print /title=" R >= 0.26795 = S - 15; R >= 0.57735 = S - 30;". print /title="A value of -9999 indicates the t-test could not be computed.". print { compons(1,3:4), atests(1,1), zbw(1,1), pzbw(1,1) } /title="Components: Independent Variable Predicting the Dependent Variable:" /clabels="Betw" "With" "A-test" "Z-test" "p"/format "f8.4". print { compons(2,3:4), atests(2,1), zbw(2,1), pzbw(2,1) } /title="Components: Moderator Variable Predicting the Dependent Variable:" /clabels="Betw" "With" "A-test" "Z-test" "p"/format "f8.4". print /title="Components: IDV+Moderator Composite Variable Predicting". print { compons(3,3:4), atests(3,1), zbw(3,1), pzbw(3,1) } /title="the Dependent Variable:" /clabels="Betw" "With" "A-test" "Z-test" "p"/format "f8.4". print /title="Components: IDV+Moderator+Product Term Composite Variable". print { compons(4,3:4), atests(4,1), zbw(4,1), pzbw(4,1) } /title="Predicting the Dependent Variable:" /clabels="Betw" "With" "A-test" "Z-test" "p"/format "f8.4". print /title="A-test practical significance criteria & inductions:". print /title=" A >= 0.2618 = Wholes - 15; A >= 0.5236 = Wholes - 30;". print /title=" A <= -0.2618 = Parts - 15; A <= -0.5236 = Parts - 30;". print /title="-9999 indicates the Z test could not be computed.". print /title= "WABA: Moderated Hierarchical Regression Results for the Within Correlations:". * Step 2. compute r2idv = rbw(1,4) &**2. compute r2idvm = rbw(3,4) &**2. compute Fidvm = (r2idvm-r2idv) / ((1-r2idvm)/(nss-2-1)). compute dfnmidvm = 2. compute dfdmidvm = nss - 2 - 1. compute pidvm = 1 - fcdf(abs(Fidvm),dfnmidvm,dfdmidvm). print /title= "Step 2: Increment for the moderator variable, as a main effect, over the IDV". print /title= " i.e., for the IDV+Moderator Composite Variable over the IDV:". print {rbw(1,4), rbw(3,4), (r2idvm-r2idv), Fidvm, dfnmidvm, dfdmidvm, pidvm } /title=" Step 1 Step 2 Increment" /clabels="r-With" "r-With" "rsq ch" "F" "df num" "df dem" "p"/format "f8.4". * Step 3. compute r2xn = rbw(4,4) &**2. compute Fxn = (r2xn-r2idvm) / ((1-r2xn)/(nss-3-1)). compute dfnmxn = 3. compute dfdmxn = nss - 3 - 1. compute pxn = 1 - fcdf(abs(Fidvm),dfnmxn,dfdmxn). print /title="Step 3: Increment for the IDV+Moderator+Product Term:". print /title=" Composite Variable over the two main effects". print /title=" (i.e., over the IDV+Moderator Composite Variable):". print { rbw(3,4), rbw(4,4), (r2xn-r2idvm), Fxn, dfnmxn, dfdmxn, pxn } /title=" Step 1 Step 2 Increment" /clabels="r-With" "r-With" "rsq ch" "F" "df num" "df dem" "p"/format "f8.4". print /title= "WABA: Moderated Hierarchical Regression Results for the Between Correlations:". * Step 2. compute r2idv = rbw(1,3) &**2. compute r2idvm = rbw(3,3) &**2. compute Fidvm = (r2idvm-r2idv) / ((1-r2idvm)/(ngrps-2-1)). compute dfnmidvm = 2. compute dfdmidvm = ngrps - 2 - 1. compute pidvm = 1 - fcdf(abs(Fidvm),dfnmidvm,dfdmidvm). print /title= "Step 2: Increment for the moderator variable, as a main effect, over the IDV". print /title= " i.e., for the IDV+Moderator Composite Variable over the IDV:". print {rbw(1,3), rbw(3,3), (r2idvm-r2idv), Fidvm, dfnmidvm, dfdmidvm, pidvm} /title=" Step 1 Step 2 Increment" /clabels="r-Betw" "Betw" "rsq ch" "F" "df num" "df dem" "p"/format "f8.4". * Step 3. compute r2xn = rbw(4,3) &**2. compute Fxn = (r2xn-r2idvm) / ((1-r2xn)/(ngrps-3-1)). compute dfnmxn = 3. compute dfdmxn = ngrps - 3 - 1. compute pxn = 1 - fcdf(abs(Fidvm),dfnmxn,dfdmxn). print /title="Step 3: Increment for the IDV+Moderator+Product Term:". print /title=" Composite Variable over the two main effects". print /title=" (i.e., over the IDV+Moderator Composite Variable):". print { rbw(3,3), rbw(4,3), (r2xn-r2idvm), Fxn, dfnmxn, dfdmxn, pxn} /title=" Step 1 Step 2 Increment" /clabels="r-Betw" "Betw" "rsq ch" "F" "df num" "df dem" "p"/format "f8.4". end matrix.