Solve this question Include the graph and the code of the gr
Solve this question. Include the graph and the code of the graph too.
Please answer the whole question part (a) and (b), this the 3nd time to ask this question. I hope I can get the complete and correct answer as well. Also please provide as text, so I can copy it immediately. Thank you
The Robey dataset in the car library package looks at Fertility and Contraception in developing nations around 1990.
(a) Generate side-by-side boxplots to compare contraceptors for different regions. Label the axes accordingly and provide a title. Which region has the highest median percentage of contracep-tors?
(b) Plot the percent of contraceptors among married women of childbearing age versus total fertility rate. Make sure to appropriately label your axes and provide a title. Is there an association between these two variables? If so, what kind of trend do you see with respect to the variables in question?
The data:
region tfr contraceptors
Botswana Africa 4.8 35
Burundi Africa 6.5 9
Cameroon Africa 5.9 16
Ghana Africa 6.1 13
Kenya Africa 6.5 27
Liberia Africa 6.4 6
Mali Africa 6.8 5
Mauitius Africa 2.2 75
Niger Africa 7.3 4
Nigeria Africa 5.7 6
Senegal Africa 6.4 12
Sudan Africa 4.8 9
Swaziland Africa 5.0 21
Tanzania Africa 6.1 10
Togo Africa 6.1 12
Uganda Africa 7.2 5
Zambia Africa 6.3 15
Zimbabwe Africa 5.3 45
Bangladesh Asia 5.5 40
China Asia 2.5 72
India Asia 4.3 45
Indonesia Asia 3.0 50
Korea.Rep.of Asia 1.7 77
Pakistan Asia 5.2 12
Philippines Asia 4.3 34
Sri.Lanka Asia 2.7 62
Thailand Asia 2.3 68
Vietnam Asia 3.9 53
Belize Latin.Amer 4.5 47
Bolivia Latin.Amer 4.9 32
Brazil Latin.Amer 3.6 66
Columbia Latin.Amer 2.8 66
Costa.Rica Latin.Amer 3.6 70
Dom.Republic Latin.Amer 3.3 56
Ecuador Latin.Amer 3.8 53
El.Salvador Latin.Amer 4.6 47
Guatemala Latin.Amer 5.6 23
Haiti Latin.Amer 6.0 10
Jamaica Latin.Amer 2.9 55
Mexico Latin.Amer 4.0 55
Panama Latin.Amer 4.0 58
Paraguay Latin.Amer 4.6 48
Peru Latin.Amer 3.5 59
Trinidad.Tobago Latin.Amer 3.1 54
Egypt Near.East 4.6 40
Jordan Near.East 5.5 35
Morocco Near.East 4.0 42
Tunisia Near.East 4.3 51
Turkey Near.East 3.4 60
Yemen Near.East 7.0 7
Solution
(a)
Latin Amer region has the highest median percentage of contracep-tors
R-coding is
Africa=c(35,9,16,13,27,6,5,75,4,6,12,9,21,10,12,5,15,45)
Asia=c(40,72,45,50,77,12,34,62,68,53)
Latin.Amer=c(47,32,66,66,70,56,53,47,23,10,55,55,58,48,59,54)
Near.East=c(40,35,42,51,60,7)
boxplot(Africa,Asia,Latin.Amer,Near.East, main=\"contraceptors\", names=c(\"Africa\",\"Asia\",\"Latin.Amer\",\"Near.East\"))
(b)
x=c(35,9,16,13,27,6,5,75,4,6,12,9,21,10,12,5,15,45,40,72,45,50,77,12,34,62,68,53
,47,32,66,66,70,56,53,47,23,10,55,55,58,48,59,54,40,35,42,51,60,7)
y=c(4.8,6.5,5.9,6.1,6.5,6.4,6.8,2.2,7.3,5.7,6.4,4.8,5,6.1,6.1,7.2,
6.3,5.3,5.5,2.5,4.3,3,1.7,5.2,4.3,2.7,2.3,3.9,4.5,4.9,3.6,2.8,3.6
,3.3,3.8,4.6,5.6,6,2.9,4,4,4.6,3.5,3.1,4.6,5.5,4,4.3,3.4,7)
plot(x,y, main=\"childbearing age versus total fertility rate\", xlab=\"childbearing age\" , ylab=\"total fertility rate\")

