{"id":2592,"date":"2026-11-04T16:48:12","date_gmt":"2026-11-04T16:48:12","guid":{"rendered":"https:\/\/prwatech.in\/blog\/?p=2592"},"modified":"2026-11-05T16:13:45","modified_gmt":"2026-11-05T16:13:45","slug":"co-efficient-of-determination-tutorial","status":"publish","type":"post","link":"https:\/\/prwatech.in\/blog\/data-science\/data-science-modules\/co-efficient-of-determination-tutorial\/","title":{"rendered":"Coefficient of Determination"},"content":{"rendered":"<h1><strong><b>Coefficient of Determination (R Squared): Definition, Formula and Examples<\/b><\/strong><\/h1>\n<p style=\"font-family: Arial,Helvetica,sans-serif; font-size: 17px; line-height: 1.7; color: #1f2937; margin: 0 0 16px;\">You fit a model that predicts exam scores from hours studied. It gives an answer for every student. But how good is it? One number is used most often to answer that: the coefficient of determination, written R squared. A value of 0.94 means the model explains 94 percent of the ups and downs in scores.<\/p>\n<p style=\"font-family: Arial,Helvetica,sans-serif; font-size: 17px; line-height: 1.7; color: #1f2937; margin: 0 0 16px;\">R squared sits at the heart of regression. It is the first number most reports show and the first one that gets misused. People treat a high value as proof that the model is right, or a low value as proof that it is useless. Neither is true and this tutorial shows why.<\/p>\n<p style=\"font-family: Arial,Helvetica,sans-serif; font-size: 17px; line-height: 1.7; color: #1f2937; margin: 0 0 16px;\">You will learn what R squared means, its formula in plain steps, a fully worked example, how it links to correlation, what a good value looks like, adjusted R squared, the cases where R squared can be negative, and how to calculate it in Python.<\/p>\n<h2 style=\"font-family: Arial,Helvetica,sans-serif; font-size: 26px; line-height: 1.3; font-weight: bold; color: #0f2a4a; margin: 36px 0 12px;\">Coefficient of Determination Definition<\/h2>\n<p style=\"font-family: Arial,Helvetica,sans-serif; font-size: 17px; line-height: 1.7; color: #1f2937; margin: 0 0 16px;\">The coefficient of determination is a statistic that tells you what share of the variation in the outcome is explained by the model. It is written R squared (R2). It is also called a goodness of fit measure.<\/p>\n<p style=\"font-family: Arial,Helvetica,sans-serif; font-size: 17px; line-height: 1.7; color: #1f2937; margin: 0 0 16px;\">An R squared of 0.50 means that about half of the observed variation in the outcome is explained by the model. The rest is left unexplained, because of other factors or random noise.<\/p>\n<div style=\"margin: 16px 0 24px;\"><img decoding=\"async\" style=\"display: block; max-width: 100%; height: auto; border: 1px solid #d9e0ea; border-radius: 8px;\" src=\"https:\/\/prwatech.in\/blog\/wp-content\/uploads\/2019\/07\/Co-efficient-of-Determination.jpg\" alt=\"Coefficient of determination as the share of variation explained by the model\" \/><\/div>\n<h2 style=\"font-family: Arial,Helvetica,sans-serif; font-size: 26px; line-height: 1.3; font-weight: bold; color: #0f2a4a; margin: 36px 0 12px;\">Why do We Need the Coefficient of Determination?<\/h2>\n<ul style=\"font-family: Arial,Helvetica,sans-serif; margin: 0 0 16px; padding-left: 24px; font-size: 17px; line-height: 1.7; color: #1f2937;\">\n<li style=\"margin: 0 0 8px;\">To judge fit. It shows how closely the model follows the data.<\/li>\n<li style=\"margin: 0 0 8px;\">To compare models on the same data and the same outcome.<\/li>\n<li style=\"margin: 0 0 8px;\">To explain results in simple words: this model explains 94 percent of the variation.<\/li>\n<li style=\"margin: 0 0 8px;\">To track trends. Analysts use it to see how strongly one factor moves with another.<\/li>\n<\/ul>\n<p style=\"font-family: Arial,Helvetica,sans-serif; font-size: 17px; line-height: 1.7; color: #1f2937; margin: 0 0 16px;\">In a simple linear model, R squared equals the square of the correlation coefficient r. If r is 0.97, then R squared is 0.94. A value of 1 is a perfect fit. A value of 0 means that the model does no better than predicting the average every time.<\/p>\n<p style=\"font-family: Arial,Helvetica,sans-serif; font-size: 17px; line-height: 1.7; color: #1f2937; margin: 0 0 16px;\">Important: R squared shows association, not cause. The live page says it shows how much variability in one factor another can cause. A model with a high R squared does not show that one thing causes the other.<\/p>\n<h2 style=\"font-family: Arial,Helvetica,sans-serif; font-size: 26px; line-height: 1.3; font-weight: bold; color: #0f2a4a; margin: 36px 0 12px;\">Coefficient of Determination Formula<\/h2>\n<div style=\"margin: 16px 0 24px;\"><img decoding=\"async\" style=\"display: block; max-width: 100%; height: auto; border: 1px solid #d9e0ea; border-radius: 8px;\" src=\"https:\/\/prwatech.in\/blog\/wp-content\/uploads\/2019\/07\/Co-efficient-of-Determination1-1024x412.jpg\" alt=\"Coefficient of determination formula with SS residual and SS total\" \/><\/div>\n<div style=\"background: #f5f8fc; border-left: 4px solid #0f2a4a; border-radius: 4px; padding: 14px 18px; margin: 16px 0 8px; font-family: Arial,Helvetica,sans-serif; font-size: 17px; line-height: 1.7; color: #0f2a4a; font-weight: bold;\">R squared = 1 minus (SS residual divided by SS total)<\/div>\n<ul style=\"font-family: Arial,Helvetica,sans-serif; margin: 0 0 16px; padding-left: 24px; font-size: 17px; line-height: 1.7; color: #1f2937;\">\n<li style=\"margin: 0 0 8px;\">SS residual is the sum of squared errors: add up (actual value minus predicted value) squared, for all points. It is the variation the model fails to explain.<\/li>\n<li style=\"margin: 0 0 8px;\">SS total is the sum of (actual value minus the mean of the actual values) squared. It is the total variation in the outcome.<\/li>\n<\/ul>\n<p style=\"font-family: Arial,Helvetica,sans-serif; font-size: 17px; line-height: 1.7; color: #1f2937; margin: 0 0 16px;\">The fraction SS residual divided by SS total is the share left unexplained. Subtract it from 1 and you get the share explained.<\/p>\n<p style=\"font-family: Arial,Helvetica,sans-serif; font-size: 17px; line-height: 1.7; color: #1f2937; margin: 0 0 16px;\">For simple linear regression, there is a shortcut: R squared = r times r.<\/p>\n<h2 style=\"font-family: Arial,Helvetica,sans-serif; font-size: 26px; line-height: 1.3; font-weight: bold; color: #0f2a4a; margin: 36px 0 12px;\">Coefficient of Determination Example<\/h2>\n<div style=\"margin: 16px 0 24px;\"><img decoding=\"async\" style=\"display: block; max-width: 100%; height: auto; border: 1px solid #d9e0ea; border-radius: 8px;\" src=\"https:\/\/prwatech.in\/blog\/wp-content\/uploads\/2019\/07\/Co-efficient-of-Determination2.jpg\" alt=\"Coefficient of determination worked example with a fitted line\" \/><\/div>\n<p style=\"font-family: Arial,Helvetica,sans-serif; font-size: 17px; line-height: 1.7; color: #1f2937; margin: 0 0 16px;\">Eight students study 1 to 8 hours and score 52, 55, 61, 60, 68, 72, 70 and 79. The data are made up for teaching.<\/p>\n<ol style=\"font-family: Arial,Helvetica,sans-serif; margin: 0 0 16px; padding-left: 28px; font-size: 17px; line-height: 1.7; color: #1f2937;\">\n<li style=\"margin: 0 0 8px;\">Fit the line. Least squares gives: score = 48.286 + 3.631 times hours.<\/li>\n<li style=\"margin: 0 0 8px;\">Find SS total. The scores vary around their mean, and the sum of squared differences is 587.88.<\/li>\n<li style=\"margin: 0 0 8px;\">Find SS residual. The sum of squared gaps between the actual and predicted scores is 34.15.<\/li>\n<li style=\"margin: 0 0 8px;\">Apply the formula. R squared = 1 minus 34.15 divided by 587.88 = 0.9419.<\/li>\n<li style=\"margin: 0 0 8px;\">Check with correlation. The correlation r is 0.9705, and 0.9705 squared is 0.9419. The two agree.<\/li>\n<\/ol>\n<p style=\"font-family: Arial,Helvetica,sans-serif; font-size: 17px; line-height: 1.7; color: #1f2937; margin: 0 0 16px;\">Meaning: hours studied explain about 94 percent of the variation in scores. The other 6 percent comes from things the model does not know, such as sleep, past knowledge or luck.<\/p>\n<h2 style=\"font-family: Arial,Helvetica,sans-serif; font-size: 26px; line-height: 1.3; font-weight: bold; color: #0f2a4a; margin: 36px 0 12px;\">What is a Good R Squared?<\/h2>\n<p style=\"font-family: Arial,Helvetica,sans-serif; font-size: 17px; line-height: 1.7; color: #1f2937; margin: 0 0 16px;\">There is no single answer. It depends on the field and on the goal.<\/p>\n<div style=\"border: 1px solid #d9e0ea; border-radius: 8px; overflow-x: auto; margin: 20px 0; -webkit-overflow-scrolling: touch;\">\n<table style=\"width: 100%; min-width: 760px; border-collapse: collapse; font-family: Arial,Helvetica,sans-serif; font-size: 16px; line-height: 1.6; color: #1f2937;\">\n<caption style=\"caption-side: top; text-align: left; padding: 14px 16px; font-weight: bold; font-size: 17px; color: #0f2a4a;\">What to expect from R squared in different fields<\/caption>\n<thead>\n<tr>\n<th style=\"background: #0f2a4a; color: #ffffff; text-align: left; padding: 12px 16px; border-bottom: 2px solid #0b1f38; width: 300px;\" scope=\"col\">Situation<\/th>\n<th style=\"background: #0f2a4a; color: #ffffff; text-align: left; padding: 12px 16px; border-bottom: 2px solid #0b1f38;\" scope=\"col\">What to expect<\/th>\n<\/tr>\n<\/thead>\n<tbody>\n<tr style=\"background: #ffffff;\">\n<th style=\"text-align: left; padding: 12px 16px; border-bottom: 1px solid #e5e9f0; color: #0f2a4a; vertical-align: top;\" scope=\"row\">Physics or lab measurement<\/th>\n<td style=\"padding: 12px 16px; border-bottom: 1px solid #e5e9f0; vertical-align: top;\">Very high, often above 0.95<\/td>\n<\/tr>\n<tr style=\"background: #f5f8fc;\">\n<th style=\"text-align: left; padding: 12px 16px; border-bottom: 1px solid #e5e9f0; color: #0f2a4a; vertical-align: top;\" scope=\"row\">Business forecasting<\/th>\n<td style=\"padding: 12px 16px; border-bottom: 1px solid #e5e9f0; vertical-align: top;\">Moderate values can still be useful<\/td>\n<\/tr>\n<tr style=\"background: #ffffff;\">\n<th style=\"text-align: left; padding: 12px 16px; color: #0f2a4a; vertical-align: top;\" scope=\"row\">Human behaviour, social data<\/th>\n<td style=\"padding: 12px 16px; vertical-align: top;\">Low values, such as 0.2 or 0.3, are common<\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n<\/div>\n<p style=\"font-family: Arial,Helvetica,sans-serif; font-size: 17px; line-height: 1.7; color: #1f2937; margin: 0 0 16px;\">A high R squared can still go with a bad model. It can come from overfitting, a model that matches the noise in the training data. A low R squared can go with a useful model, when the effect is real but the data are noisy. Always look at residual plots, and test on new data.<\/p>\n<h2 style=\"font-family: Arial,Helvetica,sans-serif; font-size: 26px; line-height: 1.3; font-weight: bold; color: #0f2a4a; margin: 36px 0 12px;\">Adjusted R Squared<\/h2>\n<p style=\"font-family: Arial,Helvetica,sans-serif; font-size: 17px; line-height: 1.7; color: #1f2937; margin: 0 0 16px;\">On the training data, R squared never goes down when you add a predictor, even a useless one. So it can reward a model for being bigger, not better. Adjusted R squared corrects for this with a penalty for the number of predictors. Use it when you compare models with different numbers of predictors.<\/p>\n<p style=\"font-family: Arial,Helvetica,sans-serif; font-size: 17px; line-height: 1.7; color: #1f2937; margin: 0 0 16px;\">Adjusted R squared = 1 minus (1 minus R squared) times (n minus 1) divided by (n minus k minus 1), where n is the number of observations and k is the number of predictors. In the example, n is 8 and k is 1, which gives 0.9322.<\/p>\n<h2 style=\"font-family: Arial,Helvetica,sans-serif; font-size: 26px; line-height: 1.3; font-weight: bold; color: #0f2a4a; margin: 36px 0 12px;\">Can R Squared Be Negative?<\/h2>\n<p style=\"font-family: Arial,Helvetica,sans-serif; font-size: 17px; line-height: 1.7; color: #1f2937; margin: 0 0 16px;\">The live page says that R squared lies between 0 and 1. For a least squares line tested on the data it was fitted to, that is true. But when a model is scored on new data, or when it is not fitted by least squares, SS residual can be larger than SS total, and R squared becomes negative. It means the model is worse than simply predicting the average. In the code below, a model that always predicts 40 for these scores gets R squared of minus 8.25.<\/p>\n<h2 style=\"font-family: Arial,Helvetica,sans-serif; font-size: 26px; line-height: 1.3; font-weight: bold; color: #0f2a4a; margin: 36px 0 12px;\">Calculate R Squared in Python<\/h2>\n<p style=\"font-family: Arial,Helvetica,sans-serif; font-size: 17px; line-height: 1.7; color: #1f2937; margin: 0 0 16px;\">I ran the code below, and the output is real.<\/p>\n<div style=\"margin: 20px 0; border: 1px solid #d9e0ea; border-radius: 8px; overflow: hidden;\">\n<div style=\"background: #0f2a4a; color: #ffffff; font-family: Arial,Helvetica,sans-serif; font-size: 14px; font-weight: bold; padding: 8px 16px;\">python<\/div>\n<pre style=\"margin: 0; padding: 16px; color: #1f2937; font-family: 'Courier New',Courier,monospace; font-size: 14px; line-height: 1.7; overflow-x: auto; white-space: pre; background: #f5f8fc;\">import numpy as np\r\nfrom sklearn.linear_model import LinearRegression\r\nfrom sklearn.metrics import r2_score\r\n\r\n# Hours studied vs exam score (made up), 8 students\r\nx = np.array([1, 2, 3, 4, 5, 6, 7, 8])\r\ny = np.array([52, 55, 61, 60, 68, 72, 70, 79])\r\n\r\nm = LinearRegression().fit(x.reshape(-1, 1), y)\r\npred = m.predict(x.reshape(-1, 1))\r\nss_res = float(((y - pred) ** 2).sum())\r\nss_tot = float(((y - y.mean()) ** 2).sum())\r\nprint(\"Slope:\", round(float(m.coef_[0]), 3), \" Intercept:\", round(float(m.intercept_), 3))\r\nprint(\"SS_res:\", round(ss_res, 2), \" SS_tot:\", round(ss_tot, 2))\r\nprint(\"R2 by formula:\", round(1 - ss_res \/ ss_tot, 4))\r\nprint(\"R2 by sklearn:\", round(r2_score(y, pred), 4))\r\nr = np.corrcoef(x, y)[0, 1]\r\nprint(\"Correlation r:\", round(float(r), 4), \" r squared:\", round(float(r ** 2), 4))\r\n\r\n# Adjusted R2 with k = 1 predictor\r\nn, k = len(y), 1\r\nprint(\"Adjusted R2:\", round(1 - (1 - r2_score(y, pred)) * (n - 1) \/ (n - k - 1), 4))\r\n\r\n# Predicting the mean only gives R2 = 0\r\nprint(\"R2 of always predicting the mean:\", round(r2_score(y, np.full(8, y.mean())), 4))\r\n\r\n# A bad model can give a negative R2\r\nprint(\"R2 of a bad model:\", round(r2_score(y, np.full(8, 40.0)), 2))<\/pre>\n<div style=\"background: #1f2937; color: #ffffff; font-family: Arial,Helvetica,sans-serif; font-size: 14px; font-weight: bold; padding: 8px 16px;\">output<\/div>\n<pre style=\"margin: 0; padding: 16px; color: #1f2937; font-family: 'Courier New',Courier,monospace; font-size: 14px; line-height: 1.7; overflow-x: auto; white-space: pre; background: #ffffff;\">Slope: 3.631  Intercept: 48.286\r\nSS_res: 34.15  SS_tot: 587.88\r\nR2 by formula: 0.9419\r\nR2 by sklearn: 0.9419\r\nCorrelation r: 0.9705  r squared: 0.9419\r\nAdjusted R2: 0.9322\r\nR2 of always predicting the mean: 0.0\r\nR2 of a bad model: -8.25<\/pre>\n<\/div>\n<h2 style=\"font-family: Arial,Helvetica,sans-serif; font-size: 26px; line-height: 1.3; font-weight: bold; color: #0f2a4a; margin: 36px 0 12px;\">Common Mistakes to Avoid<\/h2>\n<div style=\"border: 1px solid #d9e0ea; border-radius: 8px; overflow-x: auto; margin: 20px 0; -webkit-overflow-scrolling: touch;\">\n<table style=\"width: 100%; min-width: 760px; border-collapse: collapse; font-family: Arial,Helvetica,sans-serif; font-size: 16px; line-height: 1.6; color: #1f2937;\">\n<caption style=\"caption-side: top; text-align: left; padding: 14px 16px; font-weight: bold; font-size: 17px; color: #0f2a4a;\">Common mistakes and fixes<\/caption>\n<thead>\n<tr>\n<th style=\"background: #0f2a4a; color: #ffffff; text-align: left; padding: 12px 16px; border-bottom: 2px solid #0b1f38; width: 420px;\" scope=\"col\">Mistake<\/th>\n<th style=\"background: #0f2a4a; color: #ffffff; text-align: left; padding: 12px 16px; border-bottom: 2px solid #0b1f38;\" scope=\"col\">Fix<\/th>\n<\/tr>\n<\/thead>\n<tbody>\n<tr style=\"background: #ffffff;\">\n<th style=\"text-align: left; padding: 12px 16px; border-bottom: 1px solid #e5e9f0; color: #0f2a4a; vertical-align: top;\" scope=\"row\">Treating a high R squared as proof of cause<\/th>\n<td style=\"padding: 12px 16px; border-bottom: 1px solid #e5e9f0; vertical-align: top;\">R squared shows association only<\/td>\n<\/tr>\n<tr style=\"background: #f5f8fc;\">\n<th style=\"text-align: left; padding: 12px 16px; border-bottom: 1px solid #e5e9f0; color: #0f2a4a; vertical-align: top;\" scope=\"row\">Calling R squared accuracy<\/th>\n<td style=\"padding: 12px 16px; border-bottom: 1px solid #e5e9f0; vertical-align: top;\">It measures fit to the data<\/td>\n<\/tr>\n<tr style=\"background: #ffffff;\">\n<th style=\"text-align: left; padding: 12px 16px; border-bottom: 1px solid #e5e9f0; color: #0f2a4a; vertical-align: top;\" scope=\"row\">Saying it must be between 0 and 1<\/th>\n<td style=\"padding: 12px 16px; border-bottom: 1px solid #e5e9f0; vertical-align: top;\">It can be negative on new data or for a poor model<\/td>\n<\/tr>\n<tr style=\"background: #f5f8fc;\">\n<th style=\"text-align: left; padding: 12px 16px; border-bottom: 1px solid #e5e9f0; color: #0f2a4a; vertical-align: top;\" scope=\"row\">Adding predictors only to raise R squared<\/th>\n<td style=\"padding: 12px 16px; border-bottom: 1px solid #e5e9f0; vertical-align: top;\">Use adjusted R squared, and test on new data<\/td>\n<\/tr>\n<tr style=\"background: #ffffff;\">\n<th style=\"text-align: left; padding: 12px 16px; border-bottom: 1px solid #e5e9f0; color: #0f2a4a; vertical-align: top;\" scope=\"row\">Judging a model by R squared alone<\/th>\n<td style=\"padding: 12px 16px; border-bottom: 1px solid #e5e9f0; vertical-align: top;\">Check residual plots and errors such as RMSE<\/td>\n<\/tr>\n<tr style=\"background: #f5f8fc;\">\n<th style=\"text-align: left; padding: 12px 16px; border-bottom: 1px solid #e5e9f0; color: #0f2a4a; vertical-align: top;\" scope=\"row\">Comparing R squared across different outcomes<\/th>\n<td style=\"padding: 12px 16px; border-bottom: 1px solid #e5e9f0; vertical-align: top;\">Compare only models for the same outcome<\/td>\n<\/tr>\n<tr style=\"background: #ffffff;\">\n<th style=\"text-align: left; padding: 12px 16px; color: #0f2a4a; vertical-align: top;\" scope=\"row\">Using it for a curved relationship with a straight line<\/th>\n<td style=\"padding: 12px 16px; vertical-align: top;\">Plot the data first<\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n<\/div>\n<h2 style=\"font-family: Arial,Helvetica,sans-serif; font-size: 26px; line-height: 1.3; font-weight: bold; color: #0f2a4a; margin: 36px 0 12px;\">Practice Questions<\/h2>\n<ol style=\"font-family: Arial,Helvetica,sans-serif; margin: 0 0 16px; padding-left: 28px; font-size: 17px; line-height: 1.7; color: #1f2937;\">\n<li style=\"margin: 0 0 8px;\">SS residual is 20 and SS total is 80. What is R squared?<\/li>\n<li style=\"margin: 0 0 8px;\">The correlation between two variables is 0.8 in a simple linear model. What is R squared?<\/li>\n<li style=\"margin: 0 0 8px;\">A model has R squared of 0.62. What share of the variation is unexplained?<\/li>\n<li style=\"margin: 0 0 8px;\">Can R squared be negative? When?<\/li>\n<\/ol>\n<p style=\"font-family: Arial,Helvetica,sans-serif; font-size: 17px; line-height: 1.7; color: #1f2937; margin: 0 0 16px;\">Answers: 1) 1 minus 20 divided by 80 = 0.75. 2) 0.8 times 0.8 = 0.64. 3) 38 percent. 4) Yes, when a model fits worse than the mean, for example on new data. These are my own answers, so please recheck them before publishing.<\/p>\n<p>R squared is a useful first look at a model, not a verdict. Read it as the share of variation explained, pair it with residual checks and new data, and never use it alone to claim that one thing causes another.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>Coefficient of Determination (R Squared): Definition, Formula and Examples You fit a model that predicts exam scores from hours studied. It gives an answer for every student. But how good is it? One number is used most often to answer that: the coefficient of determination, written R squared. A value of 0.94 means the model [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"closed","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[26,1704],"tags":[212,213,216,214,215],"class_list":["post-2592","post","type-post","status-publish","format-standard","hentry","category-data-science","category-data-science-modules","tag-co-efficient-of-determination-tutorial","tag-coefficient-of-determination-definition","tag-coefficient-of-determination-example","tag-coefficient-of-determination-formula","tag-coefficient-of-determination-in-data-science"],"acf":[],"yoast_head":"<!-- This site is optimized with the Yoast SEO plugin v25.7 - https:\/\/yoast.com\/wordpress\/plugins\/seo\/ -->\n<title>Coefficient of Determination: R Squared Formula and Examples<\/title>\n<meta name=\"description\" content=\"Learn the coefficient of determination: R squared meaning, formula, a worked example, adjusted R squared, negative R squared and Python code.\" \/>\n<meta name=\"robots\" content=\"index, follow, max-snippet:-1, max-image-preview:large, max-video-preview:-1\" \/>\n<link rel=\"canonical\" href=\"https:\/\/prwatech.in\/blog\/data-science\/data-science-modules\/co-efficient-of-determination-tutorial\/\" \/>\n<meta property=\"og:locale\" content=\"en_US\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"Coefficient of Determination: R Squared Formula and Examples\" \/>\n<meta property=\"og:description\" content=\"Learn the coefficient of determination: R squared meaning, formula, a worked example, adjusted R squared, negative R squared and Python code.\" \/>\n<meta property=\"og:url\" content=\"https:\/\/prwatech.in\/blog\/data-science\/data-science-modules\/co-efficient-of-determination-tutorial\/\" \/>\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=\"2026-11-04T16:48:12+00:00\" \/>\n<meta property=\"article:modified_time\" content=\"2026-11-05T16:13:45+00:00\" \/>\n<meta property=\"og:image\" content=\"https:\/\/prwatech.in\/blog\/wp-content\/uploads\/2019\/07\/Co-efficient-of-Determination.jpg\" \/>\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=\"6 minutes\" \/>\n<script type=\"application\/ld+json\" class=\"yoast-schema-graph\">{\"@context\":\"https:\/\/schema.org\",\"@graph\":[{\"@type\":\"WebPage\",\"@id\":\"https:\/\/prwatech.in\/blog\/data-science\/data-science-modules\/co-efficient-of-determination-tutorial\/\",\"url\":\"https:\/\/prwatech.in\/blog\/data-science\/data-science-modules\/co-efficient-of-determination-tutorial\/\",\"name\":\"Coefficient of Determination: R Squared Formula and Examples\",\"isPartOf\":{\"@id\":\"https:\/\/prwatech.in\/blog\/#website\"},\"primaryImageOfPage\":{\"@id\":\"https:\/\/prwatech.in\/blog\/data-science\/data-science-modules\/co-efficient-of-determination-tutorial\/#primaryimage\"},\"image\":{\"@id\":\"https:\/\/prwatech.in\/blog\/data-science\/data-science-modules\/co-efficient-of-determination-tutorial\/#primaryimage\"},\"thumbnailUrl\":\"https:\/\/prwatech.in\/blog\/wp-content\/uploads\/2019\/07\/Co-efficient-of-Determination.jpg\",\"datePublished\":\"2026-11-04T16:48:12+00:00\",\"dateModified\":\"2026-11-05T16:13:45+00:00\",\"author\":{\"@id\":\"https:\/\/prwatech.in\/blog\/#\/schema\/person\/db90baff7744090b2288bbc98fea87f3\"},\"description\":\"Learn the coefficient of determination: R squared meaning, formula, a worked example, adjusted R squared, negative R squared and Python code.\",\"breadcrumb\":{\"@id\":\"https:\/\/prwatech.in\/blog\/data-science\/data-science-modules\/co-efficient-of-determination-tutorial\/#breadcrumb\"},\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\/\/prwatech.in\/blog\/data-science\/data-science-modules\/co-efficient-of-determination-tutorial\/\"]}]},{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\/\/prwatech.in\/blog\/data-science\/data-science-modules\/co-efficient-of-determination-tutorial\/#primaryimage\",\"url\":\"https:\/\/prwatech.in\/blog\/wp-content\/uploads\/2019\/07\/Co-efficient-of-Determination.jpg\",\"contentUrl\":\"https:\/\/prwatech.in\/blog\/wp-content\/uploads\/2019\/07\/Co-efficient-of-Determination.jpg\",\"width\":634,\"height\":483},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\/\/prwatech.in\/blog\/data-science\/data-science-modules\/co-efficient-of-determination-tutorial\/#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"Home\",\"item\":\"https:\/\/prwatech.in\/blog\/\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"Coefficient of Determination\"}]},{\"@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":"Coefficient of Determination: R Squared Formula and Examples","description":"Learn the coefficient of determination: R squared meaning, formula, a worked example, adjusted R squared, negative R squared and Python code.","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:\/\/prwatech.in\/blog\/data-science\/data-science-modules\/co-efficient-of-determination-tutorial\/","og_locale":"en_US","og_type":"article","og_title":"Coefficient of Determination: R Squared Formula and Examples","og_description":"Learn the coefficient of determination: R squared meaning, formula, a worked example, adjusted R squared, negative R squared and Python code.","og_url":"https:\/\/prwatech.in\/blog\/data-science\/data-science-modules\/co-efficient-of-determination-tutorial\/","og_site_name":"Prwatech","article_publisher":"https:\/\/www.facebook.com\/prwatech.in\/","article_published_time":"2026-11-04T16:48:12+00:00","article_modified_time":"2026-11-05T16:13:45+00:00","og_image":[{"url":"https:\/\/prwatech.in\/blog\/wp-content\/uploads\/2019\/07\/Co-efficient-of-Determination.jpg","type":"","width":"","height":""}],"author":"Prwatech","twitter_card":"summary_large_image","twitter_creator":"@Eduprwatech","twitter_site":"@Eduprwatech","twitter_misc":{"Written by":"Prwatech","Est. reading time":"6 minutes"},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"WebPage","@id":"https:\/\/prwatech.in\/blog\/data-science\/data-science-modules\/co-efficient-of-determination-tutorial\/","url":"https:\/\/prwatech.in\/blog\/data-science\/data-science-modules\/co-efficient-of-determination-tutorial\/","name":"Coefficient of Determination: R Squared Formula and Examples","isPartOf":{"@id":"https:\/\/prwatech.in\/blog\/#website"},"primaryImageOfPage":{"@id":"https:\/\/prwatech.in\/blog\/data-science\/data-science-modules\/co-efficient-of-determination-tutorial\/#primaryimage"},"image":{"@id":"https:\/\/prwatech.in\/blog\/data-science\/data-science-modules\/co-efficient-of-determination-tutorial\/#primaryimage"},"thumbnailUrl":"https:\/\/prwatech.in\/blog\/wp-content\/uploads\/2019\/07\/Co-efficient-of-Determination.jpg","datePublished":"2026-11-04T16:48:12+00:00","dateModified":"2026-11-05T16:13:45+00:00","author":{"@id":"https:\/\/prwatech.in\/blog\/#\/schema\/person\/db90baff7744090b2288bbc98fea87f3"},"description":"Learn the coefficient of determination: R squared meaning, formula, a worked example, adjusted R squared, negative R squared and Python code.","breadcrumb":{"@id":"https:\/\/prwatech.in\/blog\/data-science\/data-science-modules\/co-efficient-of-determination-tutorial\/#breadcrumb"},"inLanguage":"en-US","potentialAction":[{"@type":"ReadAction","target":["https:\/\/prwatech.in\/blog\/data-science\/data-science-modules\/co-efficient-of-determination-tutorial\/"]}]},{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/prwatech.in\/blog\/data-science\/data-science-modules\/co-efficient-of-determination-tutorial\/#primaryimage","url":"https:\/\/prwatech.in\/blog\/wp-content\/uploads\/2019\/07\/Co-efficient-of-Determination.jpg","contentUrl":"https:\/\/prwatech.in\/blog\/wp-content\/uploads\/2019\/07\/Co-efficient-of-Determination.jpg","width":634,"height":483},{"@type":"BreadcrumbList","@id":"https:\/\/prwatech.in\/blog\/data-science\/data-science-modules\/co-efficient-of-determination-tutorial\/#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"Home","item":"https:\/\/prwatech.in\/blog\/"},{"@type":"ListItem","position":2,"name":"Coefficient of Determination"}]},{"@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\/2592","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=2592"}],"version-history":[{"count":11,"href":"https:\/\/prwatech.in\/blog\/wp-json\/wp\/v2\/posts\/2592\/revisions"}],"predecessor-version":[{"id":12140,"href":"https:\/\/prwatech.in\/blog\/wp-json\/wp\/v2\/posts\/2592\/revisions\/12140"}],"wp:attachment":[{"href":"https:\/\/prwatech.in\/blog\/wp-json\/wp\/v2\/media?parent=2592"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/prwatech.in\/blog\/wp-json\/wp\/v2\/categories?post=2592"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/prwatech.in\/blog\/wp-json\/wp\/v2\/tags?post=2592"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}