hw05b_blank

.pdf

School

Santa Barbara City College *

*We aren’t endorsed by this school

Course

W54

Subject

Computer Science

Date

Oct 30, 2023

Type

pdf

Pages

14

Uploaded by sarkarved

Report
Data 100, Fall 2023 Homework #5B Total Points: 24 Submission Instructions You must submit this assignment to Gradescope by the on-time deadline, Thursday, Oc- tober 5th at 11:59 PM Pacific . Please read the syllabus for the grace period policy . No late submissions beyond the grace period will be accepted. While course sta ff is happy to help you if you encounter di culties with submission, we may not be able to respond to last-minute requests for assistance (TAs need to sleep, after all!). We strongly encourage you to plan to submit your work to Gradescope several hours before the stated deadline. This way, you will have ample time to reach out to sta ff for submission support. There are two parts to this assignment listed on Gradescope: Homework 05 Coding : Submit your Jupyter notebook zip file for Homework 5A, which can be generated and downloaded from DataHub by using the grader.export() cell provided. Homework 05 Written : Submit a single PDF to Gradescope that contains both (1) your answers to all manually graded questions from the Homework 5A Jupyter Notebook and (2) your answers to all questions in this Homework 5B document. To receive credit on this assignment, you must submit both your coding and written portions to their respective Gradescope portals . Your written submission (a single PDF) can be generated as follows: 1. Access your answers to manually graded Homework 5A questions in one of three ways: Automatically create PDF (recommended) : We have provided a cell to generate your written response in the Homework 5A notebook for you. Run the cell and click to download the generated PDF. This function will extract your response to the manually-graded questions and put them on separate pages. This process may fail if your answer is not properly formatted; if this is the case, check out common errors and solutions described on Ed or follow either of the two ways described below. 1
Homework #5B 2 Manually download PDF : If there are issues with automatically generating the PDF, on DataHub, you can try downloading the PDF by clicking on File-> SaveandExportNotebookAs...->PDF . If you choose to go this route, you must take special care to ensure all appropriate pages are chosen for each question on Gradescope. Take screenshots : If that doesn’t work either, you can take screenshots of your answers (and your code if present) to manually-graded questions and include them as images in a PDF. The manually-graded questions are listed at the top of the Homework 5A notebook. 2. Answer the below Homework 5B written questions in one of many ways: You can type your answers. We recommend LaTeX, the math typesetting lan- guage. Overleaf is a great tool to type in LaTeX. Download this PDF, print it out, and write directly on these pages. If you have a tablet, you may save this PDF and write directly on it. Write your answers on a blank sheet of physical or digital paper. Note: If you write your answers on physical paper, use a scanning application (e.g., CamScanner, Apple Notes) to generate a PDF. 3. Combine these two sets of answers together into one PDF document and submit it to the appropriate Gradescope written portal. You can use PDF merging tools, e.g., Adobe Reader, Smallpdf ( https://smallpdf.com/merge-pdf ) or Apple Preview ( https://support.apple.com/en-us/HT202945 ). 4. Important : When submitting on Gradescope, you must tag pages to each ques- tion correctly (it prompts you to do this after submitting your work). This signifi- cantly streamlines the grading process for our readers. Failure to do this may result in a score of 0 for untagged questions. You are responsible for ensuring your submission follows our requirements. We will not be granting regrade requests nor extensions to submissions that don’t follow instructions. If you encounter any di culties with submission, please don’t hesitate to reach out to sta ff prior to the deadline. Collaborators Data science is a collaborative activity. While you may talk with others about the homework, we ask that you write your solutions individually. If you do discuss the assignments with others, please include their names at the top of your submission.
Homework #5B 3 Properties of Linear Regression Residuals 1. (10 points) In the lecture, we spent a great deal of time talking about Simple Linear Regression (SLR), which you also saw in Data 8. To briefly summarize, the simple linear regression model assumes that given a single observation x , our predicted response for this observation is ˆ y = 0 + 1 x . In Lecture 10, we saw that the 0 = ˆ 0 and 1 = ˆ 1 that minimize the average L 2 loss (or Mean Squared Error - MSE) for the simple linear regression model are: ˆ 0 = ¯ y - ˆ 1 ¯ x ˆ 1 = r σ y σ x Or, rearranging terms, our predictions ˆ y are: ˆ y = ¯ y + r σ y x - ¯ x σ x (a) (3 points) As we saw in the lecture, a residual e i , for data point i 2 { 1 , . . . , n } , is defined to be the di ff erence between a true response y i and predicted response ˆ y i . Specifically, e i = y i - ˆ y i . Note that there are n data points, and each data point is denoted by ( x i , y i ) . Prove, using the equation for ˆ y above, that P n i =1 e i = 0. (b) (2 points) Prove that ¯ y = ¯ ˆ y . You may use your result from part (a). (c) (2 points) Show that x, ¯ y ) is on the simple linear regression line. e is Yi g t r y EE es si mi no Ein EI g i ng ng ng o g i s g tr EE ai z g s g tag Ii É I get EE o g d a n n s z E E of a g s g d a toss y s y
Homework #5B 4 (d) (3 points) Show that the residuals are uncorrelated with the predictor variable, that is 1 n n X i =1 e i - ¯ e σ e ◆ ✓ x i - ¯ x σ x = 0 , where ¯ e = 1 n P n i =1 e i , σ 2 e = 1 n P n i =1 ( e i - ¯ e ) 2 , and σ 2 x = 1 n P n i =1 ( x i - ¯ x ) 2 . You may assume that σ e , σ x , and at least one residual are not exactly zero. Use the properties of estimating equations derived in the lecture. É e i o é o e I a i residuals are uncorrelated with the meditor variable
Homework #5B 5 Properties of a Linear Model With No Constant Term 2. (4 points) Suppose that we don’t include an intercept term in our model. That is, our model is now ˆ y = x, where is the single parameter for our model that we need to optimize. (In this equation, x is a scalar, corresponding to a single observation.) As usual, we are looking to find the value ˆ that minimizes the average L 2 loss (MSE) across our observed data { ( x i , y i ) } , for i 2 { 1 , . . . , n } : R ( ) = 1 n n X i =1 ( y i - x i ) 2 The estimating equations derived in the lecture no longer hold. In this problem, we’ll derive a solution to this simpler model. We’ll see that the least squares estimate of the slope in this model di ff ers from the simple linear regression model, and we’ll also explore whether or not our properties from the previous problem still hold. Use calculus to find the minimizing ˆ . That is, you may prove that: ˆ = P x i y i P x 2 i Hint: You may start by following the format of SLR in lecture 10 and replace the SLR model with the model defined above. dy s nt Es 2 ni ly on Es mi y 0 a i G E ni g É Mi
Your preview ends here
Eager to read complete document? Join bartleby learn and gain access to the full version
  • Access to all documents
  • Unlimited textbook solutions
  • 24/7 expert homework help

