RStudio coding.

leosdesire
3000activity2.rtf

STA 3000 - Statistical computing

In-class activity 2

Due S aturday , November 2nd @ 1159pm

Gapminder

Read in the gapminder dataset, which is in library(gapminder). If you don’t have the library, you’ll have to install it (i.e. you’ll have to run install.packages(“gapminder”)). Once you have the library, you can read in the data with the instructions:

library(gapminder)

data(gapminder)

As usual, you can get information on the dataset after typing in ?gapminder.

Create a figure that shows the relationship between the continent, year, life expectancy, population, and GDP per capita. Your figure can contain more than one plot / facet / panel. Interpret in detail the relationships that you see in the plots. Make sure that the labels and the title are interpretable.

Italian Restaurants in NYC

Read in the dataset: http :// vicpena . github . io / sta 9750/ spring 19/ nyc . csv

The variables are:

  • Case: case-indexing variable
  • Restaurant: name of the restaurant
  • Price: average price of a meal and a drink per person
  • Food: average Zagat rating of the quality of the food (from 0 to 25)
  • Decor: same as above, but with quality of the decor
  • Service: same as above, but with quality of service
  • East: it is equal to 1 if the restaurant is on the East Side (i.e. east of Fifth Ave)

Answer the following questions:

  1. Create a figure that contains plots for all the pairs of variables in the dataset, except Case (i.e., a figure that contains plots for Restaurant vs Price, Food vs Price, Decor vs Service, etc.). Describe what you see in the plots. What are the strongest and weakest relationships you see?
  2. Provide a heatmap for the correlation between the numerical variables in the dataset. What can you see?
  3. Find 2 examples of cheap restaurants that have relatively good food and 2 examples of expensive restaurants that have relatively bad food.
  4. Suppose you’re going on a date and want to use the information in this dataset to pick where to go. Assume your budget is at most $40. Assuming that you can get a table anywhere you want, where would you go and why?
  5. Create a figure that displays the relationship between price, food, decor, service, and the East / West indicator. Your figure can contain more than one plot / facet / panel. Make sure that the labels and the title are interpretable. Interpret in detail the relationships that you see.

Interfaith dating data

Consider the interfaith dating dataset

Description: http :// users . stat . ufl . edu /~ winner / data / interfaith . txt

Data: http :// users . stat . ufl . edu /~ winner / data / interfaith . dat

Create a figure that shows the relationship between socioeconomic class, religion, gender, and the indicator of interfaith dating . Your figure can contain more than one plot / facet / panel. Interpret in detail the relationships that you see in the plots. Make sure that the labels and the title are interpretable.