help-octave
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Curve Fitting "splattered" data


From: Henry F. Mollet
Subject: Re: Curve Fitting "splattered" data
Date: Mon, 18 Oct 2004 15:22:00 -0700
User-agent: Microsoft-Entourage/10.1.1.2418

Slope of y-on-x regression is say b. Slope of x-on-y regression is say d.
For comparison in a plot you have to solve the x-on-y regression for y and
slope will be 1/d. This is slope is not the same as b. The geometrical mean
(GM) regression will bisect the two lines. The slope of the GM regression is
b/r where r is the coefficient of determination. Thus all all 3 lines will
coalesce into on if r = 1 and then only we would have d = 1/b. As you can
see from below your r is = -0.59 thus b(GM) = -15.31/-0.59 = 25.95 (not sure
about sign) and your 1/d = 43.78.
Henry

octave:8> whos
*** local user variables:
prot  type                       rows   cols  name
====  ====                       ====   ====  ====
 rwd  matrix                       37      1  X
 rwd  matrix                       37      1  Y
octave:9> varX=var(X)
varX =  1.8320e-10
octave:10> covXY=cov(X,Y)
covXY =  -2.8048e-09
octave:11> slope_b=covXY/varX
slope_b = -15.310
octave:12> varY=var(Y)
varY =  1.2278e-07
octave:13> slope_d=covXY/varY
slope_d = -0.022844
octave:14> a=mean(Y)-slope_b*mean(X)
a =  1.0841e-08                     %intercept y-on-x regression
octave:15> c=mean(X)-slope_d*mean(Y)
c =  6.5187e-10                     %intercept x-on-y regression
octave:16> r = covXY/sqrt(varX*varY)
r = -0.59139

 


on 10/17/04 11:36 PM, Robert A. Macy at address@hidden wrote:

> Trying to fit a curve to data with poor results.
> 
> Data is a set of 37 complex data points that roughly lie
> along a straight line in the complex plane.  Sequence of
> data has no significance, only their location on the plane.
> 
> Don't care about intercept point, only the slope.  Ran
> polyfit.m using  real(datapoints) and imag(datapoints)
> thinking that would yield slope of trend, for example,
> 
> p=polyfit(real(datapoints),imag(datapoints),1)
> 
> calculates a slope, but when I reverse the order
> 
> p=polyfit(imag(datapoints),real(datapoints),1)
> 
> I don't get a reciprocal slope?!
> 
> one way I get 15.093, the other way I get 0.0228387
> Why aren't they reciprocal?
> 
> Is there a better program for finding the straight line?
> 
>              - Robert -
> 
> here are the 37 data points
> (-2.1456286465351e-05,0.000368384340354591)
> (-2.49666512943912e-05,0.000406964922352655)
> (-2.69240185786467e-05,0.000364390858984563)
> (-1.49721995852635e-05,0.000755348867291811)
> (-1.90168461047455e-06,0.000910735448537009)
> (3.89911415063851e-06,0.000656777869028222)
> (-1.74228809964004e-05,0.00059494106144057)
> (-1.84452460767724e-05,0.000497123085040872)
> (-6.73652063290162e-06,0.000408316846438543)
> (-2.02781429825792e-05,0.000157306074676664)
> (-7.79168094935598e-06,0.000112567966979171)
> (1.19220050194026e-05,7.87631929476673e-05)
> (-2.22440748356631e-06,-7.30142650390078e-05)
> (-5.18669954210557e-06,-0.000103332769797446)
> (-1.50579444382556e-06,-0.0001394015627003)
> (7.15256667891198e-06,-0.000158813587520262)
> (1.61581810444768e-05,-0.000146061331035827)
> (-1.27343429541481e-05,-0.000114864732620068)
> (-5.46509907308965e-06,-0.000188387643769827)
> (1.33219143418663e-05,-0.00017258920713193)
> (1.42599281056401e-05,-0.000164717680570664)
> (-5.09652523452905e-06,-0.000254209182844856)
> (-2.36118248311476e-06,-0.00029107521541287)
> (1.08747988875925e-05,-0.000225779565913714)
> (-8.66620629948883e-07,-0.000360194241635699)
> (1.23374719256143e-05,-0.000386204823149286)
> (1.1660501015618e-05,-0.000323737080074195)
> (1.98258461605351e-05,-0.000237412110197996)
> (1.72411954988162e-05,-0.000203562685617997)
> (1.30671392031025e-05,-0.000134361950454388)
> (1.52025452697414e-05,-0.000209740338777707)
> (-1.50070064195672e-05,-0.000152806222347181)
> (1.06122634539775e-05,-0.000104056738370627)
> (1.21213670163135e-05,-0.000237839370940948)
> (1.56642065274083e-05,-0.000417574958985853)
> (7.52983564631174e-06,-0.00034448159389109)
> (-1.50788950994615e-06,-0.000167401675272537)
> 
> 
> 
> -------------------------------------------------------------
> Octave is freely available under the terms of the GNU GPL.
> 
> Octave's home on the web:  http://www.octave.org
> How to fund new projects:  http://www.octave.org/funding.html
> Subscription information:  http://www.octave.org/archive.html
> -------------------------------------------------------------
> 



-------------------------------------------------------------
Octave is freely available under the terms of the GNU GPL.

Octave's home on the web:  http://www.octave.org
How to fund new projects:  http://www.octave.org/funding.html
Subscription information:  http://www.octave.org/archive.html
-------------------------------------------------------------



reply via email to

[Prev in Thread] Current Thread [Next in Thread]