Qn 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?
source("http://www.openintro.org/stat/data/arbuthnot.R")
source("http://www.openintro.org/stat/data/present.R")
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
The Years included are from 1940 - 2002.
dim(present)
## [1] 63 3
names(present)
## [1] "year" "boys" "girls"
Qn 2 : How do these counts compare to Arbuthnot’s? Are they on a similar scale?
ay<-arbuthnot$year
ag<-arbuthnot$girls
ab<-arbuthnot$boys
# in case of Arbuthnot's, The counts are in thousands.
plot(x=ay,y=ag,type = 'l')
py<-present$year
pg<-present$girls
pb<-present$boys
plot(x=py,y=pg,type = 'l')
In case of Arbuthnot’s, The counts are in thousands. Where as in case of Present’s the counts are in millions
Qn 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.
#Boy to Girl Ratio in Present Data
plot(x=py,y=pb/pg, type = "l")
#Boy to Girl Ratio as per Arbuthnot's observation
plot(x=ay,y=ab/ag, type = "l")
Yes. Arbuthnot’s observation about boys being born in greater proportion than girls hold up in the U.S
Qn 4 : 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.
children<- pg+pb
years <- py
df1<-data.frame(years,children)
plot(x=years, y = children, type = "l")
df1
## years children
## 1 1940 2360399
## 2 1941 2513427
## 3 1942 2808996
## 4 1943 2936860
## 5 1944 2794800
## 6 1945 2735456
## 7 1946 3288672
## 8 1947 3699940
## 9 1948 3535068
## 10 1949 3559529
## 11 1950 3554149
## 12 1951 3750850
## 13 1952 3846986
## 14 1953 3902120
## 15 1954 4017362
## 16 1955 4047295
## 17 1956 4163090
## 18 1957 4254784
## 19 1958 4203812
## 20 1959 4244796
## 21 1960 4257850
## 22 1961 4268326
## 23 1962 4167362
## 24 1963 4098020
## 25 1964 4027490
## 26 1965 3760358
## 27 1966 3606274
## 28 1967 3520959
## 29 1968 3501564
## 30 1969 3600206
## 31 1970 3731386
## 32 1971 3555970
## 33 1972 3258411
## 34 1973 3136965
## 35 1974 3159958
## 36 1975 3144198
## 37 1976 3167788
## 38 1977 3326632
## 39 1978 3333279
## 40 1979 3494398
## 41 1980 3612258
## 42 1981 3629238
## 43 1982 3680537
## 44 1983 3638933
## 45 1984 3669141
## 46 1985 3760561
## 47 1986 3756547
## 48 1987 3809394
## 49 1988 3909510
## 50 1989 4040958
## 51 1990 4158212
## 52 1991 4110907
## 53 1992 4065014
## 54 1993 4000240
## 55 1994 3952767
## 56 1995 3899589
## 57 1996 3891494
## 58 1997 3880894
## 59 1998 3941553
## 60 1999 3959417
## 61 2000 4058814
## 62 2001 4025933
## 63 2002 4021726
df1[df1$children==max(df1$children),]
## years children
## 22 1961 4268326
Ans : in 1961