{"id":9297,"date":"2022-11-01T13:30:55","date_gmt":"2022-11-01T13:30:55","guid":{"rendered":"https:\/\/www.gologica.com\/elearning\/?p=9297"},"modified":"2025-04-09T07:25:54","modified_gmt":"2025-04-09T07:25:54","slug":"chapter-6-getting-started-with-linear-regression-in-r","status":"publish","type":"post","link":"https:\/\/www.gologica.com\/elearning\/chapter-6-getting-started-with-linear-regression-in-r\/","title":{"rendered":"Chapter 6: Getting Started With Linear Regression In R"},"content":{"rendered":"\t\t<div data-elementor-type=\"wp-post\" data-elementor-id=\"9297\" class=\"elementor elementor-9297\">\n\t\t\t\t\t\t<section class=\"elementor-section elementor-top-section elementor-element elementor-element-6360a53 elementor-section-boxed elementor-section-height-default elementor-section-height-default\" data-id=\"6360a53\" data-element_type=\"section\">\n\t\t\t\t\t\t<div class=\"elementor-container elementor-column-gap-default\">\n\t\t\t\t\t<div class=\"elementor-column elementor-col-50 elementor-top-column elementor-element elementor-element-78a97ce\" data-id=\"78a97ce\" data-element_type=\"column\">\n\t\t\t<div class=\"elementor-widget-wrap elementor-element-populated\">\n\t\t\t\t\t\t<section class=\"elementor-section elementor-inner-section elementor-element elementor-element-4632fcc elementor-section-full_width elementor-section-height-default elementor-section-height-default\" data-id=\"4632fcc\" data-element_type=\"section\">\n\t\t\t\t\t\t<div class=\"elementor-container elementor-column-gap-no\">\n\t\t\t\t\t<div class=\"elementor-column elementor-col-100 elementor-inner-column elementor-element elementor-element-041a8c7\" data-id=\"041a8c7\" data-element_type=\"column\">\n\t\t\t<div class=\"elementor-widget-wrap elementor-element-populated\">\n\t\t\t\t\t\t<div class=\"elementor-element elementor-element-e730054 elementor-widget elementor-widget-heading\" data-id=\"e730054\" data-element_type=\"widget\" data-widget_type=\"heading.default\">\n\t\t\t\t<div class=\"elementor-widget-container\">\n\t\t\t\t\t<h2 class=\"elementor-heading-title elementor-size-default\">Table Of Content<\/h2>\t\t\t\t<\/div>\n\t\t\t\t<\/div>\n\t\t\t\t<div class=\"elementor-element elementor-element-7ef55b3 elementor-align-left ekit-has-divider-yes elementor-widget elementor-widget-elementskit-page-list\" data-id=\"7ef55b3\" data-element_type=\"widget\" data-widget_type=\"elementskit-page-list.default\">\n\t\t\t\t<div class=\"elementor-widget-container\">\n\t\t\t\t\t<div class=\"ekit-wid-con\" >\t\t<div class=\"elementor-icon-list-items \">\n\t\t\t\t\t\t\t<div class=\"elementor-icon-list-item   \">\n\t\t\t\t\t\t<a class=\"elementor-repeater-item-3281536 ekit_badge_left\" href=\"https:\/\/www.gologica.com\/elearning\/overview-data-science-tutorial-for-beginners\/\">\n\t\t\t\t\t\t\t<div class=\"ekit_page_list_content\">\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t<span class=\"elementor-icon-list-text\">\n\t\t\t\t\t\t\t\t\t<span class=\"ekit_page_list_title_title\">Chapter : Overview \u2013 Data Science Tutorial for Beginners<\/span>\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t<\/span>\n\t\t\t\t\t\t\t<\/div>\n\t\t\t\t\t\t\t\t\t\t\t\t\t<\/a>\n\t\t\t\t\t<\/div>\n\t\t\t\t\t\t\t\t<div class=\"elementor-icon-list-item   \">\n\t\t\t\t\t\t<a class=\"elementor-repeater-item-3809306 ekit_badge_left\" href=\"https:\/\/www.gologica.com\/elearning\/what-is-data-and-the-importance-of-data-2022\/\">\n\t\t\t\t\t\t\t<div class=\"ekit_page_list_content\">\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t<span class=\"elementor-icon-list-text\">\n\t\t\t\t\t\t\t\t\t<span class=\"ekit_page_list_title_title\">Chapter 1: What is data and the importance of data 2022?<\/span>\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t<\/span>\n\t\t\t\t\t\t\t<\/div>\n\t\t\t\t\t\t\t\t\t\t\t\t\t<\/a>\n\t\t\t\t\t<\/div>\n\t\t\t\t\t\t\t\t<div class=\"elementor-icon-list-item   \">\n\t\t\t\t\t\t<a class=\"elementor-repeater-item-776c345 ekit_badge_left\" href=\"https:\/\/www.gologica.com\/elearning\/datascience-introduction-to-data-science\/\">\n\t\t\t\t\t\t\t<div class=\"ekit_page_list_content\">\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t<span class=\"elementor-icon-list-text\">\n\t\t\t\t\t\t\t\t\t<span class=\"ekit_page_list_title_title\">Chapter 2: Introduction to Data Science<\/span>\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t<\/span>\n\t\t\t\t\t\t\t<\/div>\n\t\t\t\t\t\t\t\t\t\t\t\t\t<\/a>\n\t\t\t\t\t<\/div>\n\t\t\t\t\t\t\t\t<div class=\"elementor-icon-list-item   \">\n\t\t\t\t\t\t<a class=\"elementor-repeater-item-c842f3f ekit_badge_left\" href=\"https:\/\/www.gologica.com\/elearning\/chapter-3-data-scientist-vs-data-analyst-vs-data-engineer-job-role-skills-and-salary\/\">\n\t\t\t\t\t\t\t<div class=\"ekit_page_list_content\">\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t<span class=\"elementor-icon-list-text\">\n\t\t\t\t\t\t\t\t\t<span class=\"ekit_page_list_title_title\">Chapter 3: Data Scientist vs Data Analyst vs Data Engineer: Job Role, Skills, and Salary<\/span>\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t<\/span>\n\t\t\t\t\t\t\t<\/div>\n\t\t\t\t\t\t\t\t\t\t\t\t\t<\/a>\n\t\t\t\t\t<\/div>\n\t\t\t\t\t\t\t\t<div class=\"elementor-icon-list-item   \">\n\t\t\t\t\t\t<a class=\"elementor-repeater-item-8bfc8eb ekit_badge_left\" href=\"https:\/\/www.gologica.com\/elearning\/top-15-data-science-tools-everyone-should-know-in-2022\/\">\n\t\t\t\t\t\t\t<div class=\"ekit_page_list_content\">\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t<span class=\"elementor-icon-list-text\">\n\t\t\t\t\t\t\t\t\t<span class=\"ekit_page_list_title_title\">Chapter 4: Top 15 Data Science Tools Everyone Should Know in 2022<\/span>\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t<\/span>\n\t\t\t\t\t\t\t<\/div>\n\t\t\t\t\t\t\t\t\t\t\t\t\t<\/a>\n\t\t\t\t\t<\/div>\n\t\t\t\t\t\t\t\t<div class=\"elementor-icon-list-item   \">\n\t\t\t\t\t\t<a class=\"elementor-repeater-item-e941020 ekit_badge_left\" href=\"https:\/\/www.gologica.com\/elearning\/data-science-with-r-getting-started\/\">\n\t\t\t\t\t\t\t<div class=\"ekit_page_list_content\">\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t<span class=\"elementor-icon-list-text\">\n\t\t\t\t\t\t\t\t\t<span class=\"ekit_page_list_title_title\">Chapter 5: Data Science with R: Getting Started<\/span>\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t<\/span>\n\t\t\t\t\t\t\t<\/div>\n\t\t\t\t\t\t\t\t\t\t\t\t\t<\/a>\n\t\t\t\t\t<\/div>\n\t\t\t\t\t\t\t\t<div class=\"elementor-icon-list-item   \">\n\t\t\t\t\t\t<a class=\"elementor-repeater-item-1ede202 ekit_badge_left\" href=\"https:\/\/www.gologica.com\/elearning\/chapter-6-getting-started-with-linear-regression-in-r\/\">\n\t\t\t\t\t\t\t<div class=\"ekit_page_list_content\">\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t<span class=\"elementor-icon-list-text\">\n\t\t\t\t\t\t\t\t\t<span class=\"ekit_page_list_title_title\">Chapter 6: Getting Started With Linear Regression In R<\/span>\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t<\/span>\n\t\t\t\t\t\t\t<\/div>\n\t\t\t\t\t\t\t\t\t\t\t\t\t<\/a>\n\t\t\t\t\t<\/div>\n\t\t\t\t\t\t\t\t<div class=\"elementor-icon-list-item   \">\n\t\t\t\t\t\t<a class=\"elementor-repeater-item-6a2bcba ekit_badge_left\" href=\"https:\/\/www.gologica.com\/elearning\/chapter-7-a-guide-to-time-series-forecasting-in-r-you-should-know\/\">\n\t\t\t\t\t\t\t<div class=\"ekit_page_list_content\">\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t<span class=\"elementor-icon-list-text\">\n\t\t\t\t\t\t\t\t\t<span class=\"ekit_page_list_title_title\">Chapter 7: A Guide to Time Series Forecasting in R You Should Know<\/span>\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t<\/span>\n\t\t\t\t\t\t\t<\/div>\n\t\t\t\t\t\t\t\t\t\t\t\t\t<\/a>\n\t\t\t\t\t<\/div>\n\t\t\t\t\t\t\t\t<div class=\"elementor-icon-list-item   \">\n\t\t\t\t\t\t<a class=\"elementor-repeater-item-aed6bdc ekit_badge_left\" href=\"https:\/\/www.gologica.com\/elearning\/chapter-8-how-to-build-a-career-in-data-science\/\">\n\t\t\t\t\t\t\t<div class=\"ekit_page_list_content\">\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t<span class=\"elementor-icon-list-text\">\n\t\t\t\t\t\t\t\t\t<span class=\"ekit_page_list_title_title\">Chapter 8: How to Build a Career in Data Science<\/span>\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t<\/span>\n\t\t\t\t\t\t\t<\/div>\n\t\t\t\t\t\t\t\t\t\t\t\t\t<\/a>\n\t\t\t\t\t<\/div>\n\t\t\t\t\t\t\t\t<div class=\"elementor-icon-list-item   \">\n\t\t\t\t\t\t<a class=\"elementor-repeater-item-5716c36 ekit_badge_left\" href=\"https:\/\/www.gologica.com\/elearning\/chapter-9-how-to-become-a-data-scientist-in-2022\/\">\n\t\t\t\t\t\t\t<div class=\"ekit_page_list_content\">\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t<span class=\"elementor-icon-list-text\">\n\t\t\t\t\t\t\t\t\t<span class=\"ekit_page_list_title_title\">Chapter 9: How to Become a Data Scientist in 2022<\/span>\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t<\/span>\n\t\t\t\t\t\t\t<\/div>\n\t\t\t\t\t\t\t\t\t\t\t\t\t<\/a>\n\t\t\t\t\t<\/div>\n\t\t\t\t\t\t<\/div>\n\t\t<\/div>\t\t\t\t<\/div>\n\t\t\t\t<\/div>\n\t\t\t\t\t<\/div>\n\t\t<\/div>\n\t\t\t\t\t<\/div>\n\t\t<\/section>\n\t\t\t\t\t<\/div>\n\t\t<\/div>\n\t\t\t\t<div class=\"elementor-column elementor-col-50 elementor-top-column elementor-element elementor-element-6f9f8e8\" data-id=\"6f9f8e8\" data-element_type=\"column\">\n\t\t\t<div class=\"elementor-widget-wrap elementor-element-populated\">\n\t\t\t\t\t\t<div class=\"elementor-element elementor-element-10ef3a3 elementor-widget elementor-widget-text-editor\" data-id=\"10ef3a3\" data-element_type=\"widget\" data-widget_type=\"text-editor.default\">\n\t\t\t\t<div class=\"elementor-widget-container\">\n\t\t\t\t\t\t\t\t\t<h1><span style=\"font-weight: 400;\">Getting Started With Linear Regression In R<\/span><\/h1><p><a href=\"https:\/\/www.gologica.com\/course\/data-science\/\"><img decoding=\"async\" class=\"size-medium wp-image-9300 aligncenter\" src=\"https:\/\/www.gologica.com\/elearning\/wp-content\/uploads\/2019\/08\/Getting-Started-With-Linear-Regression-In-R-460x241.jpg\" alt=\"\" width=\"300\" height=\"157\" srcset=\"https:\/\/www.gologica.com\/elearning\/wp-content\/uploads\/2019\/08\/Getting-Started-With-Linear-Regression-In-R-460x241.jpg 460w, https:\/\/www.gologica.com\/elearning\/wp-content\/uploads\/2019\/08\/Getting-Started-With-Linear-Regression-In-R-768x402.jpg 768w, https:\/\/www.gologica.com\/elearning\/wp-content\/uploads\/2019\/08\/Getting-Started-With-Linear-Regression-In-R-1024x536.jpg 1024w, https:\/\/www.gologica.com\/elearning\/wp-content\/uploads\/2019\/08\/Getting-Started-With-Linear-Regression-In-R-100x52.jpg 100w, https:\/\/www.gologica.com\/elearning\/wp-content\/uploads\/2019\/08\/Getting-Started-With-Linear-Regression-In-R-600x314.jpg 600w, https:\/\/www.gologica.com\/elearning\/wp-content\/uploads\/2019\/08\/Getting-Started-With-Linear-Regression-In-R-120x63.jpg 120w, https:\/\/www.gologica.com\/elearning\/wp-content\/uploads\/2019\/08\/Getting-Started-With-Linear-Regression-In-R-310x162.jpg 310w, https:\/\/www.gologica.com\/elearning\/wp-content\/uploads\/2019\/08\/Getting-Started-With-Linear-Regression-In-R.jpg 1200w\" sizes=\"(max-width: 300px) 100vw, 300px\" \/><\/a><\/p><p><span style=\"font-weight: 400;\">We live in an information-driven world where data reigns supreme. Unsurprisingly, we must assess relevant data to make critical business decisions. One of the more popular data analysis techniques is regression. The discipline of machine learning is expanding, and with it, a popular algorithm: linear regression. This post will teach you about linear regression and how it works in R.<\/span><\/p><h2><span style=\"font-weight: 400;\">Why Linear Regression?<\/span><\/h2><p><span style=\"font-weight: 400;\">Before delving into linear regression, consider the requirement for a linear regression process using an analogy.<\/span><\/p><p><span style=\"font-weight: 400;\">Assume we were asked to forecast the number of skiers at a resort based on snowfall in the vicinity. The simplest method would be to draw a basic graph with snowfall quantities and skiers on the &#8216;X&#8217; and &#8216;Y&#8217; axes. Then, based on the graph, we may deduce that as the amount of snowfall grew, so will the number of skiers.<\/span><\/p><p><span style=\"font-weight: 400;\">As a result, the graph makes the link between skiers and snowfall clear. The number of skiers grows according to the amount of snowfall. Therefore, we can make better judgments on ski area operations based on the information provided by the graph.<\/span><\/p><p><span style=\"font-weight: 400;\">To grasp linear regression, we must first understand &#8220;regression.&#8221; Regression is a technique for determining correlations between a dependent variable (Y) and many independent variables (X). The independent variables are predictors or explanatory factors in this context, while the dependent variable is a response or target variable.<\/span><\/p><p><span style=\"font-weight: 400;\">A linear regression equation looks like this:<\/span><\/p><p><span style=\"font-weight: 400;\">y = B0 + B1x1 + B2x2 + B3x3 + &#8230;.<\/span><\/p><p><span style=\"font-weight: 400;\">Where B0 is the intercept(value of y when x=0),<\/span><\/p><p><span style=\"font-weight: 400;\">B1, B2, and B3 are the slopes.<\/span><\/p><p><span style=\"font-weight: 400;\">x1, x2, and x3 independent variables.<\/span><\/p><p><span style=\"font-weight: 400;\">Snowfall is an independent variable in this situation, whereas the number of skiers is a dependent variable. So, given that regression identifies correlations between dependent and independent variables, what precisely is linear regression?<\/span><\/p><h2><span style=\"font-weight: 400;\">What is Linear Regression?<\/span><\/h2><p><span style=\"font-weight: 400;\">Linear regression is a statistical analytic technique demonstrating the link between two or more continuous variables. It develops a prediction model based on relevant data to demonstrate patterns. To develop the model, analysts often employ the &#8220;least square approach.&#8221; Other approaches exist, but the least square method is often used.<\/span><\/p><p><span style=\"font-weight: 400;\">The graph below demonstrates the link between a sample of people&#8217;s heights and weights. The red line is the linear regression that reveals a person&#8217;s height is positively connected to weight.<\/span><\/p><p><span style=\"font-weight: 400;\">Now that we know what linear regression is, let&#8217;s look at how it works and how we can use the linear regression formula to get the regression line.<\/span><\/p><h2><span style=\"font-weight: 400;\">How Does Linear Regression Work?<\/span><\/h2><p><span style=\"font-weight: 400;\">We can better understand how linear regression works by considering the example of a dataset with two fields, Area and Rent, and is used to forecast the rent of a property depending on its location. The dataset is as follows:<\/span><\/p><ol><li style=\"font-weight: 400;\" aria-level=\"1\"><span style=\"font-weight: 400;\">We create a graph using the supplied data, with Area on the X-axis and Rent on the Y-axis. The graph will look somewhat like this. Take note of the linear pattern with a small dip.<\/span><\/li><li style=\"font-weight: 400;\" aria-level=\"1\"><span style=\"font-weight: 400;\">The mean of Area and Rent is then calculated.<\/span><\/li><li style=\"font-weight: 400;\" aria-level=\"1\"><span style=\"font-weight: 400;\">The mean is then plotted on the graph.<\/span><\/li><li style=\"font-weight: 400;\" aria-level=\"1\"><span style=\"font-weight: 400;\">We draw a best-fit line that goes through the mean.<\/span><\/li><li style=\"font-weight: 400;\" aria-level=\"1\"><span style=\"font-weight: 400;\">But there&#8217;s an issue. Multiple lines can be drawn across the mean, as seen below:<\/span><\/li><li style=\"font-weight: 400;\" aria-level=\"1\"><span style=\"font-weight: 400;\">To solve this issue, we keep adjusting the line until the best-suited line has the shortest square distance from the data points.<\/span><\/li><li style=\"font-weight: 400;\" aria-level=\"1\"><span style=\"font-weight: 400;\">Adding the squares of the residuals yields the least-square distance.<\/span><\/li><li style=\"font-weight: 400;\" aria-level=\"1\"><span style=\"font-weight: 400;\">We can now deduce that Residual is the difference between Y-actual and Y-pred.<\/span><\/li><li style=\"font-weight: 400;\" aria-level=\"1\"><span style=\"font-weight: 400;\">These formulae may be used to get the values of m and c for the best fit line, y = mx + c:<\/span><\/li><li style=\"font-weight: 400;\" aria-level=\"1\"><span style=\"font-weight: 400;\">This assists us in determining the relevant values:<\/span><\/li><\/ol><ol><li style=\"font-weight: 400;\" aria-level=\"1\"><span style=\"font-weight: 400;\">We can then calculate the values of m and c.<\/span><\/li><li style=\"font-weight: 400;\" aria-level=\"1\"><span style=\"font-weight: 400;\">We can now calculate the value of Y-pred.<\/span><\/li><li style=\"font-weight: 400;\" aria-level=\"1\"><span style=\"font-weight: 400;\">We calculate that the least square value for the following line is 3.02.<\/span><\/li><li style=\"font-weight: 400;\" aria-level=\"1\"><span style=\"font-weight: 400;\">Finally, we may plot the Y-pred, which is determined to be the best fit line.<\/span><\/li><\/ol><p><span style=\"font-weight: 400;\">This demonstrates the linear regression technique in action. Let us now go on to our use case.<\/span><\/p><h2><span style=\"font-weight: 400;\">Use Case of revenue prediction, featuring linear regression<\/span><\/h2><p><span style=\"font-weight: 400;\">Using a linear regression model in R, predict income from paid, organic, and social media visits.<\/span><\/p><p><span style=\"font-weight: 400;\">We will now examine a real-world scenario in which we will estimate income using regression analysis in R. The following is an example dataset with which we will be working:<\/span><\/p><p><span style=\"font-weight: 400;\">In this demonstration, we will use the following three attributes to forecast revenue:<\/span><\/p><ul><li style=\"font-weight: 400;\" aria-level=\"1\"><span style=\"font-weight: 400;\">Paid traffic is traffic obtained through advertising.<\/span><\/li><li style=\"font-weight: 400;\" aria-level=\"1\"><span style=\"font-weight: 400;\">Organic traffic is non-paid traffic from search engines.<\/span><\/li><li style=\"font-weight: 400;\" aria-level=\"1\"><span style=\"font-weight: 400;\">Social traffic refers to traffic originating from various social networking sites.<\/span><\/li><\/ul><p><span style=\"font-weight: 400;\">We shall employ multiple linear regression. The linear regression formula is as follows:<\/span><\/p><p><span style=\"font-weight: 400;\">Before we begin, let&#8217;s have a look at how the software works:<\/span><\/p><ol><li style=\"font-weight: 400;\" aria-level=\"1\"><span style=\"font-weight: 400;\">CSV files can be used to generate inputs.<\/span><\/li><li style=\"font-weight: 400;\" aria-level=\"1\"><span style=\"font-weight: 400;\">Import the necessary libraries.<\/span><\/li><li style=\"font-weight: 400;\" aria-level=\"1\"><span style=\"font-weight: 400;\">Divide the dataset into two parts: train and test.<\/span><\/li><li style=\"font-weight: 400;\" aria-level=\"1\"><span style=\"font-weight: 400;\">Use the regression to analyze paid, organic, and social traffic.<\/span><\/li><li style=\"font-weight: 400;\" aria-level=\"1\"><span style=\"font-weight: 400;\">Validation of the model<\/span><\/li><\/ol><p><span style=\"font-weight: 400;\">So let&#8217;s get started with our step-by-step linear regression demonstration! We&#8217;ll launch RStudio first because we&#8217;ll be doing linear regression.<\/span><\/p><p><span style=\"font-weight: 400;\">We enter the following code in R:<\/span><\/p><p><span style=\"font-weight: 400;\"># Import the dataset<\/span><\/p><p><span style=\"font-weight: 400;\">sales &lt;- read. CSV (&#8216;Mention your download path&#8217;)<\/span><\/p><p><span style=\"font-weight: 400;\">head(sales) #Displays the top 6 rows of a dataset<\/span><\/p><p><span style=\"font-weight: 400;\">summary(sales) #Gives certain statistical information about the data. The output will look like the below:<\/span><\/p><p><span style=\"font-weight: 400;\">dim(sales) # Displays the dimensions of the dataset<\/span><\/p><p><span style=\"font-weight: 400;\">We are now going to plot the variables.<\/span><\/p><p><span style=\"font-weight: 400;\">plot(sales) # Plot the variables to see their trends<\/span><\/p><p><span style=\"font-weight: 400;\">Let&#8217;s look at how the variables are connected. We&#8217;ll solely use the numeric column values for this.<\/span><\/p><p><span style=\"font-weight: 400;\">library(corrplot) # Library to find the correlation between the variables<\/span><\/p><p><span style=\"font-weight: 400;\">num.cols&lt;-sapply(sales, is.numeric)<\/span><\/p><p><span style=\"font-weight: 400;\">num.cols<\/span><\/p><p><span style=\"font-weight: 400;\">cor.data&lt;-cor(sales[,num.cols])<\/span><\/p><p><span style=\"font-weight: 400;\">cor.data<\/span><\/p><p><span style=\"font-weight: 400;\">corrplot(cor.data, method=&#8217;color&#8217;)<\/span><\/p><p><span style=\"font-weight: 400;\">As the following correlation matrix shows, the variables are highly correlated with one another and with the sales variable.<\/span><\/p><p><span style=\"font-weight: 400;\">Let&#8217;s divide the data into training and testing sets immediately.<\/span><\/p><p><span style=\"font-weight: 400;\"># Split the data into training and testing<\/span><\/p><p><span style=\"font-weight: 400;\">set.seed(2)<\/span><\/p><p><span style=\"font-weight: 400;\">library(caTools) #caTools has the split function\u00a0<\/span><\/p><p><span style=\"font-weight: 400;\">split &lt;- sample.split(sales, SplitRatio = 0.7) # Assigning it to a variable split, sample.split is one of the functions we are using. With the ratio value of 0.7, it states that we will have 70% of the sales data for training and 30% for testing the model<\/span><\/p><p><span style=\"font-weight: 400;\">split<\/span><\/p><p><span style=\"font-weight: 400;\">train &lt;- subset(sales, split = &#8216;TRUE&#8217;) #Creating a training set\u00a0<\/span><\/p><p><span style=\"font-weight: 400;\">test &lt;- subset(sales, split = &#8216;FALSE&#8217;) #Creating testing set by assigning FALSE<\/span><\/p><p><span style=\"font-weight: 400;\">head(train)<\/span><\/p><p><span style=\"font-weight: 400;\">head(test)<\/span><\/p><p><span style=\"font-weight: 400;\">View(train)<\/span><\/p><p><span style=\"font-weight: 400;\">View(test)<\/span><\/p><p><span style=\"font-weight: 400;\">Now that we have the test and training variables, let&#8217;s build the model:<\/span><\/p><p><span style=\"font-weight: 400;\">Model &lt;- lm(Revenue ~., data = train) #Creates the model. Here, lm stands for the linear regression model. Revenue is the target variable we want to track.<\/span><\/p><p><span style=\"font-weight: 400;\">summary(Model)\u00a0<\/span><\/p><table><tbody><tr><td><p><span style=\"font-weight: 400;\"># Prediction<\/span><\/p><p><span style=\"font-weight: 400;\">pred &lt;- predict(Model, test) #The test data was kept for this purpose<\/span><\/p><p><span style=\"font-weight: 400;\">pred #This displays the predicted values\u00a0<\/span><\/p><p><span style=\"font-weight: 400;\">res&lt;-residuals(Model) # Find the residuals<\/span><\/p><p><span style=\"font-weight: 400;\">res&lt;-as.data.frame(res) # Convert the residual into a dataframe<\/span><\/p><p><span style=\"font-weight: 400;\">res # Prints the residuals<\/span><\/p><\/td><\/tr><\/tbody><\/table><table><tbody><tr><td><p><span style=\"font-weight: 400;\"># compare the predicted vs actual values<\/span><\/p><p><span style=\"font-weight: 400;\">results&lt;-cbind(pred,test$Revenue)<\/span><\/p><p><span style=\"font-weight: 400;\">results<\/span><\/p><p><span style=\"font-weight: 400;\">colnames(results)&lt;-c(&#8216;predicted&#8217;,&#8217;real&#8217;)<\/span><\/p><p><span style=\"font-weight: 400;\">results&lt;-as.data.frame(results)<\/span><\/p><p><span style=\"font-weight: 400;\">head(results)<\/span><\/p><\/td><\/tr><\/tbody><\/table><p><span style=\"font-weight: 400;\"># Let\u2019s now, compare the predicted vs actual values<\/span><\/p><p><span style=\"font-weight: 400;\">plot(test$Revenue, type = &#8216;l&#8217;, lty = 1.8, col = &#8220;red&#8221;)<\/span><\/p><p><span style=\"font-weight: 400;\">The output of the preceding command is depicted in the graph below, which displays the projected revenue.<\/span><\/p><p><span style=\"font-weight: 400;\">Let us now visualize our test revenue with the following command:<\/span><\/p><p><span style=\"font-weight: 400;\">lines(pred, type = &#8220;l&#8221;, col = &#8220;blue&#8221;) #The output looks like below<\/span><\/p><p><span style=\"font-weight: 400;\">Let&#8217;s plot the forecast completely using the following command:<\/span><\/p><p><span style=\"font-weight: 400;\">plot(pred, type = &#8220;l,&#8221; lty = 1.8, col = &#8220;blue&#8221;) #The output looks like below; this graph shows the expected Revenue.<\/span><\/p><p><span style=\"font-weight: 400;\">We can observe from the above result that the graphs of anticipated revenue and expected revenue are pretty similar. Let&#8217;s look at the precision so we can confirm the comparison.<\/span><\/p><table><tbody><tr><td><p><span style=\"font-weight: 400;\"># Calculating the accuracy<\/span><\/p><p><span style=\"font-weight: 400;\">rmse &lt;- sqrt(mean(pred-sales$Revenue)^2) # Root Mean Square Error is the standard deviation of the residuals<\/span><\/p><p><span style=\"font-weight: 400;\">rmse<\/span><\/p><\/td><\/tr><\/tbody><\/table><p><span style=\"font-weight: 400;\">The output looks like below:<\/span><\/p><p><span style=\"font-weight: 400;\">As you can see, the precision of this model is excellent. This concludes the demonstration.<\/span><\/p><h2><span style=\"font-weight: 400;\">Conclusion<\/span><\/h2><p><span style=\"font-weight: 400;\">You now understand why linear regression is required, what a linear regression model is, and how the linear regression method works. You also saw a real-world example in which we utilized RStudio to compute revenue based on our dataset. You learned about the different commands and packages in RStudio and how to plot a graph. Although this is a fantastic starting point, there is still much more to learn about linear regression.<\/span><\/p>\t\t\t\t\t\t\t\t<\/div>\n\t\t\t\t<\/div>\n\t\t\t\t\t<\/div>\n\t\t<\/div>\n\t\t\t\t\t<\/div>\n\t\t<\/section>\n\t\t\t\t<section class=\"elementor-section elementor-top-section elementor-element elementor-element-2424e06 elementor-section-boxed elementor-section-height-default elementor-section-height-default\" data-id=\"2424e06\" data-element_type=\"section\">\n\t\t\t\t\t\t<div class=\"elementor-container elementor-column-gap-default\">\n\t\t\t\t\t<div class=\"elementor-column elementor-col-33 elementor-top-column elementor-element elementor-element-8f575eb\" data-id=\"8f575eb\" data-element_type=\"column\">\n\t\t\t<div class=\"elementor-widget-wrap\">\n\t\t\t\t\t\t\t<\/div>\n\t\t<\/div>\n\t\t\t\t<div class=\"elementor-column elementor-col-33 elementor-top-column elementor-element elementor-element-8212044\" data-id=\"8212044\" data-element_type=\"column\">\n\t\t\t<div class=\"elementor-widget-wrap elementor-element-populated\">\n\t\t\t\t\t\t<div class=\"elementor-element elementor-element-17fd814 elementor-widget elementor-widget-button\" data-id=\"17fd814\" data-element_type=\"widget\" data-widget_type=\"button.default\">\n\t\t\t\t<div class=\"elementor-widget-container\">\n\t\t\t\t\t\t\t\t\t<div class=\"elementor-button-wrapper\">\n\t\t\t\t\t<a class=\"elementor-button elementor-button-link elementor-size-sm\" href=\"https:\/\/www.gologica.com\/elearning\/data-science-with-r-getting-started\/\">\n\t\t\t\t\t\t<span class=\"elementor-button-content-wrapper\">\n\t\t\t\t\t\t<span class=\"elementor-button-icon\">\n\t\t\t\t\t\t\t\t\t<i class=\"fa fa-arrow-left\" aria-hidden=\"true\"><\/i>\n\t\t\t\t\t\t\t<\/span>\n\t\t\t\t\t\t\t\t\t<span class=\"elementor-button-text\">Previous<\/span>\n\t\t\t\t\t<\/span>\n\t\t\t\t\t<\/a>\n\t\t\t\t<\/div>\n\t\t\t\t\t\t\t\t<\/div>\n\t\t\t\t<\/div>\n\t\t\t\t\t<\/div>\n\t\t<\/div>\n\t\t\t\t<div class=\"elementor-column elementor-col-33 elementor-top-column elementor-element elementor-element-95c0bd3\" data-id=\"95c0bd3\" data-element_type=\"column\">\n\t\t\t<div class=\"elementor-widget-wrap elementor-element-populated\">\n\t\t\t\t\t\t<div class=\"elementor-element elementor-element-9480154 elementor-align-right elementor-widget elementor-widget-button\" data-id=\"9480154\" data-element_type=\"widget\" data-widget_type=\"button.default\">\n\t\t\t\t<div class=\"elementor-widget-container\">\n\t\t\t\t\t\t\t\t\t<div class=\"elementor-button-wrapper\">\n\t\t\t\t\t<a class=\"elementor-button elementor-button-link elementor-size-sm\" href=\"https:\/\/www.gologica.com\/elearning\/chapter-7-a-guide-to-time-series-forecasting-in-r-you-should-know\/\">\n\t\t\t\t\t\t<span class=\"elementor-button-content-wrapper\">\n\t\t\t\t\t\t<span class=\"elementor-button-icon\">\n\t\t\t\t\t\t\t\t\t<i class=\"fa fa-arrow-right\" aria-hidden=\"true\"><\/i>\n\t\t\t\t\t\t\t<\/span>\n\t\t\t\t\t\t\t\t\t<span class=\"elementor-button-text\">Next<\/span>\n\t\t\t\t\t<\/span>\n\t\t\t\t\t<\/a>\n\t\t\t\t<\/div>\n\t\t\t\t\t\t\t\t<\/div>\n\t\t\t\t<\/div>\n\t\t\t\t\t<\/div>\n\t\t<\/div>\n\t\t\t\t\t<\/div>\n\t\t<\/section>\n\t\t\t\t<\/div>\n\t\t","protected":false},"excerpt":{"rendered":"<p>Table Of Content Chapter : Overview \u2013 Data Science Tutorial for Beginners Chapter 1: What is data and the importance &hellip;<\/p>\n","protected":false},"author":19758,"featured_media":9298,"comment_status":"closed","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"_bbp_topic_count":0,"_bbp_reply_count":0,"_bbp_total_topic_count":0,"_bbp_total_reply_count":0,"_bbp_voice_count":0,"_bbp_anonymous_reply_count":0,"_bbp_topic_count_hidden":0,"_bbp_reply_count_hidden":0,"_bbp_forum_subforum_count":0,"pmpro_default_level":"","footnotes":""},"categories":[15221,15233],"tags":[287,715],"coauthors":[816],"class_list":["post-9297","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-data-science-business-analytics","category-sidebar-chapters","tag-data-science","tag-data-science-online-training","pmpro-has-access","user-has-not-earned"],"yoast_head":"<!-- This site is optimized with the Yoast SEO plugin v26.9 - https:\/\/yoast.com\/product\/yoast-seo-wordpress\/ -->\n<title>Chapter 6: Getting Started With Linear Regression In R<\/title>\n<meta name=\"description\" content=\"Data science Online Training help you ace information investigation with R. You will pick up ability in Data Modeling and machine learning calculations.\" \/>\n<meta name=\"robots\" content=\"index, follow, max-snippet:-1, max-image-preview:large, max-video-preview:-1\" \/>\n<link rel=\"canonical\" href=\"https:\/\/www.gologica.com\/elearning\/chapter-6-getting-started-with-linear-regression-in-r\/\" \/>\n<meta property=\"og:locale\" content=\"en_US\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"Chapter 6: Getting Started With Linear Regression In R\" \/>\n<meta property=\"og:description\" content=\"Data science Online Training help you ace information investigation with R. You will pick up ability in Data Modeling and machine learning calculations.\" \/>\n<meta property=\"og:url\" content=\"https:\/\/www.gologica.com\/elearning\/chapter-6-getting-started-with-linear-regression-in-r\/\" \/>\n<meta property=\"og:site_name\" content=\"GoLogica\" \/>\n<meta property=\"article:published_time\" content=\"2022-11-01T13:30:55+00:00\" \/>\n<meta property=\"article:modified_time\" content=\"2025-04-09T07:25:54+00:00\" \/>\n<meta property=\"og:image\" content=\"https:\/\/www.gologica.com\/elearning\/wp-content\/uploads\/2022\/11\/Linear-Regression-In-R.jpg\" \/>\n\t<meta property=\"og:image:width\" content=\"300\" \/>\n\t<meta property=\"og:image:height\" content=\"175\" \/>\n\t<meta property=\"og:image:type\" content=\"image\/jpeg\" \/>\n<meta name=\"author\" content=\"Mounika P\" \/>\n<meta name=\"twitter:card\" content=\"summary_large_image\" \/>\n<meta name=\"twitter:label1\" content=\"Written by\" \/>\n\t<meta name=\"twitter:data1\" content=\"Mounika P\" \/>\n\t<meta name=\"twitter:label2\" content=\"Est. reading time\" \/>\n\t<meta name=\"twitter:data2\" content=\"7 minutes\" \/>\n<script type=\"application\/ld+json\" class=\"yoast-schema-graph\">{\"@context\":\"https:\/\/schema.org\",\"@graph\":[{\"@type\":\"Article\",\"@id\":\"https:\/\/www.gologica.com\/elearning\/chapter-6-getting-started-with-linear-regression-in-r\/#article\",\"isPartOf\":{\"@id\":\"https:\/\/www.gologica.com\/elearning\/chapter-6-getting-started-with-linear-regression-in-r\/\"},\"author\":{\"name\":\"Mounika P\",\"@id\":\"https:\/\/www.gologica.com\/elearning\/#\/schema\/person\/1aec1e5a8488bc2738614b12e01f52b0\"},\"headline\":\"Chapter 6: Getting Started With Linear Regression In R\",\"datePublished\":\"2022-11-01T13:30:55+00:00\",\"dateModified\":\"2025-04-09T07:25:54+00:00\",\"mainEntityOfPage\":{\"@id\":\"https:\/\/www.gologica.com\/elearning\/chapter-6-getting-started-with-linear-regression-in-r\/\"},\"wordCount\":1535,\"image\":{\"@id\":\"https:\/\/www.gologica.com\/elearning\/chapter-6-getting-started-with-linear-regression-in-r\/#primaryimage\"},\"thumbnailUrl\":\"https:\/\/www.gologica.com\/elearning\/wp-content\/uploads\/2022\/11\/Linear-Regression-In-R.jpg\",\"keywords\":[\"Data Science\",\"data science online training\"],\"articleSection\":[\"Data Science &amp; Business Analytics\",\"Sidebar Chapters\"],\"inLanguage\":\"en-US\"},{\"@type\":\"WebPage\",\"@id\":\"https:\/\/www.gologica.com\/elearning\/chapter-6-getting-started-with-linear-regression-in-r\/\",\"url\":\"https:\/\/www.gologica.com\/elearning\/chapter-6-getting-started-with-linear-regression-in-r\/\",\"name\":\"Chapter 6: Getting Started With Linear Regression In R\",\"isPartOf\":{\"@id\":\"https:\/\/www.gologica.com\/elearning\/#website\"},\"primaryImageOfPage\":{\"@id\":\"https:\/\/www.gologica.com\/elearning\/chapter-6-getting-started-with-linear-regression-in-r\/#primaryimage\"},\"image\":{\"@id\":\"https:\/\/www.gologica.com\/elearning\/chapter-6-getting-started-with-linear-regression-in-r\/#primaryimage\"},\"thumbnailUrl\":\"https:\/\/www.gologica.com\/elearning\/wp-content\/uploads\/2022\/11\/Linear-Regression-In-R.jpg\",\"datePublished\":\"2022-11-01T13:30:55+00:00\",\"dateModified\":\"2025-04-09T07:25:54+00:00\",\"author\":{\"@id\":\"https:\/\/www.gologica.com\/elearning\/#\/schema\/person\/1aec1e5a8488bc2738614b12e01f52b0\"},\"description\":\"Data science Online Training help you ace information investigation with R. You will pick up ability in Data Modeling and machine learning calculations.\",\"breadcrumb\":{\"@id\":\"https:\/\/www.gologica.com\/elearning\/chapter-6-getting-started-with-linear-regression-in-r\/#breadcrumb\"},\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\/\/www.gologica.com\/elearning\/chapter-6-getting-started-with-linear-regression-in-r\/\"]}]},{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\/\/www.gologica.com\/elearning\/chapter-6-getting-started-with-linear-regression-in-r\/#primaryimage\",\"url\":\"https:\/\/www.gologica.com\/elearning\/wp-content\/uploads\/2022\/11\/Linear-Regression-In-R.jpg\",\"contentUrl\":\"https:\/\/www.gologica.com\/elearning\/wp-content\/uploads\/2022\/11\/Linear-Regression-In-R.jpg\",\"width\":300,\"height\":175},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\/\/www.gologica.com\/elearning\/chapter-6-getting-started-with-linear-regression-in-r\/#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"Home\",\"item\":\"https:\/\/www.gologica.com\/elearning\/\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"Chapter 6: Getting Started With Linear Regression In R\"}]},{\"@type\":\"WebSite\",\"@id\":\"https:\/\/www.gologica.com\/elearning\/#website\",\"url\":\"https:\/\/www.gologica.com\/elearning\/\",\"name\":\"GoLogica\",\"description\":\"E-Learning Portal\",\"potentialAction\":[{\"@type\":\"SearchAction\",\"target\":{\"@type\":\"EntryPoint\",\"urlTemplate\":\"https:\/\/www.gologica.com\/elearning\/?s={search_term_string}\"},\"query-input\":{\"@type\":\"PropertyValueSpecification\",\"valueRequired\":true,\"valueName\":\"search_term_string\"}}],\"inLanguage\":\"en-US\"},{\"@type\":\"Person\",\"@id\":\"https:\/\/www.gologica.com\/elearning\/#\/schema\/person\/1aec1e5a8488bc2738614b12e01f52b0\",\"name\":\"Mounika P\",\"image\":{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\/\/www.gologica.com\/elearning\/#\/schema\/person\/image\/d0ab308492a1bfcbec1a1ce1637996db\",\"url\":\"https:\/\/www.gologica.com\/elearning\/wp-content\/themes\/wplms\/assets\/images\/avatar.jpg\",\"contentUrl\":\"https:\/\/www.gologica.com\/elearning\/wp-content\/themes\/wplms\/assets\/images\/avatar.jpg\",\"caption\":\"Mounika P\"},\"url\":\"https:\/\/www.gologica.com\/elearning\/author\/mounika\/\"}]}<\/script>\n<!-- \/ Yoast SEO plugin. -->","yoast_head_json":{"title":"Chapter 6: Getting Started With Linear Regression In R","description":"Data science Online Training help you ace information investigation with R. You will pick up ability in Data Modeling and machine learning calculations.","robots":{"index":"index","follow":"follow","max-snippet":"max-snippet:-1","max-image-preview":"max-image-preview:large","max-video-preview":"max-video-preview:-1"},"canonical":"https:\/\/www.gologica.com\/elearning\/chapter-6-getting-started-with-linear-regression-in-r\/","og_locale":"en_US","og_type":"article","og_title":"Chapter 6: Getting Started With Linear Regression In R","og_description":"Data science Online Training help you ace information investigation with R. You will pick up ability in Data Modeling and machine learning calculations.","og_url":"https:\/\/www.gologica.com\/elearning\/chapter-6-getting-started-with-linear-regression-in-r\/","og_site_name":"GoLogica","article_published_time":"2022-11-01T13:30:55+00:00","article_modified_time":"2025-04-09T07:25:54+00:00","og_image":[{"width":300,"height":175,"url":"https:\/\/www.gologica.com\/elearning\/wp-content\/uploads\/2022\/11\/Linear-Regression-In-R.jpg","type":"image\/jpeg"}],"author":"Mounika P","twitter_card":"summary_large_image","twitter_misc":{"Written by":"Mounika P","Est. reading time":"7 minutes"},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"Article","@id":"https:\/\/www.gologica.com\/elearning\/chapter-6-getting-started-with-linear-regression-in-r\/#article","isPartOf":{"@id":"https:\/\/www.gologica.com\/elearning\/chapter-6-getting-started-with-linear-regression-in-r\/"},"author":{"name":"Mounika P","@id":"https:\/\/www.gologica.com\/elearning\/#\/schema\/person\/1aec1e5a8488bc2738614b12e01f52b0"},"headline":"Chapter 6: Getting Started With Linear Regression In R","datePublished":"2022-11-01T13:30:55+00:00","dateModified":"2025-04-09T07:25:54+00:00","mainEntityOfPage":{"@id":"https:\/\/www.gologica.com\/elearning\/chapter-6-getting-started-with-linear-regression-in-r\/"},"wordCount":1535,"image":{"@id":"https:\/\/www.gologica.com\/elearning\/chapter-6-getting-started-with-linear-regression-in-r\/#primaryimage"},"thumbnailUrl":"https:\/\/www.gologica.com\/elearning\/wp-content\/uploads\/2022\/11\/Linear-Regression-In-R.jpg","keywords":["Data Science","data science online training"],"articleSection":["Data Science &amp; Business Analytics","Sidebar Chapters"],"inLanguage":"en-US"},{"@type":"WebPage","@id":"https:\/\/www.gologica.com\/elearning\/chapter-6-getting-started-with-linear-regression-in-r\/","url":"https:\/\/www.gologica.com\/elearning\/chapter-6-getting-started-with-linear-regression-in-r\/","name":"Chapter 6: Getting Started With Linear Regression In R","isPartOf":{"@id":"https:\/\/www.gologica.com\/elearning\/#website"},"primaryImageOfPage":{"@id":"https:\/\/www.gologica.com\/elearning\/chapter-6-getting-started-with-linear-regression-in-r\/#primaryimage"},"image":{"@id":"https:\/\/www.gologica.com\/elearning\/chapter-6-getting-started-with-linear-regression-in-r\/#primaryimage"},"thumbnailUrl":"https:\/\/www.gologica.com\/elearning\/wp-content\/uploads\/2022\/11\/Linear-Regression-In-R.jpg","datePublished":"2022-11-01T13:30:55+00:00","dateModified":"2025-04-09T07:25:54+00:00","author":{"@id":"https:\/\/www.gologica.com\/elearning\/#\/schema\/person\/1aec1e5a8488bc2738614b12e01f52b0"},"description":"Data science Online Training help you ace information investigation with R. You will pick up ability in Data Modeling and machine learning calculations.","breadcrumb":{"@id":"https:\/\/www.gologica.com\/elearning\/chapter-6-getting-started-with-linear-regression-in-r\/#breadcrumb"},"inLanguage":"en-US","potentialAction":[{"@type":"ReadAction","target":["https:\/\/www.gologica.com\/elearning\/chapter-6-getting-started-with-linear-regression-in-r\/"]}]},{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/www.gologica.com\/elearning\/chapter-6-getting-started-with-linear-regression-in-r\/#primaryimage","url":"https:\/\/www.gologica.com\/elearning\/wp-content\/uploads\/2022\/11\/Linear-Regression-In-R.jpg","contentUrl":"https:\/\/www.gologica.com\/elearning\/wp-content\/uploads\/2022\/11\/Linear-Regression-In-R.jpg","width":300,"height":175},{"@type":"BreadcrumbList","@id":"https:\/\/www.gologica.com\/elearning\/chapter-6-getting-started-with-linear-regression-in-r\/#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"Home","item":"https:\/\/www.gologica.com\/elearning\/"},{"@type":"ListItem","position":2,"name":"Chapter 6: Getting Started With Linear Regression In R"}]},{"@type":"WebSite","@id":"https:\/\/www.gologica.com\/elearning\/#website","url":"https:\/\/www.gologica.com\/elearning\/","name":"GoLogica","description":"E-Learning Portal","potentialAction":[{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https:\/\/www.gologica.com\/elearning\/?s={search_term_string}"},"query-input":{"@type":"PropertyValueSpecification","valueRequired":true,"valueName":"search_term_string"}}],"inLanguage":"en-US"},{"@type":"Person","@id":"https:\/\/www.gologica.com\/elearning\/#\/schema\/person\/1aec1e5a8488bc2738614b12e01f52b0","name":"Mounika P","image":{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/www.gologica.com\/elearning\/#\/schema\/person\/image\/d0ab308492a1bfcbec1a1ce1637996db","url":"https:\/\/www.gologica.com\/elearning\/wp-content\/themes\/wplms\/assets\/images\/avatar.jpg","contentUrl":"https:\/\/www.gologica.com\/elearning\/wp-content\/themes\/wplms\/assets\/images\/avatar.jpg","caption":"Mounika P"},"url":"https:\/\/www.gologica.com\/elearning\/author\/mounika\/"}]}},"_links":{"self":[{"href":"https:\/\/www.gologica.com\/elearning\/wp-json\/wp\/v2\/posts\/9297","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.gologica.com\/elearning\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.gologica.com\/elearning\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.gologica.com\/elearning\/wp-json\/wp\/v2\/users\/19758"}],"replies":[{"embeddable":true,"href":"https:\/\/www.gologica.com\/elearning\/wp-json\/wp\/v2\/comments?post=9297"}],"version-history":[{"count":9,"href":"https:\/\/www.gologica.com\/elearning\/wp-json\/wp\/v2\/posts\/9297\/revisions"}],"predecessor-version":[{"id":66909,"href":"https:\/\/www.gologica.com\/elearning\/wp-json\/wp\/v2\/posts\/9297\/revisions\/66909"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/www.gologica.com\/elearning\/wp-json\/wp\/v2\/media\/9298"}],"wp:attachment":[{"href":"https:\/\/www.gologica.com\/elearning\/wp-json\/wp\/v2\/media?parent=9297"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.gologica.com\/elearning\/wp-json\/wp\/v2\/categories?post=9297"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.gologica.com\/elearning\/wp-json\/wp\/v2\/tags?post=9297"},{"taxonomy":"author","embeddable":true,"href":"https:\/\/www.gologica.com\/elearning\/wp-json\/wp\/v2\/coauthors?post=9297"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}