Present (1940 to 2002)

On Your Own

In the previous few pages, you recreated some of the displays and preliminary analysis of Arbuthnot’s baptism data. Your assignment involves repeating these steps, but for present day birth records in the United States. Load up the present day data with the following command.

source(“http://www.openintro.org/stat/data/present.R”) The data are stored in a data frame called present.

source("http://www.openintro.org/stat/data/present.R")

source("http://www.openintro.org/stat/data/arbuthnot.R")

What years are included in this data set? What are the dimensions of the data frame and what are the variable or column names?

  • The data includes years from 1940 to 2002.
  • The data has 63 rows and 3 columns.
  • The names of the columns are year, boys, and girls.
present
##    year    boys   girls
## 1  1940 1211684 1148715
## 2  1941 1289734 1223693
## 3  1942 1444365 1364631
## 4  1943 1508959 1427901
## 5  1944 1435301 1359499
## 6  1945 1404587 1330869
## 7  1946 1691220 1597452
## 8  1947 1899876 1800064
## 9  1948 1813852 1721216
## 10 1949 1826352 1733177
## 11 1950 1823555 1730594
## 12 1951 1923020 1827830
## 13 1952 1971262 1875724
## 14 1953 2001798 1900322
## 15 1954 2059068 1958294
## 16 1955 2073719 1973576
## 17 1956 2133588 2029502
## 18 1957 2179960 2074824
## 19 1958 2152546 2051266
## 20 1959 2173638 2071158
## 21 1960 2179708 2078142
## 22 1961 2186274 2082052
## 23 1962 2132466 2034896
## 24 1963 2101632 1996388
## 25 1964 2060162 1967328
## 26 1965 1927054 1833304
## 27 1966 1845862 1760412
## 28 1967 1803388 1717571
## 29 1968 1796326 1705238
## 30 1969 1846572 1753634
## 31 1970 1915378 1816008
## 32 1971 1822910 1733060
## 33 1972 1669927 1588484
## 34 1973 1608326 1528639
## 35 1974 1622114 1537844
## 36 1975 1613135 1531063
## 37 1976 1624436 1543352
## 38 1977 1705916 1620716
## 39 1978 1709394 1623885
## 40 1979 1791267 1703131
## 41 1980 1852616 1759642
## 42 1981 1860272 1768966
## 43 1982 1885676 1794861
## 44 1983 1865553 1773380
## 45 1984 1879490 1789651
## 46 1985 1927983 1832578
## 47 1986 1924868 1831679
## 48 1987 1951153 1858241
## 49 1988 2002424 1907086
## 50 1989 2069490 1971468
## 51 1990 2129495 2028717
## 52 1991 2101518 2009389
## 53 1992 2082097 1982917
## 54 1993 2048861 1951379
## 55 1994 2022589 1930178
## 56 1995 1996355 1903234
## 57 1996 1990480 1901014
## 58 1997 1985596 1895298
## 59 1998 2016205 1925348
## 60 1999 2026854 1932563
## 61 2000 2076969 1981845
## 62 2001 2057922 1968011
## 63 2002 2057979 1963747
dim(present)
## [1] 63  3
names(present)
## [1] "year"  "boys"  "girls"

How do these counts compare to Arbuthnot’s? Are they on a similar scale?

As you one can clearly see, the present data count for boys and girls are not on the same scale as arbuthnot’s data. The present counts are in the millions while arbuthnot’s is in the thousands only.

summary(present)
##       year           boys             girls        
##  Min.   :1940   Min.   :1211684   Min.   :1148715  
##  1st Qu.:1956   1st Qu.:1799857   1st Qu.:1711405  
##  Median :1971   Median :1924868   Median :1831679  
##  Mean   :1971   Mean   :1885600   Mean   :1793915  
##  3rd Qu.:1986   3rd Qu.:2058524   3rd Qu.:1965538  
##  Max.   :2002   Max.   :2186274   Max.   :2082052
summary(arbuthnot)
##       year           boys          girls     
##  Min.   :1629   Min.   :2890   Min.   :2722  
##  1st Qu.:1649   1st Qu.:4759   1st Qu.:4457  
##  Median :1670   Median :6073   Median :5718  
##  Mean   :1670   Mean   :5907   Mean   :5535  
##  3rd Qu.:1690   3rd Qu.:7576   3rd Qu.:7150  
##  Max.   :1710   Max.   :8426   Max.   :7779

Make a plot that displays the boy-to-girl ratio for every year in the data set. What do you see? Does Arbuthnot’s observation about boys being born in greater proportion than girls hold up in the U.S.? Include the plot in your response.

Yes. Based on the plot below, there are more boys than girls on the dataset from 1940 to 2002.

present$boyGirlRatio <- (present$boys / present$girls)

plot(x = present$year, y = present$boyGirlRatio)

In what year did we see the most total number of births in the U.S.? You can refer to the help files or the R reference card http://cran.r-project.org/doc/contrib/Short-refcard.pdf to find helpful commands.

Based on the result below, 1961 is the year that has the most total number of births in the dataset.

present$totalBirth <- present$boys + present$girls
maxTotal <- max(present$totalBirth)
present[present$totalBirth == maxTotal,]
##    year    boys   girls boyGirlRatio totalBirth
## 22 1961 2186274 2082052     1.050057    4268326

Arbuthnot (1629 - 1710)

arbuthnot
##    year boys girls
## 1  1629 5218  4683
## 2  1630 4858  4457
## 3  1631 4422  4102
## 4  1632 4994  4590
## 5  1633 5158  4839
## 6  1634 5035  4820
## 7  1635 5106  4928
## 8  1636 4917  4605
## 9  1637 4703  4457
## 10 1638 5359  4952
## 11 1639 5366  4784
## 12 1640 5518  5332
## 13 1641 5470  5200
## 14 1642 5460  4910
## 15 1643 4793  4617
## 16 1644 4107  3997
## 17 1645 4047  3919
## 18 1646 3768  3395
## 19 1647 3796  3536
## 20 1648 3363  3181
## 21 1649 3079  2746
## 22 1650 2890  2722
## 23 1651 3231  2840
## 24 1652 3220  2908
## 25 1653 3196  2959
## 26 1654 3441  3179
## 27 1655 3655  3349
## 28 1656 3668  3382
## 29 1657 3396  3289
## 30 1658 3157  3013
## 31 1659 3209  2781
## 32 1660 3724  3247
## 33 1661 4748  4107
## 34 1662 5216  4803
## 35 1663 5411  4881
## 36 1664 6041  5681
## 37 1665 5114  4858
## 38 1666 4678  4319
## 39 1667 5616  5322
## 40 1668 6073  5560
## 41 1669 6506  5829
## 42 1670 6278  5719
## 43 1671 6449  6061
## 44 1672 6443  6120
## 45 1673 6073  5822
## 46 1674 6113  5738
## 47 1675 6058  5717
## 48 1676 6552  5847
## 49 1677 6423  6203
## 50 1678 6568  6033
## 51 1679 6247  6041
## 52 1680 6548  6299
## 53 1681 6822  6533
## 54 1682 6909  6744
## 55 1683 7577  7158
## 56 1684 7575  7127
## 57 1685 7484  7246
## 58 1686 7575  7119
## 59 1687 7737  7214
## 60 1688 7487  7101
## 61 1689 7604  7167
## 62 1690 7909  7302
## 63 1691 7662  7392
## 64 1692 7602  7316
## 65 1693 7676  7483
## 66 1694 6985  6647
## 67 1695 7263  6713
## 68 1696 7632  7229
## 69 1697 8062  7767
## 70 1698 8426  7626
## 71 1699 7911  7452
## 72 1700 7578  7061
## 73 1701 8102  7514
## 74 1702 8031  7656
## 75 1703 7765  7683
## 76 1704 6113  5738
## 77 1705 8366  7779
## 78 1706 7952  7417
## 79 1707 8379  7687
## 80 1708 8239  7623
## 81 1709 7840  7380
## 82 1710 7640  7288
dim(arbuthnot)
## [1] 82  3
names(arbuthnot)
## [1] "year"  "boys"  "girls"

What command would you use to extract just the counts of girls baptized? Try it!

sum(arbuthnot$girls)
## [1] 453841

Is there an apparent trend in the number of girls baptized over the years?

How would you describe it?

Since around 1660, the number of girls baptized had been steadily increasing. Before then, there was a drop in the number of girls baptized.

plot(x = arbuthnot$year, y = arbuthnot$girls)

plot(x = arbuthnot$year, y = arbuthnot$girls, type = "l")

plot(x=arbuthnot$year, y=arbuthnot$boys + arbuthnot$girls, type = "l")

arbuthnot$boyProportion <- arbuthnot$boys / (arbuthnot$boys + arbuthnot$girls)
arbuthnot
##    year boys girls boyProportion
## 1  1629 5218  4683     0.5270175
## 2  1630 4858  4457     0.5215244
## 3  1631 4422  4102     0.5187705
## 4  1632 4994  4590     0.5210768
## 5  1633 5158  4839     0.5159548
## 6  1634 5035  4820     0.5109082
## 7  1635 5106  4928     0.5088698
## 8  1636 4917  4605     0.5163831
## 9  1637 4703  4457     0.5134279
## 10 1638 5359  4952     0.5197362
## 11 1639 5366  4784     0.5286700
## 12 1640 5518  5332     0.5085714
## 13 1641 5470  5200     0.5126523
## 14 1642 5460  4910     0.5265188
## 15 1643 4793  4617     0.5093518
## 16 1644 4107  3997     0.5067868
## 17 1645 4047  3919     0.5080341
## 18 1646 3768  3395     0.5260366
## 19 1647 3796  3536     0.5177305
## 20 1648 3363  3181     0.5139059
## 21 1649 3079  2746     0.5285837
## 22 1650 2890  2722     0.5149679
## 23 1651 3231  2840     0.5322023
## 24 1652 3220  2908     0.5254569
## 25 1653 3196  2959     0.5192526
## 26 1654 3441  3179     0.5197885
## 27 1655 3655  3349     0.5218447
## 28 1656 3668  3382     0.5202837
## 29 1657 3396  3289     0.5080030
## 30 1658 3157  3013     0.5116694
## 31 1659 3209  2781     0.5357262
## 32 1660 3724  3247     0.5342132
## 33 1661 4748  4107     0.5361942
## 34 1662 5216  4803     0.5206108
## 35 1663 5411  4881     0.5257482
## 36 1664 6041  5681     0.5153557
## 37 1665 5114  4858     0.5128359
## 38 1666 4678  4319     0.5199511
## 39 1667 5616  5322     0.5134394
## 40 1668 6073  5560     0.5220493
## 41 1669 6506  5829     0.5274422
## 42 1670 6278  5719     0.5232975
## 43 1671 6449  6061     0.5155076
## 44 1672 6443  6120     0.5128552
## 45 1673 6073  5822     0.5105507
## 46 1674 6113  5738     0.5158214
## 47 1675 6058  5717     0.5144798
## 48 1676 6552  5847     0.5284297
## 49 1677 6423  6203     0.5087122
## 50 1678 6568  6033     0.5212285
## 51 1679 6247  6041     0.5083822
## 52 1680 6548  6299     0.5096910
## 53 1681 6822  6533     0.5108199
## 54 1682 6909  6744     0.5060426
## 55 1683 7577  7158     0.5142178
## 56 1684 7575  7127     0.5152360
## 57 1685 7484  7246     0.5080788
## 58 1686 7575  7119     0.5155165
## 59 1687 7737  7214     0.5174905
## 60 1688 7487  7101     0.5132301
## 61 1689 7604  7167     0.5147925
## 62 1690 7909  7302     0.5199527
## 63 1691 7662  7392     0.5089677
## 64 1692 7602  7316     0.5095857
## 65 1693 7676  7483     0.5063659
## 66 1694 6985  6647     0.5123973
## 67 1695 7263  6713     0.5196766
## 68 1696 7632  7229     0.5135590
## 69 1697 8062  7767     0.5093183
## 70 1698 8426  7626     0.5249190
## 71 1699 7911  7452     0.5149385
## 72 1700 7578  7061     0.5176583
## 73 1701 8102  7514     0.5188268
## 74 1702 8031  7656     0.5119526
## 75 1703 7765  7683     0.5026541
## 76 1704 6113  5738     0.5158214
## 77 1705 8366  7779     0.5181790
## 78 1706 7952  7417     0.5174052
## 79 1707 8379  7687     0.5215362
## 80 1708 8239  7623     0.5194175
## 81 1709 7840  7380     0.5151117
## 82 1710 7640  7288     0.5117899

Now, make a plot of the proportion of boys over time. What do you see?

The proportion of boys baptized fluctuates between 0.50 and 0.53.

plot(x=arbuthnot$year, y=arbuthnot$boyProportion, type="l")

More boys?

For all the years, there were more boys baptized than girls.

arbuthnot$isMoreBoys <- arbuthnot$boys > arbuthnot$girls
arbuthnot
##    year boys girls boyProportion isMoreBoys
## 1  1629 5218  4683     0.5270175       TRUE
## 2  1630 4858  4457     0.5215244       TRUE
## 3  1631 4422  4102     0.5187705       TRUE
## 4  1632 4994  4590     0.5210768       TRUE
## 5  1633 5158  4839     0.5159548       TRUE
## 6  1634 5035  4820     0.5109082       TRUE
## 7  1635 5106  4928     0.5088698       TRUE
## 8  1636 4917  4605     0.5163831       TRUE
## 9  1637 4703  4457     0.5134279       TRUE
## 10 1638 5359  4952     0.5197362       TRUE
## 11 1639 5366  4784     0.5286700       TRUE
## 12 1640 5518  5332     0.5085714       TRUE
## 13 1641 5470  5200     0.5126523       TRUE
## 14 1642 5460  4910     0.5265188       TRUE
## 15 1643 4793  4617     0.5093518       TRUE
## 16 1644 4107  3997     0.5067868       TRUE
## 17 1645 4047  3919     0.5080341       TRUE
## 18 1646 3768  3395     0.5260366       TRUE
## 19 1647 3796  3536     0.5177305       TRUE
## 20 1648 3363  3181     0.5139059       TRUE
## 21 1649 3079  2746     0.5285837       TRUE
## 22 1650 2890  2722     0.5149679       TRUE
## 23 1651 3231  2840     0.5322023       TRUE
## 24 1652 3220  2908     0.5254569       TRUE
## 25 1653 3196  2959     0.5192526       TRUE
## 26 1654 3441  3179     0.5197885       TRUE
## 27 1655 3655  3349     0.5218447       TRUE
## 28 1656 3668  3382     0.5202837       TRUE
## 29 1657 3396  3289     0.5080030       TRUE
## 30 1658 3157  3013     0.5116694       TRUE
## 31 1659 3209  2781     0.5357262       TRUE
## 32 1660 3724  3247     0.5342132       TRUE
## 33 1661 4748  4107     0.5361942       TRUE
## 34 1662 5216  4803     0.5206108       TRUE
## 35 1663 5411  4881     0.5257482       TRUE
## 36 1664 6041  5681     0.5153557       TRUE
## 37 1665 5114  4858     0.5128359       TRUE
## 38 1666 4678  4319     0.5199511       TRUE
## 39 1667 5616  5322     0.5134394       TRUE
## 40 1668 6073  5560     0.5220493       TRUE
## 41 1669 6506  5829     0.5274422       TRUE
## 42 1670 6278  5719     0.5232975       TRUE
## 43 1671 6449  6061     0.5155076       TRUE
## 44 1672 6443  6120     0.5128552       TRUE
## 45 1673 6073  5822     0.5105507       TRUE
## 46 1674 6113  5738     0.5158214       TRUE
## 47 1675 6058  5717     0.5144798       TRUE
## 48 1676 6552  5847     0.5284297       TRUE
## 49 1677 6423  6203     0.5087122       TRUE
## 50 1678 6568  6033     0.5212285       TRUE
## 51 1679 6247  6041     0.5083822       TRUE
## 52 1680 6548  6299     0.5096910       TRUE
## 53 1681 6822  6533     0.5108199       TRUE
## 54 1682 6909  6744     0.5060426       TRUE
## 55 1683 7577  7158     0.5142178       TRUE
## 56 1684 7575  7127     0.5152360       TRUE
## 57 1685 7484  7246     0.5080788       TRUE
## 58 1686 7575  7119     0.5155165       TRUE
## 59 1687 7737  7214     0.5174905       TRUE
## 60 1688 7487  7101     0.5132301       TRUE
## 61 1689 7604  7167     0.5147925       TRUE
## 62 1690 7909  7302     0.5199527       TRUE
## 63 1691 7662  7392     0.5089677       TRUE
## 64 1692 7602  7316     0.5095857       TRUE
## 65 1693 7676  7483     0.5063659       TRUE
## 66 1694 6985  6647     0.5123973       TRUE
## 67 1695 7263  6713     0.5196766       TRUE
## 68 1696 7632  7229     0.5135590       TRUE
## 69 1697 8062  7767     0.5093183       TRUE
## 70 1698 8426  7626     0.5249190       TRUE
## 71 1699 7911  7452     0.5149385       TRUE
## 72 1700 7578  7061     0.5176583       TRUE
## 73 1701 8102  7514     0.5188268       TRUE
## 74 1702 8031  7656     0.5119526       TRUE
## 75 1703 7765  7683     0.5026541       TRUE
## 76 1704 6113  5738     0.5158214       TRUE
## 77 1705 8366  7779     0.5181790       TRUE
## 78 1706 7952  7417     0.5174052       TRUE
## 79 1707 8379  7687     0.5215362       TRUE
## 80 1708 8239  7623     0.5194175       TRUE
## 81 1709 7840  7380     0.5151117       TRUE
## 82 1710 7640  7288     0.5117899       TRUE