Calculating 2 x r squared values

JeffGrant

Board Regular
Joined
Apr 7, 2021
Messages
196
Office Version
  1. 365
Platform
  1. Windows
Hi All,

I have two trend lines generated from the same data. As you can in the chart, the polynomial trend line creates an R squared value of 1. The linear regression trendline creates an R squared value of 0.148.
1631418002560.png


My data set is

XY
57.5​
16.56​
52​
16.34​
54​
16.76​

Using LINEST(B2:B4,A2:A4^{1,2}), I can get the co-efficients of the polynomial.
Using LINEST(B2:B4,A2:A4), I can get the slope and intercept of the linear trend line.
Using RSQ(B2:B4,A2:A4), I can get the R-Squared value of the linear trend line

How can I get the R-Squared value of the polynomial from the same dataset?

I have tried a few alternative methods to calculate the R Squared and it always calculates the values for the Linear Trend line, not the polynomial.

I really would like to have both R-Squared values in the same sheet, so the I can switch formulas as the data changes.

Thanks in advance
 

Excel Facts

Can a formula spear through sheets?
Use =SUM(January:December!E7) to sum E7 on all of the sheets from January through December

maabadi

Well-known Member
Joined
Oct 22, 2012
Messages
2,680
Office Version
  1. 2019
  2. 2016
Platform
  1. Windows
Try this:
Book1
ABCDEFGH
1XY
257.516.56
35216.34
45416.761
5
6
Sheet3
Cell Formulas
RangeFormula
E4E4=INDEX(LINEST(B2:B4,A2:A4^{1,2},TRUE,TRUE),3,1)


To get R-squared as a cell value for different types of trendlines:

Linear
Excel Formula:
=RSQ(known_ys, known_xs)
Power
Excel Formula:
=RSQ(LN(known_ys), LN(known_xs))
Logarithmic
Excel Formula:
=RSQ(LN(known_ys), known_xs)
Exponential
Excel Formula:
=RSQ(known_ys,LN(known_xs))
Polynomial (2nd degree)
Excel Formula:
=INDEX(LINEST(known_ys,known_xs^{1,2},TRUE,TRUE),3,1)
Polynomial (3rd degree)
Excel Formula:
=INDEX(LINEST(known_ys,known_xs^{1,2,3},TRUE,TRUE),3,1)
 
Solution

maabadi

Well-known Member
Joined
Oct 22, 2012
Messages
2,680
Office Version
  1. 2019
  2. 2016
Platform
  1. Windows
You're Welcome & Thanks for Feedback.
 

Forum statistics

Threads
1,147,559
Messages
5,741,817
Members
423,689
Latest member
Jords998

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Top