pgf-tikz / pgfplots

pgfplots - A TeX package to draw normal and/or logarithmic plots directly in TeX in two and three dimensions with a user-friendly interface and pgfplotstable - a TeX package to round and format numerical tables. Examples in manuals and/or on web site.
http://pgfplots.sourceforge.net/
198 stars 33 forks source link

Calculate/expose correlation coefficient #408

Open josephwright opened 2 years ago

josephwright commented 2 years ago

Using create col/linear regression = {y = ...} one can carry out linear regression in pgfplots(table), and get the slope and intercept from \pgfplotstableregressiona and \pgfplotstableregressionb. However, the correlation coefficient is not calculated. I can see that this might not always be desirable, as it's an optional piece of work, but as it uses some of the same intermediate values as the core regression work, it would be nice to have as an optional step.

The reason for the request is that typically if you want to extract the slope and intercept, you are also likely to want to comment on the quality of the fit in numerical terms.

Mo-Gul commented 2 years ago

I don't think that Christian will invest time in the near future. So if you have good idea on how to implement it, we'll be happy to accept a PR :)