{"id":1265,"date":"2021-07-03T11:32:49","date_gmt":"2021-07-03T15:32:49","guid":{"rendered":"https:\/\/openbooks.macewan.ca\/rcommander\/?post_type=chapter&#038;p=1265"},"modified":"2024-02-08T14:48:28","modified_gmt":"2024-02-08T19:48:28","slug":"13-3-prediction-and-extrapolation","status":"publish","type":"chapter","link":"https:\/\/openbooks.macewan.ca\/introstats\/chapter\/13-3-prediction-and-extrapolation\/","title":{"raw":"13.3 Prediction and Extrapolation","rendered":"13.3 Prediction and Extrapolation"},"content":{"raw":"We can use the least-squares regression line [latex]\\hat{y} = b_0 + b_1 x[\/latex] to predict the value of the response variable [latex]y[\/latex] given the value of the predictor variable [latex]x[\/latex]. For example, using the least-squares straight line from the previous exercise, the predicted price of a car that is 2 years old (age=2) is: [latex]\\widehat{\\mathrm{price}} = 14.118 - 0.9432 \\times 2 = 12.2316[\/latex] ($1,000, see figure below), or $12,231.6. The predicted price for a 10-year-old car is: [latex]\\widehat{\\text{price}} = 14.118 - 0.9432 \\times 10 = 4.686[\/latex] ($1,000, see figure below), which means the price of a 10-year-old car is predicted as $4,686.\r\n\r\nWhen making a prediction, avoid <strong>extrapolation<\/strong>, in which [latex]y[\/latex]-values are predicted using [latex]x[\/latex]-values that are outside of the range of the observed [latex]x[\/latex]-values. For example, if we use the least-squares regression line [latex]\\widehat{\\text{price}} = 14.118 - 0.9432 \\times \\text{age}[\/latex] to predict the price of a 20-year-old car, our estimated price is [latex]\\widehat{\\text{price}} = 14.118 - 0.9432 \\times 20 = -4.746[\/latex] ($1,000, see figure below). It does not make sense for an individual to pay $4,746 if he\/she wants to sell a 20-year-old car; this is the consequence of extrapolation. This regression line was developed with used cars between 1 and 13 years old; age=20 is outside this range, and we should not use the fitted least-squares line to predict the price of a 20-year-old car. Another example of extrapolation is to predict the height of an adult based on their weight using a regression line (regress height on weight) fitted on the data of children under 10 years old.<a id=\"retfig13.4\"><\/a>\r\n\r\n[caption id=\"attachment_2924\" align=\"aligncenter\" width=\"480\"]<img class=\"wp-image-2924 size-full\" src=\"https:\/\/openbooks.macewan.ca\/introstats\/wp-content\/uploads\/sites\/8\/2021\/07\/regression_predict.png\" alt=\"Demonstration of using the regression line to predict the price of a car given age. Image description available.\" width=\"480\" height=\"480\" \/> <strong>Figure 13.4<\/strong>: Prediction for Age=2, 10, 20 and Extrapolation. [<a href=\"https:\/\/openbooks.macewan.ca\/introstats\/back-matter\/image-description\/#fig13.4\">Image Description (See Appendix D Figure 13.4)<\/a>][\/caption]","rendered":"<p>We can use the least-squares regression line [latex]\\hat{y} = b_0 + b_1 x[\/latex] to predict the value of the response variable [latex]y[\/latex] given the value of the predictor variable [latex]x[\/latex]. For example, using the least-squares straight line from the previous exercise, the predicted price of a car that is 2 years old (age=2) is: [latex]\\widehat{\\mathrm{price}} = 14.118 - 0.9432 \\times 2 = 12.2316[\/latex] ($1,000, see figure below), or $12,231.6. The predicted price for a 10-year-old car is: [latex]\\widehat{\\text{price}} = 14.118 - 0.9432 \\times 10 = 4.686[\/latex] ($1,000, see figure below), which means the price of a 10-year-old car is predicted as $4,686.<\/p>\n<p>When making a prediction, avoid <strong>extrapolation<\/strong>, in which [latex]y[\/latex]-values are predicted using [latex]x[\/latex]-values that are outside of the range of the observed [latex]x[\/latex]-values. For example, if we use the least-squares regression line [latex]\\widehat{\\text{price}} = 14.118 - 0.9432 \\times \\text{age}[\/latex] to predict the price of a 20-year-old car, our estimated price is [latex]\\widehat{\\text{price}} = 14.118 - 0.9432 \\times 20 = -4.746[\/latex] ($1,000, see figure below). It does not make sense for an individual to pay $4,746 if he\/she wants to sell a 20-year-old car; this is the consequence of extrapolation. This regression line was developed with used cars between 1 and 13 years old; age=20 is outside this range, and we should not use the fitted least-squares line to predict the price of a 20-year-old car. Another example of extrapolation is to predict the height of an adult based on their weight using a regression line (regress height on weight) fitted on the data of children under 10 years old.<a id=\"retfig13.4\"><\/a><\/p>\n<figure id=\"attachment_2924\" aria-describedby=\"caption-attachment-2924\" style=\"width: 480px\" class=\"wp-caption aligncenter\"><img loading=\"lazy\" decoding=\"async\" class=\"wp-image-2924 size-full\" src=\"https:\/\/openbooks.macewan.ca\/introstats\/wp-content\/uploads\/sites\/8\/2021\/07\/regression_predict.png\" alt=\"Demonstration of using the regression line to predict the price of a car given age. Image description available.\" width=\"480\" height=\"480\" srcset=\"https:\/\/openbooks.macewan.ca\/introstats\/wp-content\/uploads\/sites\/8\/2021\/07\/regression_predict.png 480w, https:\/\/openbooks.macewan.ca\/introstats\/wp-content\/uploads\/sites\/8\/2021\/07\/regression_predict-300x300.png 300w, https:\/\/openbooks.macewan.ca\/introstats\/wp-content\/uploads\/sites\/8\/2021\/07\/regression_predict-150x150.png 150w, https:\/\/openbooks.macewan.ca\/introstats\/wp-content\/uploads\/sites\/8\/2021\/07\/regression_predict-65x65.png 65w, https:\/\/openbooks.macewan.ca\/introstats\/wp-content\/uploads\/sites\/8\/2021\/07\/regression_predict-225x225.png 225w, https:\/\/openbooks.macewan.ca\/introstats\/wp-content\/uploads\/sites\/8\/2021\/07\/regression_predict-350x350.png 350w\" sizes=\"auto, (max-width: 480px) 100vw, 480px\" \/><figcaption id=\"caption-attachment-2924\" class=\"wp-caption-text\"><strong>Figure 13.4<\/strong>: Prediction for Age=2, 10, 20 and Extrapolation. [<a href=\"https:\/\/openbooks.macewan.ca\/introstats\/back-matter\/image-description\/#fig13.4\">Image Description (See Appendix D Figure 13.4)<\/a>]<\/figcaption><\/figure>\n","protected":false},"author":19,"menu_order":3,"template":"","meta":{"pb_show_title":"on","pb_short_title":"","pb_subtitle":"","pb_authors":[],"pb_section_license":""},"chapter-type":[],"contributor":[],"license":[],"class_list":["post-1265","chapter","type-chapter","status-publish","hentry"],"part":1246,"_links":{"self":[{"href":"https:\/\/openbooks.macewan.ca\/introstats\/wp-json\/pressbooks\/v2\/chapters\/1265","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/openbooks.macewan.ca\/introstats\/wp-json\/pressbooks\/v2\/chapters"}],"about":[{"href":"https:\/\/openbooks.macewan.ca\/introstats\/wp-json\/wp\/v2\/types\/chapter"}],"author":[{"embeddable":true,"href":"https:\/\/openbooks.macewan.ca\/introstats\/wp-json\/wp\/v2\/users\/19"}],"version-history":[{"count":14,"href":"https:\/\/openbooks.macewan.ca\/introstats\/wp-json\/pressbooks\/v2\/chapters\/1265\/revisions"}],"predecessor-version":[{"id":4919,"href":"https:\/\/openbooks.macewan.ca\/introstats\/wp-json\/pressbooks\/v2\/chapters\/1265\/revisions\/4919"}],"part":[{"href":"https:\/\/openbooks.macewan.ca\/introstats\/wp-json\/pressbooks\/v2\/parts\/1246"}],"metadata":[{"href":"https:\/\/openbooks.macewan.ca\/introstats\/wp-json\/pressbooks\/v2\/chapters\/1265\/metadata\/"}],"wp:attachment":[{"href":"https:\/\/openbooks.macewan.ca\/introstats\/wp-json\/wp\/v2\/media?parent=1265"}],"wp:term":[{"taxonomy":"chapter-type","embeddable":true,"href":"https:\/\/openbooks.macewan.ca\/introstats\/wp-json\/pressbooks\/v2\/chapter-type?post=1265"},{"taxonomy":"contributor","embeddable":true,"href":"https:\/\/openbooks.macewan.ca\/introstats\/wp-json\/wp\/v2\/contributor?post=1265"},{"taxonomy":"license","embeddable":true,"href":"https:\/\/openbooks.macewan.ca\/introstats\/wp-json\/wp\/v2\/license?post=1265"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}