Browse Popular Homework Q&A

Q: I1 -27 0+2 12 -5 2 + 3 -12 -4
Q: As a person moves about in a dry environment, electric charge accumulates on the person’s body.…
Q: 47 32° 101 Classify the triangle by its sides and angles. O A) Right scalene triangle B) Obtuse…
Q: Let f(x) = The slope of the tangent line to the graph of f(x) at 33 - the point (8, 5) is The…
Q: Show that the square of an average is less than or equal to the average of the squares. More…
Q: Consider the reaction, HQ = H+(aq) + Q¯(aq). At 350.0 K, the AS°rxn = -81.0 J/mol K and the AH°rxn =…
Q: $350 billion. Under the Miller model, what is Cruz's value if the federal-plus- state corporate tax…
Q: If f(x) = 23x + 27, find f'(5).
Q: 5. The linear function P(x) = 8.7z+0.6 models the number of participants in a fund-raising event for…
Q: Calculate the pH when 60.0 mL of 0.200 M HBr is mixed with 30.0 mL of 0.400 M CH₃NH₂ (Kb = 4.4 ×…
Q: Analysis of daily output of a factory during a 8-hour shift shows that the hourly number of units y…
Q: Which of the following statements regarding unsystematic risk is accurate
Q: How is validity realized in qualitative research?
Q: a bond that does not pay coupons use semi-annual periods to be consistent / compare to others par =…
Q: I tried to run this program and it came up with this error do you know why?
Q: a description of the set D={3,6,9,12,15,18,...}
Q: A function f: R → R has a third order continuous derivative. Show that f(a) f'(a). f"(a). f"" (a) ≥…
Q: What are the vertices of the following equation? Approximate your answer to the nearest hundredth if…
Q: 4. An important question to consider when thinking about global warming is, "If the ice sheets near…
Q: The specific heat of copper is 0.093 cal/(g.°C) and the specific heat of gold is 0.031 cal/(g.°C).…
Q: O Find the equation of an ellipse in standard form with the following conditions: Major axis…
Q: What are five goals of infectious disease control?