How to find standard deviation of a linear regression?
88 visualizaciones (últimos 30 días)
I have an actually pretty simple problem which is driving me crazy right now. There are two sets of data: one for O2 and one for Heat. I made a linear regression in the plot of those two data sets which gives me an equation of the form O2 = a*Heat +b. So now I need to find the confidance interval of a. That for I need to find the standard deviation of a which I somehow just can't find out how to get it. Of course it would also work for me if there is a function that returns the confidance interval directly.
Star Strider el 20 de Jul. de 2014
Editada: Star Strider el 21 de Jul. de 2014
With absolutely no humility at all I direct you to polyparci. It calculates the confidence intervals for you for both parameters:
[p,S] = polyfit(Heat, O2, 1);
CI = polyparci(p,S);
If you have two vectors, Heat and O2, and a linear fit is appropriate to your data, this code should work.
Más respuestas (1)
Shashank Prasanna el 21 de Jul. de 2014
Ronny, it is fairly easy to calculate in few lines of code, however it is easier to use functions such as fitlm to perform linear regression. fitlm gives you standard errors, tstats and goodness of fit statistics right out of the box:
If you want to code it up yourself, its 5 or so lines of code, but I'll let you give it a shot first.