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
- Please refer to the attachment to answer this question. This question was created from MGT 3103 Unit 5. Additional comments: "Joan Frazier was just hired as an
- Please refer to the attachment to answer this question. This question was created from Assignment%203-2.docx.
- In the space below, in 4-6 sentences, discuss why it is beneficial to determine a newsvendor optimal quantity and use this quantity for repeated decision