{"id":7658,"date":"2021-03-30T10:11:54","date_gmt":"2021-03-30T10:11:54","guid":{"rendered":"https:\/\/prwatech.in\/blog\/?p=7658"},"modified":"2024-03-30T11:18:13","modified_gmt":"2024-03-30T11:18:13","slug":"linear-regression","status":"publish","type":"post","link":"https:\/\/prwatech.in\/blog\/statistics\/linear-regression\/","title":{"rendered":"Linear Regression"},"content":{"rendered":"\r\n<h2><span data-sheets-root=\"1\" data-sheets-value=\"{&quot;1&quot;:2,&quot;2&quot;:&quot;&lt;yoastmark class=\">Linear Regression in Machine Learning<\/span><\/h2>\r\n<p>&nbsp;<\/p>\r\n<p>A linear equation with one <a href=\"https:\/\/en.wikipedia.org\/wiki\/Statistics\">independent<\/a> variable is used in <a href=\"https:\/\/prwatech.in\/blog\/\">linear<\/a> regression with two variables. The equation is written as y=a+bx, where a and b are both constants.<\/p>\r\n\r\n\r\n\r\n<p>The independent variable is x, while the dependent variable is y. In most instances, you substitute a value for the independent variable before solving for the dependent variable.<\/p>\r\n\r\n\r\n\r\n<p>Linear equations are used in the following cases.<\/p>\r\n\r\n\r\n\r\n<p>y=3+2x y=\u20130.01+1.2x y=\u20130.01+1.2x<\/p>\r\n\r\n\r\n\r\n<figure class=\"wp-block-image size-large\"><img loading=\"lazy\" decoding=\"async\" width=\"492\" height=\"306\" class=\"wp-image-7661\" src=\"https:\/\/prwatech.in\/blog\/wp-content\/uploads\/2021\/03\/image-242.png\" alt=\"\" srcset=\"https:\/\/prwatech.in\/blog\/wp-content\/uploads\/2021\/03\/image-242.png 492w, https:\/\/prwatech.in\/blog\/wp-content\/uploads\/2021\/03\/image-242-300x187.png 300w\" sizes=\"auto, (max-width: 492px) 100vw, 492px\" \/><\/figure>\r\n\r\n\r\n\r\n<p><em>Learning Objectives<\/em><\/p>\r\n\r\n\r\n\r\n<p>1. Explain what linear regression is.<\/p>\r\n\r\n\r\n\r\n<p>2. Use a regression line to identify errors of estimation in a scatter plot.<\/p>\r\n\r\n\r\n\r\n<p>We predict scores on one variable from scores on a second variable in simple linear regression. The criterion variable, also known as Y, is the variable we&#8217;re trying to forecast. The variable on which our forecasts are based is known as the predictor variable and is abbreviated as X. Easy regression is the prediction approach used where there is only one predictor variable. When the predictions of Y are plotted as a function of X in simple linear regression, which is the subject of this section, they form a straight line.<\/p>\r\n\r\n\r\n\r\n<p>Figure 1 depicts the example data from Table 1. There is a good relationship between X and Y, as you can see. If you were to predict Y based on X, the higher the value of X, the more accurate your prediction of Y would be.<\/p>\r\n\r\n\r\n\r\n<p>Table 1. Example data.<\/p>\r\n\r\n\r\n\r\n<figure class=\"wp-block-table\">\r\n<table>\r\n<tbody>\r\n<tr>\r\n<td><strong>X<\/strong><\/td>\r\n<td><strong>Y<\/strong><\/td>\r\n<\/tr>\r\n<tr>\r\n<td>1.00<\/td>\r\n<td>1.00<\/td>\r\n<\/tr>\r\n<tr>\r\n<td>2.00<\/td>\r\n<td>2.00<\/td>\r\n<\/tr>\r\n<tr>\r\n<td>3.00<\/td>\r\n<td>1.30<\/td>\r\n<\/tr>\r\n<tr>\r\n<td>4.00<\/td>\r\n<td>3.75<\/td>\r\n<\/tr>\r\n<tr>\r\n<td>5.00<\/td>\r\n<td>2.25<\/td>\r\n<\/tr>\r\n<\/tbody>\r\n<\/table>\r\n<\/figure>\r\n\r\n\r\n\r\n<figure class=\"wp-block-image size-large\"><img loading=\"lazy\" decoding=\"async\" width=\"360\" height=\"404\" class=\"wp-image-7662\" src=\"https:\/\/prwatech.in\/blog\/wp-content\/uploads\/2021\/03\/image-243.png\" alt=\"\" srcset=\"https:\/\/prwatech.in\/blog\/wp-content\/uploads\/2021\/03\/image-243.png 360w, https:\/\/prwatech.in\/blog\/wp-content\/uploads\/2021\/03\/image-243-267x300.png 267w\" sizes=\"auto, (max-width: 360px) 100vw, 360px\" \/><\/figure>\r\n\r\n\r\n\r\n<h3>Figure 1. The example data in a scatter plot.<\/h3>\r\n\r\n\r\n\r\n<p>Finding the best-fitting straight line through the points is the objective of linear regression. A regression line is the best-fitting line. The regression line in Figure 2 is the black diagonal line that contains the expected Y score for each possible value of X. The errors of prediction are represent by the vertical lines connecting the points to the regression line. . The yellow point, on the other hand, is far higher than the regression line, and thus has a significant prediction<\/p>\r\n\r\n\r\n\r\n<figure class=\"wp-block-image size-large\"><img loading=\"lazy\" decoding=\"async\" width=\"376\" height=\"404\" class=\"wp-image-7663\" src=\"https:\/\/prwatech.in\/blog\/wp-content\/uploads\/2021\/03\/image-244.png\" alt=\"\" srcset=\"https:\/\/prwatech.in\/blog\/wp-content\/uploads\/2021\/03\/image-244.png 376w, https:\/\/prwatech.in\/blog\/wp-content\/uploads\/2021\/03\/image-244-279x300.png 279w\" sizes=\"auto, (max-width: 376px) 100vw, 376px\" \/><\/figure>\r\n\r\n\r\n\r\n<p>Figure 2. The example data in a scatter plot. The predictions are represented by the black line, the points by the actual data, and the vertical lines between the points and the black line by the prediction errors.<\/p>\r\n\r\n\r\n\r\n<p>The value of the point minus the expected value is the prediction error for a point (the value on the line). Table 2 displays the forecast values (Y&#8217;) as well as the prediction errors (Y-Y&#8217;). The first point, for example, has a Y of 1.00 and a projected Y (referred to as Y&#8217;) of 1.21. As a result, its prediction error is -0.21.<\/p>\r\n\r\n\r\n\r\n<h3>Table 2. Example data.<\/h3>\r\n\r\n\r\n\r\n<figure class=\"wp-block-table\">\r\n<table>\r\n<tbody>\r\n<tr>\r\n<td>X<\/td>\r\n<td>Y<\/td>\r\n<td>Y&#8217;<\/td>\r\n<td>Y-Y&#8217;<\/td>\r\n<td>(Y-Y&#8217;)<sup>2<\/sup><\/td>\r\n<\/tr>\r\n<tr>\r\n<td><strong>1.00<\/strong><\/td>\r\n<td>1.00<\/td>\r\n<td>1.210<\/td>\r\n<td>-0.210<\/td>\r\n<td>0.044<\/td>\r\n<\/tr>\r\n<tr>\r\n<td><strong>2.00<\/strong><\/td>\r\n<td>2.00<\/td>\r\n<td>1.635<\/td>\r\n<td>0.365<\/td>\r\n<td>0.133<\/td>\r\n<\/tr>\r\n<tr>\r\n<td><strong>3.00<\/strong><\/td>\r\n<td>1.30<\/td>\r\n<td>2.060<\/td>\r\n<td>-0.760<\/td>\r\n<td>0.578<\/td>\r\n<\/tr>\r\n<tr>\r\n<td><strong>4.00<\/strong><\/td>\r\n<td>3.75<\/td>\r\n<td>2.485<\/td>\r\n<td>1.265<\/td>\r\n<td>1.600<\/td>\r\n<\/tr>\r\n<tr>\r\n<td><strong>5.00<\/strong><\/td>\r\n<td>2.25<\/td>\r\n<td>2.910<\/td>\r\n<td>-0.660<\/td>\r\n<td>0.436<\/td>\r\n<\/tr>\r\n<\/tbody>\r\n<\/table>\r\n<\/figure>\r\n\r\n\r\n\r\n<p>You may have noticed that we didn&#8217;t explain what &#8220;best-fitting rows&#8221; means. The line that minimizes the total of the squared errors of estimation is by far the most widely used criterion for the best-fitting line. The line in Figure 2 was discovered using this criteria. The squared errors of prediction are shown in the last column of Table 2. The sum of the prediction errors squared is lower than it would be for any other regression line, as shown in Table 2. A regression line&#8217;s formula is:<\/p>\r\n\r\n\r\n\r\n<p>Y&#8217; = bX + A<\/p>\r\n\r\n\r\n\r\n<p>where Y&#8217; denotes the predicted score, b denotes the line&#8217;s slope, and A denotes the Y intercept. The line in Figure 2 has the following equation:Y&#8217; = 0.425X + 0.785<\/p>\r\n\r\n\r\n\r\n<p><strong>Computing the Regression Line:<\/strong><\/p>\r\n\r\n\r\n\r\n<p>The regression line is usually computed with statistical tools in the era of computers. The calculations, on the other hand, are reasonably simple and are provided here for anyone who is interested. The estimates are based on the Table 3 statistics. sX is the standard deviation of X, sY is the standard deviation of Y, MX is the mean of X, MY is the mean of Y, MX is the mean of X, MY is the mean of Y, MX is the mean of X, MY is the mean of Y, MX is the mean of X, MY<\/p>\r\n<p>&nbsp;<\/p>\r\n<p>Linear Regression in Machine Learning<\/p>\r\n","protected":false},"excerpt":{"rendered":"<p>Linear Regression in Machine Learning &nbsp; A linear equation with one independent variable is used in linear regression with two variables. The equation is written as y=a+bx, where a and b are both constants. The independent variable is x, while the dependent variable is y. In most instances, you substitute a value for the independent [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"closed","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[710,1712],"tags":[],"class_list":["post-7658","post","type-post","status-publish","format-standard","hentry","category-statistics","category-statistics-modules"],"acf":[],"yoast_head":"<!-- This site is optimized with the Yoast SEO plugin v25.7 - https:\/\/yoast.com\/wordpress\/plugins\/seo\/ -->\n<title>Linear Regression in Machine Learning - Prwatech<\/title>\n<meta name=\"description\" content=\"Master Linear Regression in Machine Learning - Dive deep with our expert instructors and comprehensive curriculum.\" \/>\n<meta name=\"robots\" content=\"noindex, follow, max-snippet:-1, max-image-preview:large, max-video-preview:-1\" \/>\n<meta property=\"og:locale\" content=\"en_US\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"Linear Regression in Machine Learning - Prwatech\" \/>\n<meta property=\"og:description\" content=\"Master Linear Regression in Machine Learning - Dive deep with our expert instructors and comprehensive curriculum.\" \/>\n<meta property=\"og:url\" content=\"https:\/\/prwatech.in\/blog\/statistics\/linear-regression\/\" \/>\n<meta property=\"og:site_name\" content=\"Prwatech\" \/>\n<meta property=\"article:publisher\" content=\"https:\/\/www.facebook.com\/prwatech.in\/\" \/>\n<meta property=\"article:published_time\" content=\"2021-03-30T10:11:54+00:00\" \/>\n<meta property=\"article:modified_time\" content=\"2024-03-30T11:18:13+00:00\" \/>\n<meta property=\"og:image\" content=\"https:\/\/prwatech.in\/blog\/wp-content\/uploads\/2021\/03\/image-242.png\" \/>\n<meta name=\"author\" content=\"Prwatech\" \/>\n<meta name=\"twitter:card\" content=\"summary_large_image\" \/>\n<meta name=\"twitter:creator\" content=\"@Eduprwatech\" \/>\n<meta name=\"twitter:site\" content=\"@Eduprwatech\" \/>\n<meta name=\"twitter:label1\" content=\"Written by\" \/>\n\t<meta name=\"twitter:data1\" content=\"Prwatech\" \/>\n\t<meta name=\"twitter:label2\" content=\"Est. reading time\" \/>\n\t<meta name=\"twitter:data2\" content=\"4 minutes\" \/>\n<script type=\"application\/ld+json\" class=\"yoast-schema-graph\">{\"@context\":\"https:\/\/schema.org\",\"@graph\":[{\"@type\":\"WebPage\",\"@id\":\"https:\/\/prwatech.in\/blog\/statistics\/linear-regression\/\",\"url\":\"https:\/\/prwatech.in\/blog\/statistics\/linear-regression\/\",\"name\":\"Linear Regression in Machine Learning - Prwatech\",\"isPartOf\":{\"@id\":\"https:\/\/prwatech.in\/blog\/#website\"},\"primaryImageOfPage\":{\"@id\":\"https:\/\/prwatech.in\/blog\/statistics\/linear-regression\/#primaryimage\"},\"image\":{\"@id\":\"https:\/\/prwatech.in\/blog\/statistics\/linear-regression\/#primaryimage\"},\"thumbnailUrl\":\"https:\/\/prwatech.in\/blog\/wp-content\/uploads\/2021\/03\/image-242.png\",\"datePublished\":\"2021-03-30T10:11:54+00:00\",\"dateModified\":\"2024-03-30T11:18:13+00:00\",\"author\":{\"@id\":\"https:\/\/prwatech.in\/blog\/#\/schema\/person\/db90baff7744090b2288bbc98fea87f3\"},\"description\":\"Master Linear Regression in Machine Learning - Dive deep with our expert instructors and comprehensive curriculum.\",\"breadcrumb\":{\"@id\":\"https:\/\/prwatech.in\/blog\/statistics\/linear-regression\/#breadcrumb\"},\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\/\/prwatech.in\/blog\/statistics\/linear-regression\/\"]}]},{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\/\/prwatech.in\/blog\/statistics\/linear-regression\/#primaryimage\",\"url\":\"https:\/\/prwatech.in\/blog\/wp-content\/uploads\/2021\/03\/image-242.png\",\"contentUrl\":\"https:\/\/prwatech.in\/blog\/wp-content\/uploads\/2021\/03\/image-242.png\",\"width\":492,\"height\":306},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\/\/prwatech.in\/blog\/statistics\/linear-regression\/#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"Home\",\"item\":\"https:\/\/prwatech.in\/blog\/\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"Linear Regression\"}]},{\"@type\":\"WebSite\",\"@id\":\"https:\/\/prwatech.in\/blog\/#website\",\"url\":\"https:\/\/prwatech.in\/blog\/\",\"name\":\"Prwatech\",\"description\":\"Share Ideas, Start Something Good.\",\"potentialAction\":[{\"@type\":\"SearchAction\",\"target\":{\"@type\":\"EntryPoint\",\"urlTemplate\":\"https:\/\/prwatech.in\/blog\/?s={search_term_string}\"},\"query-input\":{\"@type\":\"PropertyValueSpecification\",\"valueRequired\":true,\"valueName\":\"search_term_string\"}}],\"inLanguage\":\"en-US\"},{\"@type\":\"Person\",\"@id\":\"https:\/\/prwatech.in\/blog\/#\/schema\/person\/db90baff7744090b2288bbc98fea87f3\",\"name\":\"Prwatech\",\"image\":{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\/\/prwatech.in\/blog\/#\/schema\/person\/image\/\",\"url\":\"https:\/\/secure.gravatar.com\/avatar\/c00bafc1b04045f31eda917de39891456c44fa47c092b9bb6be0f860a3a30a2f?s=96&d=mm&r=g\",\"contentUrl\":\"https:\/\/secure.gravatar.com\/avatar\/c00bafc1b04045f31eda917de39891456c44fa47c092b9bb6be0f860a3a30a2f?s=96&d=mm&r=g\",\"caption\":\"Prwatech\"},\"url\":\"https:\/\/prwatech.in\/blog\/author\/prwatech123\/\"}]}<\/script>\n<!-- \/ Yoast SEO plugin. -->","yoast_head_json":{"title":"Linear Regression in Machine Learning - Prwatech","description":"Master Linear Regression in Machine Learning - Dive deep with our expert instructors and comprehensive curriculum.","robots":{"index":"noindex","follow":"follow","max-snippet":"max-snippet:-1","max-image-preview":"max-image-preview:large","max-video-preview":"max-video-preview:-1"},"og_locale":"en_US","og_type":"article","og_title":"Linear Regression in Machine Learning - Prwatech","og_description":"Master Linear Regression in Machine Learning - Dive deep with our expert instructors and comprehensive curriculum.","og_url":"https:\/\/prwatech.in\/blog\/statistics\/linear-regression\/","og_site_name":"Prwatech","article_publisher":"https:\/\/www.facebook.com\/prwatech.in\/","article_published_time":"2021-03-30T10:11:54+00:00","article_modified_time":"2024-03-30T11:18:13+00:00","og_image":[{"url":"https:\/\/prwatech.in\/blog\/wp-content\/uploads\/2021\/03\/image-242.png","type":"","width":"","height":""}],"author":"Prwatech","twitter_card":"summary_large_image","twitter_creator":"@Eduprwatech","twitter_site":"@Eduprwatech","twitter_misc":{"Written by":"Prwatech","Est. reading time":"4 minutes"},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"WebPage","@id":"https:\/\/prwatech.in\/blog\/statistics\/linear-regression\/","url":"https:\/\/prwatech.in\/blog\/statistics\/linear-regression\/","name":"Linear Regression in Machine Learning - Prwatech","isPartOf":{"@id":"https:\/\/prwatech.in\/blog\/#website"},"primaryImageOfPage":{"@id":"https:\/\/prwatech.in\/blog\/statistics\/linear-regression\/#primaryimage"},"image":{"@id":"https:\/\/prwatech.in\/blog\/statistics\/linear-regression\/#primaryimage"},"thumbnailUrl":"https:\/\/prwatech.in\/blog\/wp-content\/uploads\/2021\/03\/image-242.png","datePublished":"2021-03-30T10:11:54+00:00","dateModified":"2024-03-30T11:18:13+00:00","author":{"@id":"https:\/\/prwatech.in\/blog\/#\/schema\/person\/db90baff7744090b2288bbc98fea87f3"},"description":"Master Linear Regression in Machine Learning - Dive deep with our expert instructors and comprehensive curriculum.","breadcrumb":{"@id":"https:\/\/prwatech.in\/blog\/statistics\/linear-regression\/#breadcrumb"},"inLanguage":"en-US","potentialAction":[{"@type":"ReadAction","target":["https:\/\/prwatech.in\/blog\/statistics\/linear-regression\/"]}]},{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/prwatech.in\/blog\/statistics\/linear-regression\/#primaryimage","url":"https:\/\/prwatech.in\/blog\/wp-content\/uploads\/2021\/03\/image-242.png","contentUrl":"https:\/\/prwatech.in\/blog\/wp-content\/uploads\/2021\/03\/image-242.png","width":492,"height":306},{"@type":"BreadcrumbList","@id":"https:\/\/prwatech.in\/blog\/statistics\/linear-regression\/#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"Home","item":"https:\/\/prwatech.in\/blog\/"},{"@type":"ListItem","position":2,"name":"Linear Regression"}]},{"@type":"WebSite","@id":"https:\/\/prwatech.in\/blog\/#website","url":"https:\/\/prwatech.in\/blog\/","name":"Prwatech","description":"Share Ideas, Start Something Good.","potentialAction":[{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https:\/\/prwatech.in\/blog\/?s={search_term_string}"},"query-input":{"@type":"PropertyValueSpecification","valueRequired":true,"valueName":"search_term_string"}}],"inLanguage":"en-US"},{"@type":"Person","@id":"https:\/\/prwatech.in\/blog\/#\/schema\/person\/db90baff7744090b2288bbc98fea87f3","name":"Prwatech","image":{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/prwatech.in\/blog\/#\/schema\/person\/image\/","url":"https:\/\/secure.gravatar.com\/avatar\/c00bafc1b04045f31eda917de39891456c44fa47c092b9bb6be0f860a3a30a2f?s=96&d=mm&r=g","contentUrl":"https:\/\/secure.gravatar.com\/avatar\/c00bafc1b04045f31eda917de39891456c44fa47c092b9bb6be0f860a3a30a2f?s=96&d=mm&r=g","caption":"Prwatech"},"url":"https:\/\/prwatech.in\/blog\/author\/prwatech123\/"}]}},"_links":{"self":[{"href":"https:\/\/prwatech.in\/blog\/wp-json\/wp\/v2\/posts\/7658","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/prwatech.in\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/prwatech.in\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/prwatech.in\/blog\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/prwatech.in\/blog\/wp-json\/wp\/v2\/comments?post=7658"}],"version-history":[{"count":3,"href":"https:\/\/prwatech.in\/blog\/wp-json\/wp\/v2\/posts\/7658\/revisions"}],"predecessor-version":[{"id":11211,"href":"https:\/\/prwatech.in\/blog\/wp-json\/wp\/v2\/posts\/7658\/revisions\/11211"}],"wp:attachment":[{"href":"https:\/\/prwatech.in\/blog\/wp-json\/wp\/v2\/media?parent=7658"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/prwatech.in\/blog\/wp-json\/wp\/v2\/categories?post=7658"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/prwatech.in\/blog\/wp-json\/wp\/v2\/tags?post=7658"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}