Assignment 1

  1. A1a

    Part A, Q1: Interpreting R output (hours worked vs education). The variable monthly_hrs_wrk measures the number of hours worked in a month. Using the command cor, what can we learn from the R output about the relationship between hours worked and education? The output reports

    cor⁡(hours, schooling)=−0.046\operatorname{cor}(\text{hours},\,\text{schooling}) = -0.046
  2. A1b

    Why do we set the argument use = "complete.obs" in the function cor?

  3. A2a

    Part A, Q2. You use the command lm in R to estimate the linear regression of hours worked on education. The estimated model is

    monthly_hrs_wrk^=184.4−0.859⋅schooly\widehat{\text{monthly\_hrs\_wrk}} = 184.4 - 0.859 \cdot \text{schooly}

    a. Interpret the intercept from the estimated model above.

  4. A2b

    b. Based on the estimates above, what is the predicted number of monthly hours worked for an individual with 12 years of education? What about an individual with 16?

  5. A2c

    c. What can we say about the relation between years of study and hours worked? Is the relation positive or negative? Is it strong or weak?

  6. A2d

    d. Can we make a causal claim for these results? Explain.

  7. A2e

    e. What other variables are likely to influence the monthly hours worked? Indicate at least 3.

  8. B1

    Part B, Q1: Data exploration [Heiss 1.6.4]. The BWGHT2 data come from a project that looked at the effect of smoking during pregnancy on newborn weight (1,465 births; key variables bwght birth weight in grams, cigs average cigarettes per day, monpre month prenatal care began).

    a. Import the dataset and name the data.frame object data.BW.

    b. Create a new variable called non.smoker indicating (TRUE) if a mother is a non-smoker.

    c. What is the proportion of smokers in the sample? (hint: do not include the NA observations in your calculations)

  9. B2

    Part B, Q2: Ordinal factor variables [Heiss 1.6.1].

    a. Create a frequency table of the variable monpre, the month prenatal care begins (hint: use prop.table).

    b. What is the median month that prenatal care begins in the sample?

  10. B3

    Part B, Q3: Statistical dependence.

    a. What is the average daily number of cigarettes smoked during pregnancy in the entire sample?

    b. What is the average daily number of cigarettes smoked during pregnancy among women who are smokers?

    c. Compare the results from 3(a) and 3(b). Which average, if any, is a good measure for typical smoking behavior during pregnancy? Explain.

  11. B4a

    Part B, Q4: OLS regression [Heiss 2.1, 2.2].

    a. Run the regression between birth weight (the dependent variable) and the number of cigarettes smoked by the mother during pregnancy (the independent variable). Report the estimation results in the form of an equation.

  12. B4b

    b. Is it possible to apply a causal interpretation to these results?

  13. B4c

    c. What is the predicted birthweight for mothers who do not smoke? What is the predicted birthweight for mothers who smoke a pack of cigarettes a day? (assume there are 30 cigarettes per pack)

  14. B4d

    d. What value does cigs have to be in order to predict a birth weight of 3.4 kg?

  15. B4e

    e. A woman smokes 20 cigarettes a day and has a newborn weighing 3.2 kg. What is the residual for this woman?

  16. B5

    Part B, Q5: Scatter plots [Heiss 1.4.1 to 1.4.5, 2.1]. Create a scatterplot of birthweight (y-axis) versus number of cigarettes smoked (x-axis) with: descriptive X and Y axis labels (what is plotted and in what units), a title, appropriate scales for the axes, and a dashed line for the OLS regression from lm.bwght.cigs (hint: in base plot you can use abline).

Solutions are Alfie's submitted work, not an official key.

Part A reasons from pre-computed R output (hours worked on years of schooling); Part B uses the BWGHT2 birthweight and smoking data. Three habits are drilled: correlation is not slope, a regression gives predictions and residuals by plugging in, and a simple regression on observational data is never causal.

Related: Lec_08-Goodness of Fit & Multicollinearity (why the wide scatter means a low R2R^2)