Exercise on Combined and Separate Ratio Estimation
Tasks :
(Item 1)
Delete all observations with missing values for the variable ACRES92 and ACRES87.
(Item 2)
Construct separate datasets according to the 4 REGIONS.
(Item 3)
Using set.seed(last 5 digits of your std no), draw a random sample of size 300
and estimate the population mean and total of ACRES92(under SRS).
(Item 4)
Using
set.seed (last 5 digits of your std no + 10) obtain a sample of size 21 from the Northeast stratum.
set.seed (last 5 digits of your std no + 11) obtain a sample of size 103 from the NorthCentral stratum.
set.seed (last 5 digits of your std no + 12) obtain a sample of size 135 from the South stratum.
set.seed (last 5 digits of your std no + 13) obtain a sample of size 41 from the West stratum.
(Item 5)
Estimate the population mean and total of ACRES92 using a ratio estimator with ACRES87 as auxiliary variable. (p. 119, eqn. (42))
(Item 6)
Estimate the population total using a combined ratio estimator.
(see p.144 and equation 3.2 from p.78).
(Item 7)
Estimate the population total using a separate ratio estimator. (see p.144).
##############################################
############ STAT 250 Exercise #############
############ 08-Nov-2018 #############
############ John Pauline Pineda #############
##############################################
# Set working directory
setwd("F:/SamplingDesign")
Item 1
##############################################
############ ITEM 1 #############
##############################################
# Delete all observations with missing values
# for the variable ACRES92 and ACRES87.
##############################################
# Load the working data
agpop <- read.csv("agpop.dat")
# Initial exploratory analysis
# Check the data dimensions
# 3078 rows and 15 columns
dim(agpop)
## [1] 3078 15
# Generate the data summary
summary(agpop)
## COUNTY STATE ACRES92
## WASHINGTON COUNTY: 30 TX : 254 Min. : -99
## JEFFERSON COUNTY : 25 GA : 159 1st Qu.: 80903
## FRANKLIN COUNTY : 24 KY : 120 Median : 191648
## JACKSON COUNTY : 23 MO : 114 Mean : 306677
## LINCOLN COUNTY : 23 KS : 105 3rd Qu.: 366886
## MADISON COUNTY : 19 IL : 102 Max. :7229585
## (Other) :2934 (Other):2224
## ACRES87 ACRES82 FARMS92 FARMS87
## Min. : -99 Min. : -99 Min. : 0.0 Min. : 0.0
## 1st Qu.: 86236 1st Qu.: 96397 1st Qu.: 295.0 1st Qu.: 318.5
## Median : 199864 Median : 207292 Median : 521.0 Median : 572.0
## Mean : 313016 Mean : 320194 Mean : 625.5 Mean : 678.3
## 3rd Qu.: 372224 3rd Qu.: 377065 3rd Qu.: 838.0 3rd Qu.: 921.0
## Max. :7687460 Max. :7313958 Max. :7021.0 Max. :7590.0
##
## FARMS82 LARGEF92 LARGEF87 LARGEF82
## Min. : 0.0 Min. : 0.00 Min. : 0.00 Min. : 0.00
## 1st Qu.: 345.0 1st Qu.: 8.00 1st Qu.: 8.00 1st Qu.: 8.00
## Median : 616.0 Median : 30.00 Median : 27.00 Median : 25.00
## Mean : 728.1 Mean : 56.18 Mean : 54.86 Mean : 52.62
## 3rd Qu.: 991.0 3rd Qu.: 75.00 3rd Qu.: 70.00 3rd Qu.: 65.00
## Max. :7394.0 Max. :579.00 Max. :596.00 Max. :546.00
##
## SMALLF92 SMALLF87 SMALLF82 REGION
## Min. : 0.00 Min. : 0.00 Min. : 0.00 NC:1054
## 1st Qu.: 13.00 1st Qu.: 17.00 1st Qu.: 16.00 NE: 220
## Median : 29.00 Median : 35.00 Median : 34.00 S :1382
## Mean : 54.09 Mean : 59.54 Mean : 60.97 W : 422
## 3rd Qu.: 59.00 3rd Qu.: 67.00 3rd Qu.: 67.00
## Max. :4298.00 Max. :3654.00 Max. :3522.00
##
# Count the number of rows with missing values for the ACRES92 column
# 19 rows with missing values
nrow(agpop[agpop$ACRES92==-99,])
## [1] 19
# Count the number of rows with missing values for the ACRES87 column
# 23 rows with missing values
nrow(agpop[agpop$ACRES87==-99,])
## [1] 23
# Remove missing values and only keep the needed columns
agpop_complete <- agpop[agpop$ACRES92!=-99,c("ACRES92","ACRES87","REGION")]
# Remove missing values and only keep the needed columns
agpop_complete <- agpop_complete[agpop_complete$ACRES87!=-99,c("ACRES92","ACRES87","REGION")]
# Check the data dimensions
# 3044 rows and 3 columns
dim(agpop_complete)
## [1] 3044 3
(N <- nrow(agpop_complete))
## [1] 3044
# Double check if all missing rows have been indeed removed
# Count the number of rows with missing values for the ACRES92 column
# 0 rows with missing values
nrow(agpop_complete[agpop_complete$ACRES92==-99,])
## [1] 0
# Count the number of rows with missing values for the ACRES87 column
# 0 rows with missing values
nrow(agpop_complete[agpop_complete$ACRES87==-99,])
## [1] 0
# Generate the population means
# Population mean for ACRES92 is 309900.4
(ACRES92_popmean <- mean(agpop_complete$ACRES92))
## [1] 309900.4
# Population mean for ACRES87 is 316094.7
(ACRES87_popmean <- mean(agpop_complete$ACRES87))
## [1] 316094.7
# Generate the population totals
# Population total for ACRES92 is 943336889
(ACRES92_poptotal <- sum(agpop_complete$ACRES92))
## [1] 943336889
# Population total for ACRES87 is 962192213
(ACRES87_poptotal <- sum(agpop_complete$ACRES87))
## [1] 962192213
Item 2
##############################################
############ ITEM 2 #############
##############################################
# Construct separate datasets
# according to the 4 REGIONS.
##############################################
# Specify the number of strata
(H <- nlevels(agpop_complete$REGION))
## [1] 4
# Create data objects for the regions / strata
NEregion <- agpop_complete[agpop_complete$REGION=="NE",]
NCregion <- agpop_complete[agpop_complete$REGION=="NC",]
Sregion <- agpop_complete[agpop_complete$REGION=="S",]
Wregion <- agpop_complete[agpop_complete$REGION=="W",]
# Specify the population size per stratum
# North East region stratum population size = 211
(N.NEregion <- nrow(NEregion))
## [1] 211
# North Central region stratum population size = 1049
(N.NCregion <- nrow(NCregion))
## [1] 1049
# South region stratum population size = 1370
(N.Sregion <- nrow(Sregion))
## [1] 1370
# West region stratum population size = 414
(N.Wregion <- nrow(Wregion))
## [1] 414
Item 3
##############################################
############ ITEM 3 #############
##############################################
# Using set.seed(last 5 digits of your std no)
# draw a random sample of size 300 and
# estimate the population mean
# and total of ACRES92 (under SRS).
##############################################
# Set the seed numbers
(seedSRS0 <- 89176)
## [1] 89176
# Specify the sample size
(n <- 300)
## [1] 300
# Verify the population size
# Population size is 3044
(N)
## [1] 3044
# Generate the sample indices
set.seed(seedSRS0)
(sampleindices <- sample(N,n))
## [1] 599 163 2028 1437 730 1538 2375 233 1917 522 2170 1226 2105 700
## [15] 2853 2180 2628 2332 809 962 613 2079 79 1157 2484 1348 1483 330
## [29] 2343 2864 2709 1578 618 2656 2269 778 3004 71 1644 2717 465 1372
## [43] 161 2661 1534 2862 918 1687 1569 516 542 1758 96 98 877 2521
## [57] 1901 719 1688 331 129 2149 2597 548 246 2487 298 1562 269 2538
## [71] 1015 1890 347 2617 2643 395 1683 2926 2930 1560 2962 2024 122 1421
## [85] 1926 954 1109 2473 636 2820 7 178 534 1443 1657 555 1910 996
## [99] 2379 1357 267 1051 2659 2705 1107 1245 898 1432 1738 1748 2413 1149
## [113] 819 2784 1013 950 20 334 2427 958 1770 1902 1718 2002 1118 982
## [127] 26 540 1547 2664 57 1832 1907 2179 736 1121 876 1044 2443 2047
## [141] 2857 2400 869 2624 206 1871 105 662 35 2005 2680 1373 1222 2244
## [155] 328 1228 398 2577 2471 573 2238 294 2466 1807 204 2585 1788 2746
## [169] 1299 1064 1512 2640 1069 1597 1301 1615 2785 977 840 2497 1816 785
## [183] 2575 967 776 2032 2772 2492 1076 928 1965 130 1593 2322 2459 1684
## [197] 17 1159 2421 1446 2035 1649 47 1316 2470 2237 313 2092 3014 454
## [211] 2988 2333 1389 1556 731 370 2518 397 1714 879 2947 1376 2595 2478
## [225] 1175 2221 2950 1834 1145 1861 1235 570 1740 1634 2132 2843 1517 1530
## [239] 1784 1575 1489 300 2318 1195 2683 2657 2178 1848 577 752 1859 2293
## [253] 1283 925 72 2605 854 838 2568 1275 771 2946 1135 2261 249 40
## [267] 2342 1847 1264 2069 892 225 2750 2462 1453 1515 595 403 689 887
## [281] 2441 910 697 1473 2540 2279 1148 2825 366 1959 74 1858 2315 993
## [295] 2846 2817 1119 2767 2644 920
# Generate the actual samples
(agpop_sampled <- agpop_complete[sampleindices,])
## ACRES92 ACRES87 REGION
## 606 233217 230461 NC
## 163 286288 241276 W
## 2050 230988 251969 NC
## 1449 316809 300812 NC
## 737 184599 184566 NC
## 1550 181946 177963 S
## 2399 1406379 1397710 NC
## 234 156801 150334 W
## 1933 1797466 1805222 W
## 529 268506 268437 NC
## 2192 1457339 1519876 W
## 1236 193688 207726 NC
## 2127 419760 404416 S
## 707 258014 262198 NC
## 2882 24848 28234 NE
## 2202 1318447 1381625 W
## 2654 547428 548293 S
## 2356 974811 1009978 NC
## 816 158788 172226 NC
## 969 90033 89986 S
## 620 357684 377025 NC
## 2101 302456 318255 NC
## 79 18818 19659 S
## 1167 83232 92806 S
## 2508 416631 422998 S
## 1360 231610 234126 NC
## 1495 151743 173064 S
## 335 299699 329388 S
## 2367 545064 486467 NC
## 2893 112085 115566 W
## 2735 644730 685935 S
## 1590 1644001 1722206 W
## 625 221209 207722 W
## 2682 402011 546742 S
## 2293 74733 85937 S
## 785 202429 209556 NC
## 3038 115487 118540 S
## 71 141260 156950 S
## 1658 180400 182498 S
## 2743 461127 402967 S
## 472 44470 54722 S
## 1384 181292 189383 NC
## 161 2108834 2358559 W
## 2687 362642 318164 S
## 1546 86096 87159 S
## 2891 274546 274119 W
## 925 409839 396556 NC
## 1701 144858 154350 S
## 1581 135126 152109 W
## 523 214452 224153 W
## 549 312173 328319 NC
## 1772 1269572 1300508 NC
## 96 168755 165498 S
## 98 42794 41293 S
## 884 222028 223426 NC
## 2545 471498 499983 S
## 1916 2149450 2220431 W
## 726 402310 444816 NC
## 1702 51916 54858 S
## 336 296242 311074 S
## 129 122871 112409 S
## 2171 421233 435566 S
## 2622 383573 403124 S
## 555 343870 334112 NC
## 248 641755 643050 W
## 2511 629681 593971 S
## 302 227202 214364 S
## 1574 598694 536553 W
## 272 546538 505471 W
## 2562 518788 589050 S
## 1022 44709 55183 S
## 1905 3112271 2991513 W
## 352 151242 166766 S
## 2643 558553 517379 S
## 2669 525885 505366 S
## 402 25802 27899 S
## 1697 68736 75808 S
## 2955 218145 228959 NC
## 2959 170228 183626 NC
## 1572 2338866 2433747 W
## 2994 86091 100728 NC
## 2046 275644 288175 NC
## 122 69422 80104 S
## 1433 199292 201016 NC
## 1942 738041 833913 W
## 961 471658 529749 NC
## 1116 27469 26993 S
## 2497 103063 103622 S
## 643 353528 401677 W
## 2849 48889 41268 S
## 7 167832 192082 S
## 178 775829 702173 W
## 541 308497 317974 NC
## 1455 323465 336976 NC
## 1671 75496 91744 S
## 562 317205 319657 NC
## 1926 770155 788473 W
## 1003 86074 96982 S
## 2403 93098 88616 S
## 1369 249731 252824 NC
## 270 1004360 882165 W
## 1058 159794 161234 S
## 2685 497106 445493 S
## 2731 242901 276750 S
## 1114 87574 89425 S
## 1256 73437 76193 NC
## 905 271713 263592 NC
## 1444 201714 206871 NC
## 1752 1165695 1122980 NC
## 1762 485012 487285 NC
## 2437 224247 222142 S
## 1157 37477 46747 NE
## 826 184118 197875 NC
## 2812 73097 71550 S
## 1020 144828 144862 S
## 957 687593 704788 NC
## 20 47200 49177 S
## 339 44962 48999 S
## 2451 275219 279482 S
## 965 265978 253967 NC
## 1784 437826 442540 NC
## 1917 1881764 1894215 W
## 1732 559385 609823 NC
## 2024 122480 117130 NC
## 1125 193137 195787 S
## 989 192189 201861 S
## 26 111315 118184 S
## 547 368114 376952 NC
## 1559 230524 245244 S
## 2690 667177 529092 S
## 57 155914 159757 S
## 1846 532901 570445 NC
## 1923 1769177 1635787 W
## 2201 380464 391692 W
## 743 67998 75234 NC
## 1128 247106 244811 S
## 883 201798 216179 NC
## 1051 136869 137344 S
## 2467 53026 58327 S
## 2069 200405 209643 NC
## 2886 132674 140177 NE
## 2424 70457 78611 S
## 876 407464 397383 NC
## 2650 515960 543283 S
## 207 388084 377352 W
## 1885 7799 10033 NE
## 105 183895 173516 S
## 669 69354 73076 NC
## 35 130063 127653 S
## 2027 99214 115999 NC
## 2706 247626 249326 S
## 1385 255498 260645 NC
## 1232 277400 282467 NC
## 2268 90065 95605 NE
## 333 11738 17507 S
## 1238 47308 47988 NC
## 405 3046 3841 S
## 2602 660412 762442 S
## 2495 352488 350886 S
## 580 266083 266090 NC
## 2261 44425 56734 NE
## 298 36230 41178 S
## 2490 125092 135209 S
## 1821 401978 403549 NC
## 205 342653 347504 W
## 2610 345138 348386 S
## 1802 658572 709723 NC
## 2772 1294703 1318672 W
## 1311 379603 389539 NC
## 1071 154082 164293 S
## 1524 53401 57612 S
## 2666 73948 75350 S
## 1076 165015 174061 S
## 1609 683088 704878 W
## 1313 79183 91078 NC
## 1627 52974 57431 S
## 2813 24478 25831 S
## 984 137337 137781 S
## 847 79235 86245 NC
## 2521 548351 509782 S
## 1830 446007 474848 NC
## 792 229097 234599 NC
## 2600 545664 615426 S
## 974 80864 84750 S
## 783 222435 228419 NC
## 2054 74461 79180 NC
## 2799 68326 72611 S
## 2516 2405018 2377767 S
## 1083 140432 136561 S
## 935 582053 542578 NC
## 1985 242637 285731 NE
## 130 156363 156212 S
## 1605 1968857 1938423 W
## 2346 236608 236960 NC
## 2483 183178 190772 S
## 1698 115854 117441 S
## 17 67950 84626 S
## 1169 126981 132804 S
## 2445 54518 62446 S
## 1458 138986 139937 NC
## 2057 17138 18335 NC
## 1663 8882 7533 S
## 47 207226 223190 S
## 1328 395023 368115 NC
## 2494 214497 216162 S
## 2260 20777 26898 NE
## 318 69405 73603 S
## 2114 300829 318542 S
## 3048 47366 48770 S
## 461 121588 131334 S
## 3020 19956 21369 S
## 2357 560057 575695 NC
## 1401 201670 200323 NC
## 1568 78230 91427 S
## 738 392639 415755 NC
## 377 213943 216594 S
## 2542 571684 655499 S
## 404 168593 163114 S
## 1728 777675 816265 NC
## 886 324063 340899 NC
## 2978 265731 281891 NC
## 1388 163076 178651 NC
## 2620 330173 312129 S
## 2502 337351 347215 S
## 1185 123932 137529 S
## 2244 88982 99920 NE
## 2981 270930 291181 NC
## 1848 297326 332862 NC
## 1153 34235 42562 NE
## 1875 46056 47923 NE
## 1246 18047 18555 NC
## 577 321950 322206 NC
## 1754 531643 557568 NC
## 1646 53902 50446 S
## 2154 390957 388174 S
## 2872 2358 3374 S
## 1529 262371 277137 S
## 1542 93180 123870 S
## 1798 345739 359241 NC
## 1587 1730537 1646324 W
## 1501 294547 260026 S
## 304 86026 83994 S
## 2342 1243168 1104452 NC
## 1205 16099 16140 NC
## 2709 536507 474001 S
## 2683 1695484 1890612 S
## 2200 34292 35230 W
## 1862 217228 241886 NC
## 584 347599 342938 NC
## 759 488215 487699 NC
## 1873 25439 26574 NE
## 2317 128124 124284 S
## 1295 113422 132863 NC
## 932 547369 545417 NC
## 72 56680 57923 S
## 2630 698832 653556 S
## 861 162244 165339 NC
## 845 121710 132099 NC
## 2593 313952 330751 S
## 1287 168073 178100 NC
## 778 227711 221878 NC
## 2977 282405 315416 NC
## 1142 61883 65151 S
## 2285 9631 10356 NE
## 251 878447 996785 W
## 40 191810 207817 S
## 2366 502469 490333 NC
## 1861 1005877 1122369 NC
## 1275 3786 4159 NC
## 2091 19088 19808 NC
## 899 532890 538449 NC
## 226 796892 855503 W
## 2776 105576 101622 W
## 2486 49452 53305 S
## 1465 204171 218426 NC
## 1527 95736 96008 S
## 602 542855 543881 NC
## 410 184137 179393 S
## 696 431415 459120 NC
## 894 512728 503589 NC
## 2465 257000 258567 S
## 917 485656 469908 NC
## 704 453944 485142 NC
## 1485 289729 290980 NC
## 2564 426189 392585 S
## 2303 156853 155717 S
## 1156 74484 82864 NE
## 2854 24924 29758 S
## 373 62983 68705 S
## 1979 195626 212804 NE
## 74 151325 154580 S
## 1872 20910 21479 NE
## 2339 1026353 992938 NC
## 1000 147154 155594 S
## 2875 43332 39358 S
## 2846 297064 300699 S
## 1126 210570 196324 S
## 2794 51604 59527 S
## 2670 30268 64047 S
## 927 441417 436761 NC
# Check the dimension
(dim(agpop_sampled))
## [1] 300 3
# Create an estimate for the population mean
# using the sample mean
# Sample mean for ACRES92 is 351725.5
# (Reference) Population mean for ACRES92 = 309900.4
(ACRES92_samplemean <- mean(agpop_sampled$ACRES92))
## [1] 351725.5
# Estimated population mean for ACRES92
# based from simple random sampling is 351725.5
# Create an estimate for the population total
# using the product of sample mean and population size
# Sample mean for ACRES92 is 351725.5
# Population size is 3044
# Estimated population total is 1070652381
# (Reference) Population total for ACRES92 is 943336889
(ACRES92_totalestimate <- N*ACRES92_samplemean)
## [1] 1070652381
# Estimated population total for ACRES92
# based from simple random sampling is 1070652381
Item 4
##############################################
############ ITEM 4 #############
##############################################
# Using set.seed(last 5 digits of your std no + 10)
# obtain a sample of size 21 from the Northeast stratum.
# Using set.seed(last 5 digits of your std no + 11)
# obtain a sample of size 103 from the NorthCentral stratum.
# Using set.seed(last 5 digits of your std no + 12)
# obtain a sample of size 135 from the South stratum.
# Using set.seed(last 5 digits of your std no + 13)
# obtain a sample of size 41 from the West stratum.
##############################################
# Set the seed numbers
(seedSTR1 <- seedSRS0+10)
## [1] 89186
(seedSTR2 <- seedSRS0+11)
## [1] 89187
(seedSTR3 <- seedSRS0+12)
## [1] 89188
(seedSTR4 <- seedSRS0+13)
## [1] 89189
# Specify the sample size for each stratum
(n.NEregion <- 21)
## [1] 21
(n.NCregion <- 103)
## [1] 103
(n.Sregion <- 135)
## [1] 135
(n.Wregion <- 41)
## [1] 41
# Specify the overall sample size
(nSTR <- n.NCregion + n.NEregion + n.Sregion + n.Wregion)
## [1] 300
# Generate the sample indices for each stratum
set.seed(seedSTR1)
(sampleindices10.NEregion <- sample(N.NEregion,n.NEregion))
## [1] 124 188 168 23 89 152 49 99 135 192 78 69 109 65 94 3 83
## [18] 80 207 115 51
set.seed(seedSTR2)
(sampleindices11.NCregion <- sample(N.NCregion,n.NCregion))
## [1] 848 308 77 580 885 325 1 621 506 856 521 924 425 768
## [15] 702 81 520 503 896 781 11 245 744 653 85 22 70 501
## [29] 183 117 562 648 859 12 498 731 405 926 552 448 107 280
## [43] 843 996 283 778 202 181 89 791 684 886 1038 903 524 813
## [57] 626 983 256 356 590 204 884 144 658 741 99 82 920 324
## [71] 664 398 904 988 888 737 746 959 701 284 269 175 923 26
## [85] 1044 382 366 109 681 3 429 846 242 322 258 750 166 292
## [99] 20 860 705 331 879
set.seed(seedSTR3)
(sampleindices12.Sregion <- sample(N.Sregion,n.Sregion))
## [1] 676 13 353 73 818 180 1068 240 1035 537 584 603 115 239
## [15] 1351 471 87 1205 155 454 764 810 400 58 1275 43 964 425
## [29] 267 1072 1140 1065 811 461 1227 1025 1053 882 1255 666 612 1023
## [43] 307 976 159 1217 77 1317 325 1273 971 542 199 1151 462 877
## [57] 17 529 731 1368 743 873 4 137 942 778 198 1132 663 301
## [71] 627 727 692 39 162 470 720 1294 1064 1168 1219 1036 1344 1345
## [85] 984 222 230 1320 1106 1104 9 1318 1127 455 1034 559 76 1091
## [99] 979 1276 849 615 838 601 786 365 1049 1230 300 699 1154 1209
## [113] 274 1098 70 100 156 223 1346 22 771 499 546 75 783 841
## [127] 656 96 296 1270 233 777 1015 1129 256
set.seed(seedSTR4)
(sampleindices13.Wregion <- sample(N.Wregion,n.Wregion))
## [1] 199 348 240 285 414 201 181 394 246 20 35 398 314 178 49 298 361
## [18] 308 411 264 6 130 121 334 66 335 376 393 138 378 172 26 211 282
## [35] 90 168 135 253 102 144 227
# Generate the actual samples
(NEregion_sampled10 <- NEregion[sampleindices10.NEregion,])
## ACRES92 ACRES87 REGION
## 2011 174627 191309 NE
## 2278 203026 218906 NE
## 2257 39561 44930 NE
## 1188 62242 69551 NE
## 1974 163072 175803 NE
## 2241 106390 116231 NE
## 1882 29606 29423 NE
## 1984 135494 146537 NE
## 2223 310672 338776 NE
## 2282 252052 278239 NE
## 1962 158392 172734 NE
## 1902 87638 87583 NE
## 1996 831 1107 NE
## 1898 98256 95265 NE
## 1979 195626 212804 NE
## 286 86581 95321 NE
## 1967 145679 166121 NE
## 1964 138620 148153 NE
## 2885 149503 168175 NE
## 2002 115071 126320 NE
## 1884 97186 103224 NE
(NCregion_sampled11 <- NCregion[sampleindices11.NCregion,])
## ACRES92 ACRES87 REGION
## 2036 88899 90106 NC
## 876 407464 397383 NC
## 601 229818 238256 NC
## 1387 339372 324379 NC
## 2073 164607 165764 NC
## 893 671506 676575 NC
## 525 328970 353365 NC
## 1428 332910 317276 NC
## 1313 79183 91078 NC
## 2044 127867 137708 NC
## 1328 395023 368115 NC
## 2343 417697 425661 NC
## 1230 5965 5936 NC
## 1813 1069778 1074776 NC
## 1747 723816 758474 NC
## 605 364172 359677 NC
## 1327 255453 253044 NC
## 1310 366534 384001 NC
## 2084 160734 168992 NC
## 1826 326831 338329 NC
## 535 341923 358798 NC
## 813 187549 191358 NC
## 1789 270005 290941 NC
## 1460 228936 246348 NC
## 609 331211 327081 NC
## 546 456954 450742 NC
## 594 219832 233026 NC
## 1308 414710 427986 NC
## 751 446750 493253 NC
## 685 176012 178175 NC
## 1369 249731 252824 NC
## 1455 323465 336976 NC
## 2047 248400 264054 NC
## 536 315448 328114 NC
## 1305 221193 219920 NC
## 1776 1160916 1187041 NC
## 1210 14104 13902 NC
## 2345 534829 540538 NC
## 1359 643762 671895 NC
## 1254 48029 46747 NC
## 675 238906 259634 NC
## 848 257351 247010 NC
## 2031 223216 222057 NC
## 2944 70547 74561 NC
## 851 80958 85852 NC
## 1823 1387740 1415617 NC
## 770 197724 205872 NC
## 749 264140 279859 NC
## 613 241422 244939 NC
## 1836 330369 293257 NC
## 1729 818893 799317 NC
## 2074 187718 194218 NC
## 2988 207128 209508 NC
## 2091 19088 19808 NC
## 1331 744710 819664 NC
## 1858 314949 339349 NC
## 1433 199292 201016 NC
## 2931 350866 374522 NC
## 824 139523 145490 NC
## 924 323769 327193 NC
## 1397 130358 140126 NC
## 772 165091 175883 NC
## 2072 113892 112208 NC
## 712 203590 227961 NC
## 1465 204171 218426 NC
## 1786 296164 293720 NC
## 623 353683 344010 NC
## 606 233217 230461 NC
## 2339 1026353 992938 NC
## 892 164081 170339 NC
## 1471 165225 156208 NC
## 966 22553 23936 NC
## 2092 120519 122492 NC
## 2936 162205 168831 NC
## 2076 106573 105390 NC
## 1782 407678 411712 NC
## 1791 296016 338390 NC
## 2378 485748 468868 NC
## 1746 688468 724825 NC
## 852 119318 127753 NC
## 837 236436 244226 NC
## 743 67998 75234 NC
## 2342 1243168 1104452 NC
## 550 275319 266999 NC
## 2995 147207 156317 NC
## 950 227349 221098 NC
## 934 449151 486999 NC
## 677 571807 594227 NC
## 1726 594587 626589 NC
## 527 321728 321226 NC
## 1234 29161 31751 NC
## 2034 196759 206905 NC
## 810 139638 139792 NC
## 890 671223 674986 NC
## 826 184118 197875 NC
## 1795 772453 765900 NC
## 734 187039 203136 NC
## 860 285169 292938 NC
## 544 236409 229423 NC
## 2048 113329 118939 NC
## 1750 1048701 1047851 NC
## 899 532890 538449 NC
## 2067 87036 85076 NC
(Sregion_sampled12 <- Sregion[sampleindices12.Sregion,])
## ACRES92 ACRES87 REGION
## 1648 93970 107269 S
## 18 61426 94506 S
## 508 55779 65220 S
## 78 30196 31795 S
## 2168 309614 267016 S
## 333 11738 17507 S
## 2593 313952 330751 S
## 395 178861 178875 S
## 2559 599637 588433 S
## 1138 40181 57922 S
## 1499 68663 74002 S
## 1518 89168 97908 S
## 120 219444 234605 S
## 394 10192 13420 S
## 3036 178160 184323 S
## 1072 229838 224123 S
## 92 20589 18918 S
## 2731 242901 276750 S
## 307 83681 83061 S
## 1055 117868 118240 S
## 2114 300829 318542 S
## 2160 207118 215865 S
## 1001 193859 204660 S
## 63 78176 89109 S
## 2832 85600 83709 S
## 48 199714 207753 S
## 2488 165309 165266 S
## 1026 3224 3780 S
## 422 25376 27498 S
## 2597 686578 956997 S
## 2666 73948 75350 S
## 2590 443027 393949 S
## 2161 282211 284665 S
## 1062 127403 135728 S
## 2782 90296 93860 S
## 2549 1584367 1606076 S
## 2578 102229 98924 S
## 2406 30299 34850 S
## 2812 73097 71550 S
## 1637 31671 34833 S
## 1527 95736 96008 S
## 2547 2001152 1854660 S
## 462 205573 223620 S
## 2500 500665 482017 S
## 311 57179 65426 S
## 2743 461127 402967 S
## 82 98919 114391 S
## 2875 43332 39358 S
## 480 12733 14377 S
## 2830 195476 206601 S
## 2495 352488 350886 S
## 1143 316691 333377 S
## 352 151242 166766 S
## 2677 195147 201728 S
## 1063 4469 3271 S
## 2401 213603 221058 S
## 22 138135 145104 S
## 1130 6166 5884 S
## 1704 130879 137426 S
## 3053 35836 36627 S
## 1716 67716 71442 S
## 2331 55992 56998 S
## 9 48022 50818 S
## 142 31190 34580 S
## 2466 105519 110079 S
## 2128 566152 547352 S
## 351 79270 81667 S
## 2658 487573 501761 S
## 1634 127760 130650 S
## 456 8003 5071 S
## 1542 93180 123870 S
## 1700 23140 26073 S
## 1665 112291 117207 S
## 44 201892 199960 S
## 315 70987 87500 S
## 1071 154082 164293 S
## 1693 67491 81108 S
## 2852 78977 77112 S
## 2589 560355 582208 S
## 2694 572607 576671 S
## 2745 344667 348460 S
## 2560 801159 996776 S
## 3028 56555 49353 S
## 3029 74760 76343 S
## 2508 416631 422998 S
## 377 213943 216594 S
## 385 21697 25758 S
## 3003 2531 2635 S
## 2632 576893 534150 S
## 2629 436040 409706 S
## 14 109555 102153 S
## 3001 76080 83174 S
## 2653 512473 503635 S
## 1056 191002 202339 S
## 2558 677308 695478 S
## 1174 222768 236350 S
## 81 269122 320847 S
## 2616 1524636 1532081 S
## 2503 432939 432697 S
## 2833 100602 106419 S
## 2307 55712 57293 S
## 1530 98914 103596 S
## 2296 90995 92792 S
## 1516 76673 78932 S
## 2136 405271 394472 S
## 520 200061 198012 S
## 2574 128533 118725 S
## 2786 47010 53523 S
## 455 33785 38527 S
## 1672 56693 66292 S
## 2680 2891640 2918048 S
## 2735 644730 685935 S
## 429 36074 39886 S
## 2623 386991 361425 S
## 75 92708 103034 S
## 105 183895 173516 S
## 308 334623 351402 S
## 378 166511 202944 S
## 3031 54622 52964 S
## 27 196859 193771 S
## 2121 336285 279924 S
## 1100 63674 63548 S
## 1147 38566 42488 S
## 80 246184 240838 S
## 2133 268038 268553 S
## 2299 94193 95757 S
## 1627 52974 57431 S
## 101 168848 182876 S
## 451 32657 36282 S
## 2827 59326 63576 S
## 388 52651 55316 S
## 2127 419760 404416 S
## 2539 549167 559698 S
## 2655 562612 578993 S
## 411 16362 13745 S
(Wregion_sampled13 <- Wregion[sampleindices13.Wregion,])
## ACRES92 ACRES87 REGION
## 1583 2232575 2143210 W
## 2773 450315 493902 W
## 1624 490988 516382 W
## 1950 710618 880792 W
## 3078 1484583 1546633 W
## 1585 699409 731603 W
## 663 4428 5148 W
## 3058 2704163 2893716 W
## 1908 924678 990255 W
## 162 229365 272399 W
## 177 2839531 3037068 W
## 3062 2415873 2464688 W
## 2206 167880 176178 W
## 660 752032 716637 W
## 191 72471 56179 W
## 2190 766373 763612 W
## 2898 918033 987885 W
## 2200 34292 35230 W
## 3075 62307 72197 W
## 1927 1896131 1857223 W
## 148 5785707 5779528 W
## 275 462086 472194 W
## 265 633279 731609 W
## 2759 434183 483118 W
## 209 647446 669385 W
## 2760 332686 273876 W
## 2913 1291118 1339306 W
## 3057 441321 467739 W
## 521 926607 1007287 W
## 2915 55360 62578 W
## 654 211039 222624 W
## 168 450236 456266 W
## 1595 951780 934149 W
## 1945 189223 209805 W
## 233 423785 408649 W
## 650 207552 205315 W
## 281 1333577 1391208 W
## 1915 843401 1226048 W
## 246 177333 225220 W
## 626 325338 358189 W
## 1611 1197028 1194869 W
Item 5
##############################################
############ ITEM 5 #############
##############################################
# Estimate the population mean and total
# of ACRES92 using a ratio estimator with
# ACRES87 as auxiliary variable.
# (see p. 119, equation (42))
##############################################
# Generate the sample means for ACRES92 and ACRES87
# Sample mean for ACRES92 is 351725.5
(ACRES92_samplemean <- mean(agpop_sampled$ACRES92))
## [1] 351725.5
# Sample mean for ACRES87 is 358120.2
(ACRES87_samplemean <- mean(agpop_sampled$ACRES87))
## [1] 358120.2
# Create an estimate for the population mean of ACRES92
# using ACRES87 as auxiliary variable
# Estimated population mean for ACRES92
# using ACRES87 as auxiliary variable is 310450.4
# (Reference) actual ACRES92 population mean is 309900.4
(ACRES92_estimatedmeanusingACRES87 <-
(ACRES92_samplemean/ACRES87_samplemean)*ACRES87_popmean)
## [1] 310450.4
# Estimated population mean for ACRES92
# based from auxiliary variable ACRES87 is 310450.4
# Generate the sample total for ACRES92 and ACRES87
# Sample total for ACRES92 is 105517646
(ACRES92_sampletotal <- sum(agpop_sampled$ACRES92))
## [1] 105517646
# Sample total for ACRES87 is 107436057
(ACRES87_sampletotal <- sum(agpop_sampled$ACRES87))
## [1] 107436057
# Create an estimate for the population total of ACRES92
# using ACRES87 as auxiliary variable
# Estimated population total for ACRES92
# using ACRES87 as auxiliary variable is 945011015
# (Reference) actual ACRES92 population total is 943336889
(ACRES92_estimatedtotalusingACRES87 <-
(ACRES92_sampletotal/ACRES87_sampletotal)*ACRES87_poptotal)
## [1] 945011015
# Estimated population total for ACRES92
# based from auxiliary variable ACRES87 is 945011015
Item 6
##############################################
############ ITEM 6 #############
##############################################
# Estimate the population total
# using a combined ratio estimator.
# (see p.144 and equation 3.2 from p.78)
##############################################
# Gathering all needed formula components
# Population size N per stratum
# North East region stratum population size = 211
(N.NEregion <- nrow(NEregion))
## [1] 211
# North Central region stratum population size = 1049
(N.NCregion <- nrow(NCregion))
## [1] 1049
# South region stratum population size = 1370
(N.Sregion <- nrow(Sregion))
## [1] 1370
# West region stratum population size = 414
(N.Wregion <- nrow(Wregion))
## [1] 414
# ACRES92 sample mean per stratum
# North East region stratum sample mean for ACRES92 = 130958.3
(ACRES92samplemean.NEregion <- mean(NEregion_sampled10$ACRES92))
## [1] 130958.3
# North Central region stratum sample mean for ACRES92 = 333711.1
(ACRES92samplemean.NCregion <- mean(NCregion_sampled11$ACRES92))
## [1] 333711.1
# South region stratum sample mean for ACRES92 = 242028.8
(ACRES92samplemean.Sregion <- mean(Sregion_sampled12$ACRES92))
## [1] 242028.8
# West region stratum sample mean for ACRES92 = 906734.9
(ACRES92samplemean.Wregion <- mean(Wregion_sampled13$ACRES92))
## [1] 906734.9
# ACRES87 sample mean per stratum
# North East region stratum sample mean for ACRES87 = 142214.9
(ACRES87samplemean.NEregion <- mean(NEregion_sampled10$ACRES87))
## [1] 142214.9
# North Central region stratum sample mean for ACRES87 = 339147.8
(ACRES87samplemean.NCregion <- mean(NCregion_sampled11$ACRES87))
## [1] 339147.8
# South region stratum sample mean for ACRES87 = 247570.8
(ACRES87samplemean.Sregion <- mean(Sregion_sampled12$ACRES87))
## [1] 247570.8
# West region stratum sample mean for ACRES87 = 945363.4
(ACRES87samplemean.Wregion <- mean(Wregion_sampled13$ACRES87))
## [1] 945363.4
# Compute for the estimated total for ACRES92 by summing up
# the products of the size and sample mean for ACRES92 per stratum
(ACRES92_estimatedtotalSTR <-
(N.NEregion * ACRES92samplemean.NEregion) +
(N.NCregion * ACRES92samplemean.NCregion) +
(N.Sregion * ACRES92samplemean.Sregion) +
(N.Wregion * ACRES92samplemean.Wregion))
## [1] 1084662926
# The estimated total for ACRES92 using Stratified Random Sampling is 1084662926
# (Reference) actual ACRES92 population total is 943336889
# Compute for the estimated total for ACRES87 by summing up
# the products of the size and sample mean for ACRES87 per stratum
(ACRES87_estimatedtotalSTR <-
(N.NEregion * ACRES87samplemean.NEregion) +
(N.NCregion * ACRES87samplemean.NCregion) +
(N.Sregion * ACRES87samplemean.Sregion) +
(N.Wregion * ACRES87samplemean.Wregion))
## [1] 1116325782
# The estimated total for ACRES87 using Stratified Random Sampling is 1116325782
# (Reference) actual ACRES87 population total is 962192213
# Compute for the estimated ratio by dividing the
# estimated totals for ACRES92 and ACRES87 using Stratified Random Sampling
(ACRES92_estimatedBRatio <- ACRES92_estimatedtotalSTR/ACRES87_estimatedtotalSTR)
## [1] 0.9716365
# The estimated value for B is 0.9716365
# Compute for the estimated population total for ACRES92
# using the formula for combined ratio estimator
(ACRES92_estimatedtotalusingACRES87byCRE <-
ACRES92_estimatedBRatio*ACRES87_poptotal)
## [1] 934901117
# Estimated population total for ACRES92
# based from auxiliary variable ACRES87 and
# using the combined ratio estimator method is 934901117
# (Reference) actual ACRES92 population total is 943336889
Item 7
##############################################
############ ITEM 7 #############
##############################################
# Estimate the population total
# using separate ratio estimator.
# (see p.144)
##############################################
# Gathering all needed formula components
# ACRES87 population total per stratum
# North East region stratum population total for ACRES87 = 22025736
(ACRES87poptotal.NEregion <- sum(NEregion$ACRES87))
## [1] 22025736
# North Central region stratum population total for ACRES87 = 350433336
(ACRES87poptotal.NCregion <- sum(NCregion$ACRES87))
## [1] 350433336
# South region stratum population total for ACRES87 = 279311080
(ACRES87poptotal.Sregion <- sum(Sregion$ACRES87))
## [1] 279311080
# West region stratum population total for ACRES87 = 310422061
(ACRES87poptotal.Wregion <- sum(Wregion$ACRES87))
## [1] 310422061
# ACRES92 sample total per stratum
# North East region stratum sample total for ACRES92 = 2750125
(ACRES92sampletotal.NEregion <- sum(NEregion_sampled10$ACRES92))
## [1] 2750125
# North Central region stratum sample total for ACRES92 = 34372245
(ACRES92sampletotal.NCregion <- sum(NCregion_sampled11$ACRES92))
## [1] 34372245
# South region stratum sample total for ACRES92 = 32673894
(ACRES92sampletotal.Sregion <- sum(Sregion_sampled12$ACRES92))
## [1] 32673894
# West region stratum sample total for ACRES92 = 37176130
(ACRES92sampletotal.Wregion <- sum(Wregion_sampled13$ACRES92))
## [1] 37176130
# ACRES87 sample total per stratum
# North East region stratum sample total for ACRES87 = 2986512
(ACRES87sampletotal.NEregion <- sum(NEregion_sampled10$ACRES87))
## [1] 2986512
# North Central region stratum sample total for ACRES87 = 34932222
(ACRES87sampletotal.NCregion <- sum(NCregion_sampled11$ACRES87))
## [1] 34932222
# South region stratum sample total for ACRES87 = 33422056
(ACRES87sampletotal.Sregion <- sum(Sregion_sampled12$ACRES87))
## [1] 33422056
# West region stratum sample total for ACRES87 = 38759899
(ACRES87sampletotal.Wregion <- sum(Wregion_sampled13$ACRES87))
## [1] 38759899
# Compute for the estimated population total for ACRES92
# using the formula for separate ratio estimator
(ACRES92_estimatedtotalusingACRES87bySRE <-
(ACRES87poptotal.NEregion *
(ACRES92sampletotal.NEregion / ACRES87sampletotal.NEregion)) +
(ACRES87poptotal.NCregion *
(ACRES92sampletotal.NCregion / ACRES87sampletotal.NCregion)) +
(ACRES87poptotal.Sregion *
(ACRES92sampletotal.Sregion / ACRES87sampletotal.Sregion)) +
(ACRES87poptotal.Wregion *
(ACRES92sampletotal.Wregion / ACRES87sampletotal.Wregion)))
## [1] 935894643
# Estimated population total for ACRES92
# based from auxiliary variable ACRES87 and
# using the separate ratio estimator method is 935894643
# (Reference) actual ACRES92 population total is 943336889
# Create the overall summary
(EstimationMethod <-
c( "Actual Population",
"Simple Random Sampling",
"Ratio using ACRES87",
"Combined Ratio using ACRES87",
"Separate Ratio using ACRES87"))
## [1] "Actual Population" "Simple Random Sampling"
## [3] "Ratio using ACRES87" "Combined Ratio using ACRES87"
## [5] "Separate Ratio using ACRES87"
(ACRES92PopulationTotal <-
c( format(round(ACRES92_poptotal),nsmall=2,scientific=FALSE),
format(round(ACRES92_totalestimate),nsmall=2,scientific=FALSE),
format(round(ACRES92_estimatedtotalusingACRES87),nsmall=2,scientific=FALSE),
format(round(ACRES92_estimatedtotalusingACRES87byCRE),nsmall=2,scientific=FALSE),
format(round(ACRES92_estimatedtotalusingACRES87bySRE),nsmall=2,scientific=FALSE)))
## [1] "943336889.00" "1070652381.00" "945011015.00" "934901117.00"
## [5] "935894643.00"
(ACRES92PopulationMean <-
c( format(round(ACRES92_popmean),nsmall=2,scientific=FALSE),
format(round(ACRES92_samplemean),nsmall=2,scientific=FALSE),
format(round(ACRES92_estimatedmeanusingACRES87),nsmall=2,scientific=FALSE),
NA,
NA))
## [1] "309900.00" "351725.00" "310450.00" NA NA
(ACRES92Summary <-
as.data.frame(cbind(EstimationMethod,
ACRES92PopulationTotal,
ACRES92PopulationMean)))
## EstimationMethod ACRES92PopulationTotal
## 1 Actual Population 943336889.00
## 2 Simple Random Sampling 1070652381.00
## 3 Ratio using ACRES87 945011015.00
## 4 Combined Ratio using ACRES87 934901117.00
## 5 Separate Ratio using ACRES87 935894643.00
## ACRES92PopulationMean
## 1 309900.00
## 2 351725.00
## 3 310450.00
## 4 <NA>
## 5 <NA>