Answered step by step
Verified Expert Solution
Question
1 Approved Answer
Exercise 2 (18 points) Consider the following data set coming from the MASS package (the data set will appear under the name Wage on the
Exercise 2 (18 points) Consider the following data set coming from the MASS package (the data set will appear under the name "Wage" on the top right hand comer. Make sure you install the MASS package first) # install. packages( "MASS") library (MASS ) data (birthwt ) head (birthwt ) low age Twt race smoke ptl ht LII ftv xintz 85 182 2 0 0 0 1 0 86 0 33 155 3 0 0 0 3 87 20 105 1 0 1 88 0 21 108 1 1 0 IN 89 0 18 107 1 0 O 0 91 21 124 0 0 6 rows | 1-10 of 11 columns Each observation in the data set is a mother for which we observe several variables during pregnancy but is the weight of the baby at birth in grams low is a binary variable equal to 1 if the baby weighs less than 2,500 grams, and 0 otherwise age is the age of the mother ht is a binary variable for a history of hypertension smoke is a binary variable equal to 1 if the mother is a smoker, and 0 otherwise (a.) Compute (and show) the average weight of a baby whose mother is a smoker (call it bwtbar_s) and the average weight of a baby whose mother is not a smoker (call it bwtbar_ns). Compute the difference in these averages weights (call it dhat) and compute the estimated standard deviation of the difference (call it sd_d). Answers to assignment 2 might be useful. (3 points) Answer: # Answer here (b. ) Test the hypothesis that the true difference in average baby weights between smokers and non smokers, d, is equal to 0 against the alternative that it is different from 0 with a significance level of 5%. Show your computations in R and clearly state your decision to reject or not reject. (3 points) Answer: # Answer here (C.) Construct a 95% confidence interval for d. (2 points) Answer: # Answer here(0. ) We are interested in the effect of smoking during pregnancy on the average weight of the baby. In order to answer this question, regress the weight of the baby on the smoking status of the mother. What is the estimated effect of smoking on the weight of the baby? Is the baby of a smoking mother expected to be heavier or lighter than that of a non smoking mother? Show your results and compare with your answer in (a.). (3 points) Answer: # Answer here (e. ) We say that a variable is significant when we reject the hypothesis that the associated coefficient is equal to 0. Test that hypothesis for the variable smoke with a significance level of 5% and conclude whether this variable is significant or not. Show your results. (2 points) (f. ) Construct a 95% confidence interval for the coefficient associated to the variable smoke without any R function (hint: You know the asymptotic distribution of , ). (2 points) Answer: # Answer here (g. ) Create a variable called but_/b that is equal to the weight of the baby in pounds (1 gram = 0.0022 lbs). The variable should be included in the data set (the mutate function from the dplyr package might be useful but you don't have to use it necessarily). Regress the weight in pounds on the smoking status. Compare your estimates with the ones in (d.). What do you notice? (3 points) Answer: # Answer here
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started