Error on slope and intercept

*To*: mathgroup at smc.vnet.net*Subject*: [mg131774] Error on slope and intercept*From*: nicolasgebbo at googlemail.com*Date*: Wed, 2 Oct 2013 05:54:16 -0400 (EDT)*Delivered-to*: l-mathgroup@mail-archive0.wolfram.com*Delivered-to*: l-mathgroup@wolfram.com*Delivered-to*: mathgroup-outx@smc.vnet.net*Delivered-to*: mathgroup-newsendx@smc.vnet.net

I was informing myself about linear regression with errors in x and y. I dont really understand the theory behind the following algorithm but it would be nice if someone could tell me how i get the error of the intercept and slope. worals[x_, y_, sx_, sy_] := Block[{a, b, f, z, u = 1/sx, v = 1/sy, w = (sy/sx)^2}, {a, b} = (y*v).PseudoInverse@{v, x*v}; f = #.# &[(a + b*x - y) v]; While[f > (z = (x*w + (y - a) b)/(b^2 + w); {a, b} = (y*v).PseudoInverse@{v, z*v}; f = #.# &@Join[(z - x) u, (a + b*z - y) v])]; {f, {a, b}}] Thanks for any help