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(
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.xlsx ), 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) 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?
(b) 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.
Definitions of the variables:
low: binary, coded as 1=low birth weight baby; 0=normal weight
smoke: binary, coded as 1=history of mother smoking; 0=mother nonsmoker
race: categorical, coded as 1-3: 1=white; 2-=black; 3=other
age: age of mother: 14-45
lwt: weight (lbs) at last menstrual period: 80-250 lbs
ptl: number of false of premature labors: 0-3
ht: binary, coded as 1=history of hypertension; 0 =no hypertension
ui: binary, coded as 1=uterine irritability; 0 no irritability
ftv: number of physician visits in 1st trimester: 0-6
bwt: birth weight in grams: 709 - 4990 gr
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