R Log for Example Analyses Using Counties.dat in Problem #3.7 [similar to #3.5 and 3.6] ### ASCII Data are comma-delimited: enter data accordingly > counties = read.table("counties.dat", header=T, sep=",") > names(counties) [1] "RN" "STATE" "COUNTY" "LANDAREA" "TOTPOP" "PHYSICIA" [7] "ENROLL" "PERCPUB" "CIVLABOR" "UNEMP" "FARMPOP" "NUMFARM" [13] "FARMACRE" "FEDGRANT" "FEDCIV" "MILIT" "VETERANS" "PERCVIET" > dim(counties) [1] 100 18 > attach(counties) Problem #3.7 ============ > c(3141*mean(VETERANS), sqrt((3141*3041/100)*var(VETERANS))) [1] 38476339 14703478 > 255077036*mean(VETERANS)/mean(TOTPOP) ### Ratio estimator 1] 26361167 ### Now for ratio estimator SE: > sqrt((3141*3041/100)*var(VETERANS - TOTPOP* mean(VETERANS)/mean(TOTPOP))) [1] 2389402 ### This is a LOT smaller than before !!! > tmplm2 = lm(VETERANS ~ TOTPOP) c(3141*mean(VETERANS) + tmplm2$coef[2]*(255077036-3141*mean(TOTPOP)), sqrt((3141*3041/100)*var(tmplm2$resid))) [1] 27878518 1142010 #### these are Regression estimator & SE > summary(tmplm2)$coef Estimate Std. Error t value Pr(>|t|) (Intercept) 1.534201e+03 3.808447e+02 4.028417 1.109188e-04 TOTPOP 9.040246e-02 7.114278e-04 127.071867 1.415724e-110 ### Whenever regression estimator is much better than ratio ### estimator, we should expect significant intercept; ### whenever it is much better than the estimator which ### ignores auxiliary data, we should see signficant slope !