Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

### Problem 5: dlply + ldply For this problem we'll return to the `gapminder` data set from Lecture 10. ```{R} gapminder

### Problem 5: dlply + ldply

For this problem we'll return to the `gapminder` data set from Lecture 10.

```{R}

gapminder <- read.delim("https://www.colorado.edu/amath/sites/default/files/attached-files/gapminder_five.txt

")

gapminder

```

##### (a) Use `dlply` to produce a list of linear regression models, one for each country, regressing `gdpPercap` on `year`.

```{R}

#Edit here

```

##### (b) Use `ldply` on your list from part (a) to produce a data frame displaying for each country whether the coefficient of `year` was significant at the 0.05 level.Your output should be a two column data frame: the first column gives the country, and the second column displays a 0 if the coefficient of `year` was not significant, and a 1 if it was significant.

```{R}

#Edit here

```

##### (c)The following code produces a data frame giving the continent for each country.

```{R}

summary.continent <- ddply(gapminder, ~ country, summarize, continent = unique(continent))

```

Use the `merge` function to merge your data frame from part (b) with `summary.continent` to produce a data frame that shows both the slope significance indicator and also the continent.(See Lecture 10 notes for examples of how to do this.)

```{R}

#Edit here

```

##### (d) Using your data frame from part (c), produce a contingency table showing counts for each combination of slope significance and continent.

```{R}

#Edit here

```

##### (e) What do you observe in the table from part (d)?What does a non-significant slope (coefficient of year) suggest about a country's economic growth?

```

Replace this text with your answer.

```

Need help with Jupiter notebook assignment

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

A First Course In Discrete Mathematics

Authors: John C Molluzzo, Fred Buckley

1st Edition

1478634383, 9781478634386

More Books

Students also viewed these Mathematics questions

Question

Mortality rate

Answered: 1 week ago

Question

Armed conflicts.

Answered: 1 week ago