Getting Started

loading the data & getting a preview with the head() function

##   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

Task 1

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

##       year           boys             girls        
##  Min.   :1940   Min.   :1211684   Min.   :1148715  
##  1st Qu.:1956   1st Qu.:1799857   1st Qu.:1711404  
##  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

From this output of summary() we can see that there are three columns, or variables to the data with the names: ‘year’, ‘boys’ & ’girls.

## [1] 63  3

From the output of dim() we can see that there are 63 rows with entries of the 3 different data variables. This is not a large dataset, so we can simply view the data in the ‘years’ column to see what years are included in the data set

##  [1] 1940 1941 1942 1943 1944 1945 1946 1947 1948 1949 1950 1951 1952 1953 1954
## [16] 1955 1956 1957 1958 1959 1960 1961 1962 1963 1964 1965 1966 1967 1968 1969
## [31] 1970 1971 1972 1973 1974 1975 1976 1977 1978 1979 1980 1981 1982 1983 1984
## [46] 1985 1986 1987 1988 1989 1990 1991 1992 1993 1994 1995 1996 1997 1998 1999
## [61] 2000 2001 2002

Indeed, the output above gives us a good idea of what years are imcluded, but what if our dataset had 63,000 entries instead of just 63? Let’s use a few simple ways to explicitly learn about the ‘years’ data.

## Min. 
## 1940
## Max. 
## 2002

The summary() functions gives us some summary statistics on the feature ‘year’ for our data frame ‘present’. From this we get the range of years Min.:Max. = 1940-2002

## [1] TRUE

The above few lines of code gives a little sanity check that comfirms that ‘year’ includes each year from 1940 to 2002 inclusive of both ends of the range.

Task 2

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

##       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
##       year           boys             girls        
##  Min.   :1940   Min.   :1211684   Min.   :1148715  
##  1st Qu.:1956   1st Qu.:1799857   1st Qu.:1711404  
##  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

A glance at the Mean values for ‘boys’ and ‘girls’ features for both datasets suggests that the counts for the ‘present’ data are several orders of magnitude greater than that of the ‘arbuthnot’ dataset. We can further quantify this….

## [1] TRUE TRUE
## Proportion of arbuthnot 'boys' counts:  0.002874931
## Proportion of arbuthnot 'girls' counts:  0.002822238

From the proportions of counts for ‘boys’ and ‘girls’ above, we learn that the counts in the ‘present’ dataframe are approximately 3 orders of magnitude greater than those of the arbuthnot dataframe.

Task 3

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.

From the figure above we can see that the datapoints for each year lie above 1.00 (indicated here with a blue line). This tells us that for each years counts had proportionately more boys counts than girl counts. If the counts were equal, the ratio’s value would equal 1 (blue line), and if there had been a year with more ‘girls’ counts than ‘boys’, that ratio value would lie below 1.0. Neither of these alternatives are observed in the figure. Therefore, arbuthnot’s observation about boys being born in greater proportion than girls does hold up in the U.S.

However, this representation is not very intuitive, so we can recalculate and plot the data as a percentage of ‘boys’ counts from the total counts.

The figure above replots the data as a percentage of ‘boys’ counts. This is more intuitive as most people are very familiar with considering percentages of a quantity rather than ratios of two quantities. From this representation we see the same finding: for each year of the data, the ‘boys’ counts make up a larger percentage of the total counts than ‘girls’ counts do, because each point of %boys counts data is greater than 50% (indicated with a blue line in the figure).

Task 4

In what year did we see the most total number of births in the U.S.?

##   year    boys   girls   total
## 1 1940 1211684 1148715 2360399
## 2 1941 1289734 1223693 2513427
## 3 1942 1444365 1364631 2808996
## 4 1943 1508959 1427901 2936860
## 5 1944 1435301 1359499 2794800
## 6 1945 1404587 1330869 2735456
##    year    boys   girls   total
## 22 1961 2186274 2082052 4268326

From the above result, we see that the year with the highest count value was 1961. This is surprising and not what was expected from our previous analysis of the arbuthnot dataset. The arbuthnot data had an overall trend of an increase as a function of years. If the present dataset were to follow the same trend, the expected maximum value would be towards the later years in the 20th century or perhaps even on of the few datapoints in the 2000s.

Let’s plot ‘total’ as a function of years

The plot of the total population counts above confirms that the year 1961 represents the peak of birth counts that occured during the mid 20th century in the U.S. and confirms that the term Baby Boomers is not an exaggeration at all!

Baby Boomer 1000 piece puzzle available at White Mountain Puzzles

Baby Boomer 1000 piece puzzle available at White Mountain Puzzles