a Figure 13 shows one country in Africa that has very high GDP compared with

A figure 13 shows one country in africa that has very

This preview shows page 2 - 5 out of 10 pages.

a. Figure 1.3 shows one country in Africa that has very high GDP compared with the rest of Africa (above 20,000). This makes it an outlier amongst just the Africa data. However it also has remarkably high infant mortality for a country with such a high GDP. In Africa, high infant mortality is common, but the high GDP combined with high infant mortality makes it an outlier even when all countries are included, as in the lower LH corner of Figure 1.1. There are no other countries with such a high GDP and such high infant mortality as well. Figure 1.2 shows that there are no outliers in infant mortality according to the box plots, and this agrees with observations on the other graphs. Note: Students might also point out Figure 1.2 where there is an outlier for the Middle East (4) d) Using Figure 1.1, discuss the relationship between Health Expenditure and Infant Mortality. a. In Figure 1.1, we see that in each region, the correlation between Health Expenditure and Infant mortality is negative as expected, but not very strong. (1) b. From the scatterplot of Health Expenditure against Infant Mortality, we see that Health Expenditure is uniformly very low in Africa. (2) c. In Asia and the Middle East there are several countries with very high health expenditure and these have very low Infant Mortality. (2) e) Which graph would you use to highlight the difference in infant mortality between Africa and the other two regions? Discuss your chosen graph in detail. a. Boxplot: It is easy to quantify the differences between the regions for infant mortality. If I am wanting to highlight just this variable, then this graphic is probably the best to use as it tells us about this variable alone. The median value of Infant Mortality in Africa is around 62, whereas the median for Asia is around 25 and for the middle east it is around 12. The boxplot makes it clear that the bulk of the countries in Africa have infant mortality rates well above those in the other two regions. (5) f) Write down the ggplot command for creating Figure 1.2 by using the variable names from the background of this section: a. ggplot(data = countries.df, Page 2 of 10
Image of page 2

Subscribe to view the full document.

b. aes(x = RegionName, c. y = infmortality d. )) + e. geom_boxplot() + f. labs(title = "Figure 1.2", g. x = "Region Name", h. y = "Infant mortality per 1000 live births") Note: Full marks for correct code (5) if the title or axis are missing -1 for each name Page 3 of 10
Image of page 3
Question 2 [5 + 5 = 10 marks] a) Table 2.1 represents a subset of the data for 3 countries in Africa. Suppose subtab.df is the data frame containing the columns of Table 2.1. Implement by hand the following command, thus rewriting this data in long form: gather(data = subtab.df, key = 'Measurement', value = 'Quantvalue', -Name ) (5) b) Supose you have as input table 2.2. Write down the dplyr commands for calculating the average value for each measurement across the regions. The input data frame is called “subtab.df”: subtab.df %>% group_by(region, measurement) %>% summarise(average=mean(value)) (5) c) Supose you have as input table 2.2 in the database with the tablename public.subset. Write down the sql commands for calculating the average value for each measurement across the regions.
Image of page 4

Subscribe to view the full document.

Image of page 5
  • '19

What students are saying

  • Left Quote Icon

    As a current student on this bumpy collegiate pathway, I stumbled upon Course Hero, where I can find study resources for nearly all my courses, get online help from tutors 24/7, and even share my old projects, papers, and lecture notes with other students.

    Student Picture

    Kiran Temple University Fox School of Business ‘17, Course Hero Intern

  • Left Quote Icon

    I cannot even describe how much Course Hero helped me this summer. It’s truly become something I can always rely on and help me. In the end, I was not only able to survive summer classes, but I was able to thrive thanks to Course Hero.

    Student Picture

    Dana University of Pennsylvania ‘17, Course Hero Intern

  • Left Quote Icon

    The ability to access any university’s resources through Course Hero proved invaluable in my case. I was behind on Tulane coursework and actually used UCLA’s materials to help me move forward and get everything together on time.

    Student Picture

    Jill Tulane University ‘16, Course Hero Intern

Ask Expert Tutors You can ask 0 bonus questions You can ask 0 questions (0 expire soon) You can ask 0 questions (will expire )
Answers in as fast as 15 minutes