What are the differences in the relationship between lifeExp ~ year among continents in the gapminder dataset?
To answer this question:
Fit lm models of lifeExp ~ year for each country as described in the ch. 25 text.
Use the broom package to make a tidy object of the coefficients (i.e.,the variable named estimate) and their confidence intervals (i.e., the variables named conf.low and conf.high).
Using your own code and style, plot these coefficients along with their confidence intervals for each country grouped by continent using ggplot and one of the facet_* functions such as facet_wrap.
Hint: remember my lecture and see this blog post http://varianceexplained.org/r/broom-intro/
BONUS +2: Plot the mean coefficient values for each continent. Plot the confidence intervals around these continent means.
gapminder %>% ggplot(aes(year, lifeExp, group = country))+geom_line(alpha = 1 / 3) +facet_wrap(~continent)
lm(data = gapminder, formula = l
lot_l <-lm(data = gapminder, formula = lifeExp ~year+country+continent)
lot_c<-tidy(lot_l,conf.int = TRUE)
lot_c %>% ggplot(aes(estimate, conf.low,conf.high)) +geom_line(aes(group = term), alpha = 1 / 3) + geom_smooth(se = FALSE)+facet_grid(~term)
Recently Asked Questions
- Assume that the number of network errors experienced in a day on a local area network (LAN) is distributed as a Poisson random variable. The mean number of
- Please refer to the attachment to answer this question. This question was created from Document1.pdf.
- In Procurement Ethics Case, Scenario 4 question 3 is missing. The question is"Ethical decisions that affect a buyer's ethical perspective usually involve the