Instructions

What should I bring to tutorial on March 23?

Bring your answer to question 2 parts b and c.

First steps to answering these questions.

  • Download this R Notebook directly into RStudio by typing the following code into the RStudio console window.
file_url <- "https://raw.githubusercontent.com/ntaback/UofT_STA130/master/week10/Week10PracticeProblems-student.Rmd"
download.file(url = file_url , destfile = "Week10PracticeProblems-student.Rmd")

Look for the file “Week10PracticeProblems-student.Rmd” under the Files tab then click on it to open.

  • Change the subtitle to “Week 10 Practice Problems Solutions” and change the author to your name and student number.

  • Type your answers below each question. Remember that R code chunks can be inserted directly into the notebook by choosing Insert R from the Insert menu (see Using R Markdown for Class Assignments). In addition, this R Markdown cheatsheet, and reference are great resources as you get started with R Markdown.

Practice Problems

Question 1

[Adapted from Exercise 7.7 in the textbook]
From the text: “The Whickham data set … includes data on age, smoking, and mortality from a one-in-six survey of the electoral roll in Whickham … in the United Kingdom. The survey was conducted in 1972-1974 to study heart disease and thyroid disease. A follow-up on those in the survey was conducted twenty years later. Load the mosaicData package and look at the help file for Whickham to see the definition of the variables.” Note that the data frame includes the data for women only, and we will consider as our population the women in Whickham during the period of the study. The data collected in 1972-74 are referred to as the “baseline” values.

  1. What percentage of the women in the study were smokers at baseline? Is this percentage an estimate of a joint, marginal, or conditional probability?
  2. What percentage of the women in the study had died by the follow-up? Is this percentage an estimate of a joint, marginal, or conditional probability?
  3. What percentage of smokers had died by the follow-up and what percentage of non-smokers had died at the follow-up? Are these percentages estimates of joint, marginal, or conditional probabilities? How would you describe the effect of smoking on survival status?
  4. Collapse the values of age into a new categorical variable with 3 age categories: women between the age of 18 and 44, women who are older than 44 and younger than 65, and women who are 65 and over. Note that this is the age at the time of the first survey. Examine the percentage of smokers and non-smokers who died at follow-up in each age category.
  5. Construct a plot that shows the relationship between survival status and smoking.
  6. Construct a plot that shows the relationship between survival status and smoking for each age group.
  7. Explain why age is a confounding variable.
  8. How do we know these data are from an observational data and not from an experiment?

Question 2

Bring your output for parts b and c of this question to tutorial on Friday, March 23 (either a hardcopy or on your laptop).

In this question we will again consider the Mario Kart eBay data from lecture.

  1. Sellers on eBay have the option to include a stock photo as the illustration of the product for sale. Does this choice affect the selling price? Carry out a regression analysis to:
    1. Estimate the mean selling price (totalPr) for sellers who do and do not use stock photos.
    2. Carry out an hypothesis test to investigate whether the mean selling price is the same for sellers who do and do not use stock photos? What do you conclude? How could you apply a method from earlier in the term to carry out this hypothesis test?
  2. Sellers are rated by buyers on eBay, captured in the variable sellerRate. To simplify our analysis, we will categorize sellers by whether their rating is low, medium or high. Create a new variable called seller_rating that is “low” if sellerRate is less than or equal to 100, “medium” if it is greater than 100 but less than or equal to 5000, and “high” if it is greater than 5000. Carry out a regression analysis to predict totalPr using the new variable seller_rating.

    1. How many indicator variables are in the model?
    2. Which seller rating group is R treating as the baseline category?
    3. What is the estimate from the fitted regression line for the mean totalPr for sellers with low ratings? What is the estimate from the fitted regression line for the mean totalPr for sellers with medium ratings? What is the estimate from the fitted regression line for the mean totalPr for sellers with high ratings?
  3. Now fit an appropriate regression line to examine whether seller_rating has an effect on the relationship between totalPr and duration.

    1. Is there evidence of a difference between sellers with low and high ratings in the relationship between totalPr and duration?
    2. Is there evidence of a difference between sellers with medium and high ratings in the relationship between totalPr and duration?
    3. Is there evidence of a difference between sellers with low and medium ratings in the relationship between totalPr and duration?
    4. Which one of these requires additional information to answer?

Question 3

[Adapted from Introductory Statistics with Randomization and Simulation from OpenIntro]
For each of the following situations, state a possible confounding variable:

  1. Data are measured on countries. There is a positive relationship between the percentage of internet users and life expectancy.
  2. Do sleep disorders lead to bullying in school children? An article in the New York Times called The School Bully is Sleepy states the following:
    “The University of Michigan study collected survey data from parents on each child’s sleep habits and asked both parents and teachers to assess behavioral concerns. About a third of the students studied were identified by parents or teachers as having problems with disruptive behavior or bullying. The researchers found that children who had behavioral issues and those who were identified as bullies were twice as likely to have shown symptoms of sleep disorders.”

R Markdown source