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.
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.
Using
create col/linear regression = {y = ...}
one can carry out linear regression inpgfplots(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.