You are working for a company that developed a new drug which increases HDL cholesterol (the good cholesterol). A variety of dosages were given to participants during a trial, and the increases of HDL...


You are working for a company that developed a new drug which increases HDL cholesterol (the good<br>cholesterol). A variety of dosages were given to participants during a trial, and the increases of HDL cholesterol<br>were measured. This information is summarized in the following plot:<br>Dosage vs Increase<br>80<br>70<br>60<br>50<br>40<br>30<br>20<br>10<br>15<br>x - dosage in mg<br>10<br>20<br>25<br>30<br>Each point (x, y) in the above plot represents a participant who was given a dosage of æ mg and had an HDL<br>increase of y mg/dL. This information is stored in the 2d numpy array trial_data. The r-values are stored in<br>the first row of trial_data (i.e. trial_data[@]) and the y-values are stored in the second row of trial_data (i.e.<br>trial_data[1]).<br>You are now working with a physician to determine the right dosage for one of her patients.<br>1) In order to help your client, first find a vector B =<br>[B1]<br>such that y(x) = B1 + Bza is the least squares line<br>[B2]<br>for the above data. Store the vector B as a 1D-numpy array in beta.<br>2) The physician wants to raise the HDL level by 34 mg/dL. What dosage do you recommend? Save this as<br>dosage.<br>Hint: Recall from lab the various ways to compute least squares solutions. Another function you might find<br>helpful is numpy.linalg.Istsq, though the methods used in lab are sufficient.<br>The setup code gives the following variables:<br>Name<br>Туре<br>Description<br>trial_data<br>numpy array<br>trial data<br>display_regression<br>function<br>helper function to display least squares line<br>y - increase in HDL in mg/dL<br>

Extracted text: You are working for a company that developed a new drug which increases HDL cholesterol (the good cholesterol). A variety of dosages were given to participants during a trial, and the increases of HDL cholesterol were measured. This information is summarized in the following plot: Dosage vs Increase 80 70 60 50 40 30 20 10 15 x - dosage in mg 10 20 25 30 Each point (x, y) in the above plot represents a participant who was given a dosage of æ mg and had an HDL increase of y mg/dL. This information is stored in the 2d numpy array trial_data. The r-values are stored in the first row of trial_data (i.e. trial_data[@]) and the y-values are stored in the second row of trial_data (i.e. trial_data[1]). You are now working with a physician to determine the right dosage for one of her patients. 1) In order to help your client, first find a vector B = [B1] such that y(x) = B1 + Bza is the least squares line [B2] for the above data. Store the vector B as a 1D-numpy array in beta. 2) The physician wants to raise the HDL level by 34 mg/dL. What dosage do you recommend? Save this as dosage. Hint: Recall from lab the various ways to compute least squares solutions. Another function you might find helpful is numpy.linalg.Istsq, though the methods used in lab are sufficient. The setup code gives the following variables: Name Туре Description trial_data numpy array trial data display_regression function helper function to display least squares line y - increase in HDL in mg/dL
Your code snippet should define the following variables:<br>Name<br>Туре<br>Description<br>beta<br>numpy array<br>beta/LSQ line<br>dosage<br>float<br>recommended dosage<br>user_code.py<br>1 import numpy as np<br>import numpy.linalg as la<br>import scipy.linalg as sla<br>import matplotlib.pyplot as plt<br>2<br>3<br>4<br>5<br>6.<br>beta =...<br>7<br>dosage = ...<br>9<br># Uncomment to display least squares line<br>10<br># display_regression(beta)<br>

Extracted text: Your code snippet should define the following variables: Name Туре Description beta numpy array beta/LSQ line dosage float recommended dosage user_code.py 1 import numpy as np import numpy.linalg as la import scipy.linalg as sla import matplotlib.pyplot as plt 2 3 4 5 6. beta =... 7 dosage = ... 9 # Uncomment to display least squares line 10 # display_regression(beta)
Jun 08, 2022
SOLUTION.PDF

Get Answer To This Question

Related Questions & Answers

More Questions »

Submit New Assignment

Copy and Paste Your Assignment Here