Question: ### 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

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Mathematics Questions!