### SPSS Textbook Examples Applied Regression Analysis by John Fox Chapter 5: Linear least-squares regression

page 86 Figure 5.1 Scatterplot of Davis's data on the measured and reported weight of 101 women. The solid line give the least-squares fit; the broken line is Y = X. Both variables are discrete, since the weight is given to the nearest kilogram, but overplotting of points is not a serious problem here.

NOTE: There is an error in the data for subject number 12.

GET FILE='D:\davis.sav'.

if subject=12 measwt=57.
if subject=12 measht=166.
execute.

USE ALL.
COMPUTE filter_$=(female=1). VARIABLE LABEL filter_$ 'female=1 (FILTER)'.
VALUE LABELS filter_$0 'Not Selected' 1 'Selected'. FORMAT filter_$ (f1.0).
FILTER BY filter_$. EXECUTE. GGRAPH /GRAPHDATASET NAME="graphdataset" VARIABLES=reptwt measwt /GRAPHSPEC SOURCE=INLINE inlinetemplate="<addReferenceLine numberPoints='200' y='x'><style color='black' stroke-dasharray='5px,5px'/></addReferenceLine>". BEGIN GPL SOURCE: s=userSource(id("graphdataset")) DATA: reptwt=col(source(s), name("reptwt")) DATA: measwt=col(source(s), name("measwt")) GUIDE: axis(dim(1), label("Reported Weight, Kg")) GUIDE: axis(dim(2), label("Measured Weight, Kg")) ELEMENT: point(position(reptwt*measwt)) ELEMENT: line(position(smooth.linear(reptwt*measwt))) END GPL. page 89 The regression equation in the middle of the page. REGRESSION /DESCRIPTIVES=MEAN /STATISTICS COEFF OUTS R ANOVA /DEPENDENT measwt /METHOD=ENTER reptwt. Descriptive Statistics Mean N Measured Weight 57.23 101 Reported Weight 56.74 101 Variables Entered/Removed(b) Model Variables Entered Variables Removed Method 1 Reported Weight(a) . Enter a All requested variables entered. b Dependent Variable: Measured Weight Model Summary Model R R Square Adjusted R Square Std. Error of the Estimate 1 .955(a) .912 .911 2.057 a Predictors: (Constant), Reported Weight ANOVA(b) Model Sum of Squares df Mean Square F Sig. 1 Regression 4334.889 1 4334.889 1024.544 .000(a) Residual 418.873 99 4.231 Total 4753.762 100 a Predictors: (Constant), Reported Weight b Dependent Variable: Measured Weight Coefficients(a) Unstandardized Coefficients Standardized Coefficients t Sig. Model B Std. Error Beta 1 (Constant) 1.778 1.744 1.019 .311 Reported Weight .977 .031 .955 32.009 .000 a Dependent Variable: Measured Weight page 90 To get the standard error shown in the middle of the page,. take the square root of the mean square error, 4.231, listed in the. second row of the fourth column of the ANOVA table of the above . output. page 97 Table 5.1 Data on the U.S. States and Washington, D.C. in 1970: State per-capita public school expenditures (E, in dollars); per-capita annual income (I, in dollars); proportion of residents under 18 (S, per 1000); and proportion residing in urban areas (U, per 1000). GET FILE='D:\anscombe.sav'. list state educspnd income prop18 propurb. STATE EDUCSPND INCOME PROP18 PROPURB ME 189 2824 350.70 508 NH 169 3259 345.90 564 VT 230 3072 348.50 322 MA 168 3835 335.30 846 RI 180 3549 327.10 871 CT 193 4256 341.00 774 NY 261 4151 326.20 856 NJ 214 3954 333.50 889 PA 201 3419 326.20 715 OH 172 3509 354.50 753 IN 194 3412 359.30 649 IL 189 3981 348.90 830 MI 233 3675 369.20 738 WI 209 3363 360.70 659 MN 262 3341 365.40 664 IO 234 3265 343.80 572 MO 177 3257 336.10 701 ND 177 2730 369.10 443 SD 187 2876 368.70 446 NE 148 3239 349.90 615 KA 196 3303 339.90 661 DE 248 3795 375.90 722 MD 247 3742 364.10 766 DC 246 4425 352.10 1000 VA 180 3068 353.00 631 WV 149 2470 328.80 390 NC 155 2664 354.10 450 SC 149 2380 376.70 476 GA 156 2781 370.60 603 FL 191 3191 336.00 805 KY 140 2645 349.30 523 TN 137 2579 342.80 588 AL 112 2337 362.20 584 MS 130 2081 385.20 445 AR 134 2322 351.90 500 LA 162 2634 389.60 661 OK 135 2880 329.80 680 TX 155 3029 369.40 797 MT 238 2942 368.90 534 ID 170 2668 367.70 541 WY 238 3190 365.60 605 CO 192 3340 358.10 785 NM 227 2651 421.50 698 AZ 207 3027 387.50 796 UT 201 2790 412.40 804 NV 225 3957 385.10 809 WA 215 3688 341.30 726 OR 233 3317 332.70 671 CA 273 3968 348.40 909 AK 372 4146 439.70 484 STATE EDUCSPND INCOME PROP18 PROPURB HI 212 3513 382.90 831 Number of cases read: 51 Number of cases listed: 51  page 100 The regression coefficients listed at the top of the page. GET FILE='D:\duncan.sav'. REGRESSION /STATISTICS COEFF OUTS R ANOVA /DEPENDENT prestige /METHOD=ENTER educ income.  Variables Entered/Removed(b) Model Variables Entered Variables Removed Method 1 Percent of males in occupation earning$3500 or more in 1950, Percent of males in occupation in 1950 who were high-school graduates(a) . Enter
a All requested variables entered.
b Dependent Variable: Percent of raters in NORC study rating occupation as excellent or good in presti

