Error in slope and intercept
- To: mathgroup at smc.vnet.net
- Subject: [mg131773] Error in slope and intercept
- From: Gebbo <nicolasgebbo at googlemail.com>
- Date: Wed, 2 Oct 2013 05:53:56 -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 error in both observables and found this algorithm: (Weighted Orthogonal Regression by Alternating Least Squares) 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}}] which gives me {chisquare, {intercept, slope}} as output. This works prefectly fine but I'd like to get the error on slope and intercept. I don't understand enough about Mathematica or the theory behind this algorithm, so i would pref the solution or hinds our i can write it myself. Thanks Gebbo