# How to fit a plot with error bar as weight?

I try to fit a line which can fit through the points considering the error weight of each coordinate. Is it possible to do in Mathematica? I can only find Fit function which did not do what I really want.. As you can see the graph below.. The line clearly is not the best fit if you consider the error..

• The usual case is where the weights are associated with different variances for the dependent variable. It's a whole different ball game if the weights are associated with "errors" for the independent variable. And it looks from the figure that it's the independent variable that is associated with the variability. Rather than just decide on a process to use, I suggest starting with a model that you want to fit. Then choose the process that works best with that model rather than in isolation of any model.
– JimB
Apr 22 '16 at 19:06
• I deleted my answer because I noticed the errors are on x-axis. Take a look here. But in general, there is no simple way in Mathematica probably. I would really suggest Gnuplot for this as it is implemented there straightforwardly unless you for some reason need to use Mathematica. Apr 22 '16 at 19:15
• Welcome to Mathematica.SE! 1) As you receive help, try to give it too, by answering questions in your area of expertise. 2) Take the tour and check the faqs! 3) When you see good questions and answers, vote them up by clicking the gray triangles, because the credibility of the system is based on the reputation gained by users sharing their knowledge. Also, please remember to accept the answer, if any, that solves your problem, by clicking the checkmark sign!
– user9660
Apr 22 '16 at 19:36
• @leosenko. There's no simple way anywhere in that all of the many approaches make different assumptions and one should be able rather than just willing to make those assumptions (or ignore the assumptions). The method you mention is not scale invariant in that changing from meters to centimeters for either the dependent or independent variable changes the results. Not being scale invariant is not a bad thing. You just need to be able to meet the assumptions made by the method. Other methods assume you know the ratio of the variances associated with the independent and dependent variables.
– JimB
Apr 22 '16 at 19:37
• – user9660
Apr 23 '16 at 7:14