get file="y:\spss\data\employee data.sav". DATASET NAME Employees. compute raisepct = (salary/salbegin)**(1/trunc(jobtime/12))-1. execute. * Start with the t-test. T-TEST GROUPS=minority(0 1) /VARIABLES=salary raisepct. graph /histogram(normal)=salary /panel rowvar=minority. graph /histogram(normal)=raisepct /panel rowvar=minority. pplot variables=raisepct. examine salary by minority /plot=boxplot /nototal /statistics=none. graph /errorbar(sterrir 1.96)=salary by minority. graph /errorbar(sterrir 1.96)=raisepct by minority. REGRESSION /DEPENDENT salary /METHOD=ENTER minority. UNIANOVA salary BY minority /print=PARAMETER. * /DESIGN=minority. UNIANOVA salary BY minority /print=PARAMETER /plot=profile(minority). * Other commands that estimate this model are SUMMARIZE ANOVA ONEWAY GLM GENLIN. * Try the same model, comparing sexes. T-TEST GROUPS=gender("f" "m") /VARIABLES=salary. graph /errorbar(sterrir 1.96)=salary by gender. REGRESSION /* Problem: gender is a string variable*/ /DEPENDENT salary /METHOD=ENTER gender. * To work with REGRESSION we need to create an indicator/dummy variable. IF (gender ~= "") female = (gender = "f"). REGRESSION /DEPENDENT salary /METHOD=ENTER female. UNIANOVA salary BY gender /print=PARAMETER. * /DESIGN=gender. * Continuous independent variable. CORRELATIONS /VARIABLES=salary salbegin. REGRESSION /DEPENDENT salary /METHOD=ENTER salbegin. GGRAPH /GRAPHDATASET NAME="graphdataset" VARIABLES=salbegin salary /GRAPHSPEC SOURCE=INLINE. BEGIN GPL SOURCE: s=userSource(id("graphdataset")) DATA: salbegin=col(source(s), name("salbegin")) DATA: salary=col(source(s), name("salary")) GUIDE: axis(dim(2), label("Current Salary")) GUIDE: legend(aesthetic(aesthetic.color.interior), label("Employment Category")) ELEMENT: point(position(salbegin*salary)) ELEMENT: line(position(smooth.linear(salbegin*salary))) END GPL. REGRESSION /DEPENDENT salary /METHOD=ENTER salbegin /scatterplot (salary, salbegin) (*pred, salbegin). UNIANOVA salary WITH salbegin /print=PARAMETER /DESIGN=salbegin. * Specifying multiple independent variables. * Main effects. REGRESSION /DEPENDENT salary /METHOD=ENTER minority female salbegin. GGRAPH /GRAPHDATASET NAME="graphdataset" VARIABLES=salbegin salary minority MISSING=LISTWISE REPORTMISSING=NO /GRAPHSPEC SOURCE=INLINE. BEGIN GPL SOURCE: s=userSource(id("graphdataset")) DATA: salbegin=col(source(s), name("salbegin")) DATA: salary=col(source(s), name("salary")) DATA: minority=col(source(s), name("minority"), unit.category()) GUIDE: axis(dim(1), label("Beginning Salary")) GUIDE: axis(dim(2), label("Current Salary")) GUIDE: legend(aesthetic(aesthetic.color.exterior), label("Minority Classification")) SCALE: cat(aesthetic(aesthetic.color.exterior), include("0", "1")) ELEMENT: point(position(salbegin*salary), color.exterior(minority)) ELEMENT: line(position(smooth.linear(salbegin*salary)), color(minority)) END GPL. REGRESSION /DEPENDENT salary /METHOD=ENTER minority female salbegin /save=pred(salhat). GGRAPH /GRAPHDATASET NAME="graphdataset" VARIABLES=salbegin salary salhat minority /GRAPHSPEC SOURCE=INLINE. BEGIN GPL SOURCE: s=userSource(id("graphdataset")) DATA: salbegin=col(source(s), name("salbegin")) DATA: salary=col(source(s), name("salary")) DATA: salhat=col(source(s), name("salhat")) DATA: minority=col(source(s), name("minority"), unit.category()) GUIDE: axis(dim(1), label("Beginning Salary")) GUIDE: axis(dim(2), label("Current Salary")) GUIDE: legend(aesthetic(aesthetic.color.exterior), label("Minority Classification")) SCALE: cat(aesthetic(aesthetic.color.exterior), include("0", "1")) ELEMENT: point(position(salbegin*salary), color.exterior(minority)) ELEMENT: line(position(smooth.linear(salbegin*salhat)), color(minority)) END GPL. UNIANOVA salary WITH salbegin BY minority gender /print=PARAMETER /DESIGN=salbegin minority gender /plot=profile(minority*gender). /plot=profile(gender). *With interaction effects. UNIANOVA salary WITH salbegin BY minority gender /print=PARAMETER /DESIGN=minority gender salbegin minority*gender minority*salbegin gender*salbegin salbegin*minority*gender. * To do this with REGRESSION, we have to first calculate all the design components. compute minorityfemale = minority*female. compute minoritysalbegin = minority*salbegin. compute femalesalbegin = female*salbegin. compute threeway = female*minority*salbegin. REGRESSION /DEPENDENT salary /METHOD=ENTER minority female salbegin minorityfemale minoritysalbegin femalesalbegin threeway. REGRESSION /statistics=defaults change /DEPENDENT salary /METHOD=ENTER minority female salbegin /method=enter minorityfemale minoritysalbegin femalesalbegin /method=enter threeway. UNIANOVA salary WITH salbegin BY minority gender /method=SSTYPE(3) /print=PARAMETER /DESIGN=minority gender salbegin minority*gender minority*salbegin gender*salbegin salbegin*minority*gender. UNIANOVA salary BY jobcat gender minority /POSTHOC=jobcat(SCHEFFE) /PLOT=PROFILE(jobcat*gender jobcat*minority) /DESIGN=jobcat gender minority.