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 /ERRORBAR(CI 95)=salary BY minority. GRAPH /ERRORBAR(CI 95)=raisepct BY minority. REGRESSION /DEPENDENT salary /METHOD=ENTER minority. REGRESSION /DEPENDENT raisepct /METHOD=ENTER minority /scatterplot=(raisepct, minority). UNIANOVA salary BY minority /print=PARAMETER /DESIGN=minority. UNIANOVA raisepct BY minority /print=PARAMETER /DESIGN=minority /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 raisepct. GRAPH /ERRORBAR(CI 95)=raisepct BY gender. REGRESSION /* Problem: gender is a string variable*/ /DEPENDENT raisepct /METHOD=ENTER gender. * To work with REGRESSION we need to create an indicator/dummy variable. IF (gender ~= "") female = (gender = "f"). REGRESSION /DEPENDENT raisepct /METHOD=ENTER female. UNIANOVA raisepct BY gender /print=PARAMETER /plot=profile(gender) /DESIGN=gender. * Continuous independent variable. CORRELATIONS /VARIABLES=salary raisepct educ. graph /scatterplot(matrix) = salary raisepct educ. REGRESSION /DEPENDENT salary /METHOD=ENTER educ. * /scatterplot=(*pred, educ). GGRAPH /GRAPHDATASET NAME="graphdataset" VARIABLES=educ salary MISSING=LISTWISE REPORTMISSING=NO /GRAPHSPEC SOURCE=INLINE. BEGIN GPL SOURCE: s=userSource(id("graphdataset")) DATA: educ=col(source(s), name("educ"), unit.category()) DATA: salary=col(source(s), name("salary")) GUIDE: axis(dim(1), label("Educational Level (years)")) GUIDE: axis(dim(2), label("Current Salary")) SCALE: cat(dim(1), include("8", "12", "14", "15", "16", "17", "18", "19", "20", "21")) SCALE: linear(dim(2), include(0)) ELEMENT: point(position(educ*salary)) ELEMENT: line(position(smooth.linear(educ*salary))) END GPL. UNIANOVA raisepct WITH educ /print=PARAMETER /DESIGN=salbegin. * Specifying multiple independent variables. * Main effects. REGRESSION /DEPENDENT salary /METHOD=ENTER minority female salbegin. UNIANOVA salary WITH salbegin BY minority gender /print=PARAMETER /DESIGN=salbegin minority 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.