IEOR 142A: Machine Learning and Data Analytics I, Fall 2024
Homework Assignment #2
Due October 9th, 2024 at 11:59pm Pacific time
IMPORTANT NOTE: As indicated in the slides of Lecture 1 (pgs. 36-38) and the syllabus (pgs. 6-8), please list any resources outside of the course materials that you find helpful in completing the assignment (e.g. peers you discuss with, materials from different classes, blog posts, AI Tools, etc.). Please also be mindful of all policies in the syllabus concerning academic integrity and the use of AI Tools, including that you need to write your own solutions individually.
Problem 1: (10 points) Let Y be a discrete random variable that takes values in the set {−2, −1, 1, 2}. Let θ,τ be two parameters such that 0 ≤ θ ≤ 1, 0 ≤ τ ≤ 1, and the probability distribution of Y is given by the following equations:
P(Y = −2) = (1 − θ)(1 − τ)
P(Y = −1) = θ(1 − τ)
P(Y = 1) = θτ
P(Y = 2) = (1 − θ)τ
(Although it is not required for this problem, you can check that the above equations imply that P(|Y | = 1) = θ and P(sign(Y) = 1) = τ where | · | is the absolute value and sign(·) is the sign function.)
The parameters θ,τ are unknown, but suppose that we are given the following dataset of five observed values that are assumed to be independent and identically distributed (i.i.d.) from the above distribution (given some values of the parameters):
y1 = −1, y2 = −1, y3 = 1, y4 , = 1, y5 = 2
Please answer the following:
a) (5 points) Given the above dataset y1 , . . . , y5 , construct the likelihood function L(θ,τ) and log-likelihood function l(θ,τ) = log(L(θ,τ)).
b) (5 points) Find the maximum likelihood estimators (MLE) of θ and τ by maximizing the log-likelihood function l(θ,τ).
Problem 2: (20 points) Let us consider an extension of the lending decision problem from class. The lender is now deciding between three options: (i) funding the loan with low interest, (ii) funding the loan with high interest, and (iii) not funding the loan. The borrower, if offered the loan, will first decide whether or not to agree to the terms of the loan and accept the offer, and will then eventually either default or not default on the payment. As mentioned in the lecture on Tuesday, September 24, this is an example of a scenario where the “action space” is different from the “label space,” in particular there are 3 possible actions and 2 possible outcomes (labels) for the dependent variable.
The amount of the principal of the loan is still $4000; so if the borrower defaults, then the lender loses $4000. Again, let p denote the probability that the borrower defaults. Assuming that the borrower does not default, the low-interest option would yield a total profit of $1000 for the lender and the high-interest option would yield a total profit of $1500. If the lender chooses the high-interest option, then the borrower will agree to the terms of the loan with probability q (this event happens independently of the defaulting event). If the lender chooses the low-interest option, then the borrower is guaranteed to agree to the terms of the loan.
Please answer the following questions.
a) (5 points) Create a decision tree diagram to model the previously described scenario. Use squares to denote decision nodes and circles to denote chance nodes representing random events. Each terminal node of the tree should have a corresponding profit value.
b) (5 points) Derive formulas for the expected profit under each of the three possible decisions for the lender: (i) fund with low interest, (ii) fund with high interest, and (iii) do not fund. Your formulas should depend on the probabilities p and q.
c) (5 points) Suppose that q = 1/2. Segment the range of possible values of p, i.e., the interval [0, 1] into three subintervals corresponding to ranges of values where each of the three options are optimal decisions in order to maximize expected profit. Create a graph to visually display your answer.
d) (5 points) Briefly discuss how one might estimate the probabilities p and q in practice, in a personalized way depending on features associated with the borrower. Your discussion should include what type of dataset(s) would need to be collected and what model(s) you would fit.
Problem 3: Framingham Heart Study (Adapted from Bertsimas Chapter 7) (70 points)
Heart disease is one of the leading causes of death worldwide. Over 8 million people died from coronary heart disease (CHD) in 2019, which was the leading cause of death that year.
In the late 1940s, the U.S. government took steps to study cardiovascular disease. In order to develop high quality data for their study, they decided to track a large cohort of initially-healthy people over time. The town of Framingham, Massachusetts (a suburb of Boston) was selected as the site for the study, which commenced in 1948. The study enrolled 5,209 participants aged 30-62. Participants were given a questionnaire and a medical exam every two years. They also collected data on the participants’ physical characteristics and behavioral characteristics, in addition to the medical test data. Over the years, the study has expanded to include multiple generations and has collected many more factors including genetic information. This data is now famously known and is simply called the Framingham Heart Study.
In this exercise, you are asked to build models using Framingham Heart Study data in order to predict CHD and to make recommendations to better prevent heart disease. There are 3,658 total observations in our data, with each observation representing the data from a particular study participant. There are 16 variables in the dataset, which are described in Table 1. You will be asked to predict TenYearCHD (whether the patient experiences coronary heart disease within 10 years of their first examination). As a consequence of your modeling efforts, you should be able to identify risk factors, which are the variables that increase the risk of CHD.
a) (40 points) To lower the risk of CHD, physicians can prescribe preventive medication such as blood-pressure-lowering or cholesterol-lowering medications. Many policy makers, when recommending certain preventive medications to patients at risk of developing CHD, rely on evidence-based analysis that weighs the pros and cons of such interventions. Health economic evaluation is a commonly applied methodology for decision-making that takes both medical costs and health benefits (a monetized version of improved life longevity) into consideration. In fact, many countries establish clinical practice guidelines using such formalized health economic evaluation methodologies (the National Institute for Health and Clinical Excellence in England, for example).
As prior work, let us suppose that a colleague of yours has completed a health economics study analyzing the costs and benefits of a recently approved medication aimed at preventing CHD. The colleague determined that patients who experience CHD within the next 10 years are expected to incur a lifetime cost of $950,000 associated with the disease; this cost includes both the costs of treatment for CHD, $350,000, as well as a cost intended to capture the decreased quality and length of life experienced by patients with CHD, which is $600,000. Also, your colleague has determined that patients who take the preventative medicine being studied will have their probability of developing CHD within the next 10 years reduced by 85%; in other words, if their current 10-year risk (probability) of developing CHD isp without taking the medication, then their 10-year risk (probability) with the medicine would instead be (0.15 * p). Regardless of whether a patient eventually develops CHD, there is a $150,000 cost associated with taking this recently approved medication. A decision tree capturing your colleague’s analysis is shown in Figure 1 (below).
Using all of the provided independent variables, build a logistic regression model to predict the probability that a patient will experience CHD within the next 10 years. Use dataset
Table 1: Variables in the dataset framingham .csv.
Variable Description
male
|
Is biological sex assigned at birth equal to male
|
age
|
Age (in years) at first examination
|
education
|
Some high school, high school/GED, some college/vocational school, college
|
currentSmoker
|
Is a current smoker
|
cigsPerDay
|
Number of cigarettes per day
|
BPMeds
|
Is on blood pressure medication at time of first examination
|
prevalentStroke
|
Previously had a stroke
|
prevalentHyp
|
Currently hypertensive
|
diabetes
|
Currently has diabetes
|
totChol
|
Total cholesterol (mg/dL)
|
sysBP
|
Systolic blood pressure
|
diaBP
|
Diastolic blood pressure
|
BMI
|
Body Mass Index, weight (kg)/height (m)2
|
heartRate
|
Heart rate (beats/minute)
|
glucose
|
Blood glucose level (mg/dL)
|
TenYearCHD
|
Experienced coronary heart disease within
10 years of first examination
|
framingham train .csv to train your model. This training set has 2560 data points, which are randomly selected from the original framingham .csv dataset (around 70%). Use dataset framingham test .csv to test your model. This test set has the remaining 1098 data points. Please answer the following questions concerning your model:
i) What is the fitted logistic regression model? Do not simply copy the results of your code, but instead state the equation used by the model to make predictions. Use all features from Table 1 to build your model.
ii) What are the most important risk factors for 10-year CHD risk identified by the model? In other words, those variables that appear to have a significant increasing effect on 10-year CHD risk. Pick one of these variables and describe its impact on a patient’s predicted odds of developing CHD in the next 10 years.
Figure 1: Decision tree for prescribing the approved medication to prevent CHD. The leaf nodes represent cost values.
iii) Suppose that you wish to determine the optimal strategy for assigning which new pa- tients receive the medication. Given your colleague’s analysis of the costs and benefits associated with the recently approved treatment, identify a threshold value of p, call it ¯(p), such that it is optimal to prescribe the medication to a patient if and only if their 10-year CHD risk exceeds¯(p).
iv) Describe the test set performance of the logistic regression model, using the threshold identified in part (iii) to separate patients into those who are at high risk for CHD (risk exceeding the threshold ¯(p)) and those who are at low risk for CHD (risk below the threshold¯(p)). State the model’s accuracy, True Positive Rate (TPR), and False Positive Rate (FPR), and briefly describe these three metrics in a way that is accessible to a non-technical audience.
v) If patients are prescribed the medication using the strategy implied by the model, use the test set data to provide an estimate(s) for the expected economic cost per patient. You should first report your estimate assuming that the CHD outcomes in the test set are not affected by the treatment decision. Is this assumption reasonable? You should then adjust your estimate in away that takes into account the fact that the treatment decision impacts a patient’s risk of developing CHD. (Hint: keep in mind that this dataset was collected before the option of prescribing the medication was even considered.)
vi) Consider a simple baseline model that predicts none of the patients are at high risk for CHD and therefore does not recommend treatment for any of the patients. Describe the test set performance of the baseline model in terms of accuracy, TPR, and FPR, as well as expected economic cost per patient.
vii) Use an example to explain how to use the model in a real clinical setting. Suppose a new patient arrives, and the physician accesses the patient’s electronic medical records and retrieves the following about the patient:
Male, age 40, Some high school education, currently a smoker with an av-erage of 2 cigarettes per day . Currently not on blood pressure medication, had a stroke and is hypertensive . No diabetes; total Cholesterol at 180 .
Systolic/diastolic blood pressure at 140/100, BMI at 28, heart rate at 80, glucose level at 100 .
What is the predicted probability that this patient will experience CHD in the next ten years? Based on your calculated ¯(p) threshold from part (iii) from the decision tree, should the physician prescribe the preventive medication for this patient?
b) (15 points) Show the ROC curve for your logistic regression model on the test set and describe how this curve may be helpful to decision-makers looking to further study the medication you have considered so far in this homework as well as other possible medications for preventing CHD. Describe one interesting observation implied by examining the ROC curve. What is the area under the curve (AUC) for your model in the test set?
c) (10 points) Rather than explicitly dictating which patients should receive the medication, let us consider letting patients decide for themselves. Suppose that if a patient has health insurance, the treatment costs for CHD (including the proposed medication) will be covered by their insurance company. However, a patient will still incur an equivalent cost of $600,000 for decreased quality of life if they develop CHD. Disregarding other factors such as side effects of the medication, if there were no insurance co-payment then it should be clear that every patient would always choose to receive the medication because it would cost them nothing and it would lower their risk of CHD. Thus let us consider setting a co-payment value C – the amount that each patient would have to pay in order to receive the medication – in order to provide an incentive for some patients to forego the treatment while others would choose to receive the treatment. What value of C should the insurance company charge as a co-payment for the medication in order that the patients would “self select” in a manner that is consistent with the previously examined “optimal strategy” discussed in part (a) above?
d) (5 points) Are there any aspects of the analysis performed thus far that raise ethical concerns? If so, suggest at least one way that this analysis could be changed to address such concerns.