Question
Please use R to solve the following problems and include the R code in the answers. Thank you! Refer to the low birth weight data(lbw.csv),
Please use R to solve the following problems and include the R code in the answers. Thank you!
Refer to the low birth weight data(lbw.csv), where we used a Poisson regression to model the number of doctor visits (ftv) against the age of the woman. Before, we created factors out of the variables smoke, race, ht, and ui. We will do the same thing here to see which variables might be related to how often a pregnant woman needed to visit a doctor.
1. Fit a model including only the factors for smoking and race, along with the interaction.
(a) Write out the regression model and table of indicators and corresponding log means for each combination of race and smoking.
i) What does the intercept measure?
(b) We ask whether the effect of smoking on doctor visits is the same for all races. This can be answered using a hypothesis test.
i) Write the hypotheses in terms of the regression parameters being tested
ii) Write the hypotheses in terms of the two models being compared.
iii) Report the test statistic and p-value for the test.
iv) What is the answer to the question we asked?
(c) Estimate the mean ratio comparing the number of doctor visits for smokers vs. nonsmokers separately for each race. Report estimates and confidence intervals for each ratio.
2. Fit a model that allows the relationship between age and number of doctor visits to vary depending on whether the woman has high blood pressure ("hypertension", represented by the ht binary variable). Treat the ht variable as a factor with where the first represents a history of hypertension and the second represents no history.
(a) Report the summary from the model fit. Based on the parameter estimates, are mean ratios for number of doctor visits with vs. without hypertension increasing or decreasing with age? Explain.
(b) Test whether the age-visits relationship is different for women with or without hypertension.
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