Services & Resources / Wolfram Forums / MathGroup Archive
-----

MathGroup Archive 2009

[Date Index] [Thread Index] [Author Index]

Search the Archive

Re: linear regression with errors in both variables

  • To: mathgroup at smc.vnet.net
  • Subject: [mg96324] Re: linear regression with errors in both variables
  • From: dh <dh at metrohm.com>
  • Date: Wed, 11 Feb 2009 05:24:15 -0500 (EST)
  • References: <gmrmga$a1k$1@smc.vnet.net>


Hi Joerg,

this is an addendum to my former message for the case where the x and y 

axis have different scales. The following example assumes that the error 

  in the y axis is 100 times that of the x axis. sx and sy denote the 

standard deviations. a anb be define again the line: y==a+b x. res 

denotes the weighted sum of squares of distances. The metric is taken 

as: {{1/sx^2,0},{0,1/sy^2}}

d = Table[{RandomReal[], 100 RandomReal[]}, {4}];

sx = 1; sy = 100;

res[a_, b_] =

   Module[{perp, met = {{1/sx^2, 0}, {0, 1/sy^2}}},

    perp = {b sx^2, -sy^2};

    perp = perp/Sqrt[perp.met.perp];

    Plus @@ (perp.met.(# + {a/b, 0}) & /@ d)^2];

sol = Minimize[res[a, b], {a, b}]

fun[x_] = a + b x /. sol[[2]]

Plot[fun[x], {x, 0, 1}, Epilog -> {Red, Point[d]},

  PlotRange -> ({0.95 Min @@ #, 1.05 Max @@ #} & /@ Transpose[d])]



hope this helps, Daniel



Joerg wrote:

> Hi,

> 

> I want to test the hypothesis that my data

> follows a known simple linear relationship,

> y = a + bx. However, I have (known) measurements

> errors in both the y and the x values.

> 

> I suppose just a simple linear regression

> does not do here.

> 

> Any suggestions how do test this correctly?

> 

> Thanks,

> 

> joerg

> 




  • Prev by Date: Re: Re: How to simplify?
  • Next by Date: Re: WeatherData - many properties unavailable?
  • Previous by thread: Re: linear regression with errors in both variables
  • Next by thread: Re: linear regression with errors in both variables