Model Summary
Model R R Square Adjusted R Square Std. Error of the Estimate
1 .910(a) .828 .820 13.369
a Predictors: (Constant), Percent of males in occupation earning $3500 or more in 1950, Percent of males in occupation in 1950 who were high-school graduates ANOVA(b) Model Sum of Squares df Mean Square F Sig. 1 Regression 36180.946 2 18090.473 101.216 .000(a) Residual 7506.699 42 178.731 Total 43687.644 44 a Predictors: (Constant), Percent of males in occupation earning$3500 or more in 1950, Percent of males in occupation in 1950 who were high-school graduates
b Dependent Variable: Percent of raters in NORC study rating occupation as excellent or good in presti

Coefficients(a)

Unstandardized Coefficients Standardized Coefficients t Sig.
Model B Std. Error Beta
1 (Constant) -6.065 4.272
-1.420 .163
Percent of males in occupation in 1950 who were high-school graduates .546 .098 .516 5.555 .000
Percent of males in occupation earning \$3500 or more in 1950 .599 .120 .464 5.003 .000
a Dependent Variable: Percent of raters in NORC study rating occupation as excellent or good in presti

page 102 The regression coefficients in the middle of the page.

GET  FILE='D:\prestige.sav'.

REGRESSION
/STATISTICS COEFF OUTS R ANOVA
/DEPENDENT prestige
/METHOD=ENTER educat income percwomn.

Variables Entered/Removed(b)
Model Variables Entered Variables Removed Method
1 % of incumbents who were women, Average education, years, Average income, dollars(a) . Enter
a All requested variables entered.
b Dependent Variable: Pineo-Porter prestige score occ.

Model Summary
Model R R Square Adjusted R Square Std. Error of the Estimate
1 .893(a) .798 .792 7.84647
a Predictors: (Constant), % of incumbents who were women, Average education, years, Average income, dollars

ANOVA(b)
Model Sum of Squares df Mean Square F Sig.
1 Regression 23861.856 3 7953.952 129.192 .000(a)
Residual 6033.570 98 61.567

Total 29895.426 101

a Predictors: (Constant), % of incumbents who were women, Average education, years, Average income, dollars
b Dependent Variable: Pineo-Porter prestige score occ.

Coefficients(a)

Unstandardized Coefficients Standardized Coefficients t Sig.
Model B Std. Error Beta
1 (Constant) -6.794 3.239
-2.098 .039
Average education, years 4.187 .389 .664 10.771 .000
Average income, dollars 1.314E-03 .000 .324 4.729 .000
% of incumbents who were women -8.905E-03 .030 -.016 -.293 .770
a Dependent Variable: Pineo-Porter prestige score occ.

page 103 Table 5.2 Sums of squares (diagonal), sums of products (off diagonal), and sums (last row) for the Canadian occupational prestige data.

NOTE: This is a covariance matrix that was not divided by the degrees of freedom. Because this is not a standard table, we did not reproduce it.

page 108 These regression coefficients were obtained in the regression done on page 102.

The content of this web site should not be construed as an endorsement of any particular web site, book, or software product by the University of California.