# Error bars and coefficient computation on linear regressions in Matlab

I have a handful (~5) of values x I need to plot against a handful of values y (actually, log(x) vs. log(y)), in order to derive a linear equation used to derive an empiric power equation. However, I want to compute an error bar for the coefficient/power (e.g. x^(-3.5+-0.2)).

Here's the problem: Each value x, y has a unique error bar (However, the y error bars are the most important in this particular case). I'm only interested in the coefficient of the linear equation, so what I wonder is if there is a way to enter the set of error bars into the equation, and have matlab compute a good guess at the least and greatest plausible slope within the error range.

Otherwise, what would be a decent way to approximate this range of coefficients, for such a small set of values, assuming I know the relationship is linear? Simple slope between the extreme values of the least and greatest data point? Or is there perhaps a formula for computing the error range of a coefficient from the data set?

The problem I actually have is that while most of the mean values line up neatly, one deviates a bit; however, it is also the data point with the greatest error bar. And because there are large powers of variables with error bars involved, I want to get an idea of whether I can be at all confident in my coefficients. Carrying over error bars would seem like a decent way of doing it, if it is computationally feasible.

I hope the above makes sense. Thanks!

fitlm(x,y,'linear','weight',w)

If you do that, the coefCI method will produce coefficient confidence intervals that take the weighting into account.