0

I am working with trendlines in charts. And I need to display R squared value in it as displayed in excel charts with trendline.

enter image description here

I came across many links, but cant find a definite answer.

So please guide me with a step by step procedure or any links to achieve this.

Thanks

Jaya
  • 253
  • 2
  • 3
  • 9
  • Is this image from online or your own? I can walk you through how to display the equation w/ the R^2 value... to be honest I'm not fully sure what you are asking. – Colin Oct 06 '15 at 12:46
  • This question has been closed, please see this other similar post: https://stackoverflow.com/questions/65987106/how-do-i-calculate-r-squared-value-in-javascript – Jacob Philpott Feb 01 '21 at 04:28

2 Answers2

1

I presume you ask about linear regression methods. And the R^2 you are asking about is Pearson's squared correllation coefficient between your data and estimated model (regression line).

You should search for methods of linear regression. Problem is completely unrelated neither with excel nor with javascript.

Check this article as a reference.

Kędrzu
  • 2,385
  • 13
  • 22
  • Thanks for this link! For a programmatic solution in JavaScript see this post: https://stackoverflow.com/questions/65987106/how-do-i-calculate-r-squared-value-in-javascript – Jacob Philpott Feb 01 '21 at 04:32
-1

Linear regression (or Bravais-Pearson index) is a mathematical formula Excel can calculate, but JavaScript can't.

Look at this article on how to calculate it:

http://trentrichardson.com/2010/04/06/compute-linear-regressions-in-javascript/

  • This is not true, you can most definitely calculate R-squared in JavaScript. Please see this post: https://stackoverflow.com/questions/65987106/how-do-i-calculate-r-squared-value-in-javascript – Jacob Philpott Feb 01 '21 at 04:31