LinearFitXYerrors.jl icon indicating copy to clipboard operation
LinearFitXYerrors.jl copied to clipboard

A GMT version of linearfitxy

Open joa-quim opened this issue 3 years ago • 1 comments

Hi Rafael,

I've ported your linearfitxy function to work in GMT.jl and in the migration process the Distributions and Plots dependencies were dropped (replaced by GMT.jl functions alone).

Taking one of your examples I can now do

D = Misc.linearfitxy([0.0, 0.9, 1.8, 2.6, 3.3, 4.4, 5.2, 6.1, 6.5, 7.4], [5.9, 5.4, 4.4, 4.6, 3.5, 3.7, 2.8, 2.8, 2.4, 1.5], sx=1 ./ sqrt.([1000., 1000, 500, 800, 200, 80,  60, 20, 1.8, 1]), sy=1 ./ sqrt.([1., 1.8, 4, 8, 20, 20, 70, 70, 100, 500]));

>>> [± σ]  Y = (5.4799 ± 0.3592) + (-0.4805 ± 0.0706)*X
>>> [± 95% CI]  Y = (5.4799 ± 0.8284) + (-0.4805 ± 0.1629)*X
>>> Pearson ρ = -0.943;  Goodness of fit = 1.218

# This one was entirely re-written in *GMT.jl* and allows tuning all plotting parameters
plot_linfitxy(D, band_ab=true, band_CI=true, ellipses=true, show=true)

and get the figure bellow.

What I would like to ask you is if you would like to make a PR to GMT.jl with the contents of the ported function (in the zip attached to this post) so that the credits for this work are more openly visible.

Cheers

Joaquim

GMTjl_tmp linearfitxy.zip

joa-quim avatar Jan 30 '23 20:01 joa-quim

Hi Joaquim,

Thanks for your message and interest. And I am happy to see that everything (and more) can be done in GMT. I will be glad to make the PR to GMT, with a disclaimer (as per the package notes) :)

Regards, Rafael

rafael-guerra-www avatar Jan 31 '23 19:01 rafael-guerra-www