*==================================.
* Obtaining White's Standard Errors in SPSS.
* Gwilym Pryce, 18th May 2005.
*==================================.
* 1. Open up your data file and save it under a new name since the following procedure will alter it.
*You might find it easiest to create a directory in your C: drive called REGRESSION & copy you data file and syntax files into it .
*so that the following syntax will need minimal alterations.
*(you can obtain the correct syntax & directory for opening your file by clicking on File, Save As etc and selecting Paste).
GET FILE='C:\REGRESSION\miimortalitydata2005.sav'.
* 2. Run you OLS regression and save UNSTANDARDISED residuals as ehat:.
REGRESSION /DEPENDENT smr_0_64 /METHOD=ENTER fem_1664 househol singlpar unemploy ythunemp claim24 highered
/ SAVE RESID(ehat).
* 3. Filter out missing values and save the file UNDER A DIFFERENT NAME:.
*(you can obtain the correct syntax & directory for saving your file by clicking on File, Save As etc and selecting Paste).
SELECT IF(MISSING(ehat)) = 0.
EXECUTE.
SAVE OUTFILE='C:\REGRESSION\miimortalitydata2005_TEMP1.sav'.
*4. Open the file you have just saved and run the same regression again using your original syntax to check the results are the same: .
GET FILE='C:\REGRESSION\miimortalitydata2005_TEMP1.sav'.
REGRESSION /DEPENDENT smr_0_64 /METHOD=ENTER fem_1664 househol singlpar unemploy ythunemp claim24 highered .
*5. Now open and run the hcreg.sps syntax :.
*(open the file, block off the whole macro by pressing Ctrl+A, and run it by pressing Ctrl+R).
*NB you only need to do this step once unless you close and reopen SPSS. i.e. the macro program will stay active so long as you don't close SPSS.
*Now close the hcreg.sps syntax file.
*6. Now run the heteroskedasticity macro (by Andrew Hayes, Ohio State University).
* Basic syntax of the Hayes heteroskedasticity macro: "HCREG method = m dv = yvar iv = ivlist ."
* where yvar = dependent variable, and ivlist = list of independent variables .
* and where m is an integer between 0 and 3 which tells SPSS whether to run HC0, HC1, HC2 or HC3.
* For example, to obtain HC0 type and run the following:.
HCREG method = 0 dv = smr_0_64 iv = fem_1664 househol singlpar unemploy ythunemp claim24 highered .
* to obtain HC1 type and run the following:.
HCREG method = 1 dv = smr_0_64 iv = fem_1664 househol singlpar unemploy ythunemp claim24 highered .
* to obtain HC2 type and run the following:.
HCREG method = 2 dv = smr_0_64 iv = fem_1664 househol singlpar unemploy ythunemp claim24 highered .
* to obtain HC3 type and run the following:.
HCREG method = 3 dv = smr_0_64 iv = fem_1664 househol singlpar unemploy ythunemp claim24 highered .