The file reform.csv has a cross-sectional subsample from the German Socio-Economic Panel, which collected data on doctor visits before and after a major health care reform that took place in 1997. The reform increased the copayments for prescription drugs by up to 200% and imposed upper limits on the reimbursement of physicians by the state insurance. The outcome is the number of doctor visits in a three month period. The descriptions of the variables are:
-id:The patient’s ID number
-numvisit: Number of doctor visits in a 3-month period -reform: Before (reform=0) or after (reform=1) the reform -badh: Person is in bad health? (1=yes, 0=no)
-age: Age in years
-educ: Education in years
-loginc: Logarithm of income
- (a) [5 points] Fit a Poisson regression model (with all possible predictors included, other than id) to see whether the reform affected the number of doctor visits. Formulate the model so that the estimated rates are per 1-month of follow-up. Report the rate ratio for the reform variable and interpret.
- (b) [2 points] Calculate and interpret the rate ratio for age.
- (c) [2 points] Estimate the 1-month rate of visits for a 30 year old person before the reform, with 12 years education, in bad health, and with an average income (so that loginc = 7.6989). Be sure to specify the proper units of the rate.
- (d) [1 point] Estimate the 1-year rate for the person from part (c).
- (e) [2 points] Compute the ratio of 1-month visit rates corresponding to a 10 year increase in age, assuming all other variables are held constant.
Question 2
Assume that you have an outcome variable Yi and predictor variable xi for i = 1, …, n, with independent observations. Furthermore, assume that you have the following model:
Yi|xi ∼ Poission(λi)
with
log(λi) = βxi
(b) [5 Points] Assume you want to find the maximum likelihood estimate of β. Derive the Newton-Raphson
(a) [3 Points] Find the log-likelihood l(β|yi). update for β(k+1) given you have β(k).
Question 3
[5 points] Refer to the model in Question 2. Use the optim() function in R to find the maximum-likelihood estimate of β. Test the function using data from reform.csv with numvisit as Yi and age as xi. Don’t use an offset for this part.
Question 4
The file adult data clean.csv contains education, demographic, and in- come information from the US census database as of 1994. The three variables of interest are:
-education: The education level (HS-grad, Bachelors, Masters, Doctorate) -age: The age of the individual
-sex: The sex of the individual
You should run the following code to make sure that HS-grad is the reference category for education, assuming that you read the csv file into a data object called a.data:
a.data$education <- factor(a.data$education) a.data$education <- relevel(a.data$education, ref=“HS-grad”)
(a) [2 Points] Run a multinomial logistic regression model with education as the out- come and age and sex as predictors. Make sure that HS-grad is the reference category for the outcome.
(b) [6 Points] Using odds ratios calculated from the model fit, describe the effects of age and sex on the odds of an individual having a Bachelors, Masters, and Doctorate (each compared to the reference category).







