Open JasonGross opened 4 years ago
My guess is that this won't be implemented, because it relies on gnuplot
-- in contrast to the linear regression
. If at least there would be solution using Lua than there might be a chance, because Lua(La)TeX should be available on most of the installations today.
(Maybe there is also a possibility to use xfp
package to do the job?)
My guess is that this won't be implemented, because nowadays Christian only reacts when I directly send him a ready-to-merge patch and remind him several times. Remember the circle
disaster? My PR #347 is also open without any comment for over a month now.
@Mo-Gul There should be a way to do the regression in lua/xfp. I just figured that since there's some support for gnuplot integrated into pgfplots, it'd be reasonable to add this support conditional on gnuplots being around. In any case, I think the log-mode issue with linear regression is a bug, and can probably be fixed by adjusting the default variances to log-scale when in log-mode. Should I open a separate report for this?
@hmenke Ah, that's unfortunate. Maybe I should just make my own package that builds on top of gnuplottex and pgfplots? (In any case, I'd appreciate help in figuring out how to extend create col
so that the syntax for these is more in line with syntax for linear regression.)
If there isn't already an issue filed for this (I didn't check it) then you should add a new/separate for this, yes please.
I would be a fan of adding additional regression functions as well. But I am just a user of LaTeX and can't program anything myself. But if someone would do it, I'll be happy to test and proofe-read the documentation. If possible, I suggest that you try to implement this -- as already stated in my previous comment -- in Lua and/or xfp
because this is available "by default" in newer TeX installations and natively supported. Gnuplot on the other hand needs a LaTeX run with --shell-escape
enabled and other "problems"/prerequisites.
Of course you also create your own package where you can do whatever you want, but I think "visibility" for these features will be much higher, if they are shipped (as library) with PGFPlots directly instead of an additional package.
Separate issue reported at #352
I almost have code that is sufficiently working that I could make my own package (reimplementation of the fitting algorithm with xfp or lua will have to wait for when I have more free time). Currently I'm just blocked on some styling issues of \addplot
: https://tex.stackexchange.com/questions/568875/how-do-i-get-all-options-to-addplot-to-propagate-to-an-inner-addplot-executed
Brief outline of the proposed feature
It seems nice to be able to fit data to something other than just a line. (Note that the log mode for linear regression isn't really satisfactory, because it uses the wrong weighting, resulting in under-weighing the larger points.) While this may be out-of-scope for doing inline in TeX, it seems relatively easy to add support for quadratic and exponential fits using the gnuplot feature of PGF.
Usage example
Here is some code that demonstrates how I'm currently achieving this:
This creates the following plots:
(The final log plot shows the inadequacy of the
ymode=log
argument to linear regressions.)I'm not sure what the best generalization of this is (should the user be able to specify any gnuplot function and which variables to fit?), but at least the quadratic and exponential regressions would be quite useful to have as syntax via
create col/exponential regression
andcreate col/quadratic regression
.(Presumably the code I wrote would need to be cleaned up somewhat to use more standard file names for the parameters (maybe based on the
id
key?), to emit the appropriate warning/error when gnuplot isn't available, and to be accessible viacreate col
rather than as their own commands.