Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.graphics.apps.gnuplot > #1551

Re: fit gives different results for identical functions with different var names

Newsgroups comp.graphics.apps.gnuplot
Date 2012-12-21 07:32 -0800
References <4da37e57-cdcd-474e-a3c3-7e98f09b1cb6@googlegroups.com> <kb1i3c$st5$1@news.rz.uni-karlsruhe.de>
Message-ID <5c431d1b-bbc9-418b-8707-588d0ff79beb@googlegroups.com> (permalink)
Subject Re: fit gives different results for identical functions with different var names
From Marcus Hanson <marcus.hanson@gmail.com>

Show all headers | View raw


On Friday, December 21, 2012 5:42:08 AM UTC-6, Karl wrote:
> Have you initialized all your variables identically for the three
> functions? And put all the right variable names in the "via" statement? 

> Does it help to put all the variables in the function argument list? 

I have the correct 'via' statements and I have initialized the variables. Here is exactly what I have done:

gnuplot>aa=1;ma=1;sa=1;xa=1;
gnuplot>fa(xa,aa,ma,sa)=aa*exp(-(xa-ma)**2/(2*sa**2))
gnuplot>fit fa(xa,aa,ma,sa) 'test.dat' u 1:2 via aa,ma,sa

This gives aa=55,ma=0.98,sa=1 (rounded off values) with enormous standard errors (on the order of 10^16 to 10^19). These numbers do not even remotely fit the data.

On the other hand, I have tried the following:

gnuplot>a=1;m=1;s=1;x=1;
gnuplot>f(x)=a*exp(-(x-m)**2/(2*s**2))
gnuplot>fit f(x) 'test.dat' u 1:2 via a,m,s

This gives a=236,m=-1,s=-2.6 (also rounded), with standard errors less than 10%. This also fits the function remarkably well by all measures I know.

I tried various different variable names of more than one character, and they all gave exactly identical results, all of them very wrong.

Could this be some setting I accidentally changed a while ago in gnuplot?

Back to comp.graphics.apps.gnuplot | Previous | NextPrevious in thread | Next in thread | Find similar


Thread

fit gives different results for identical functions with different var names marcus.hanson@gmail.com - 2012-12-20 13:01 -0800
  Re: fit gives different results for identical functions with different var names Brendan Halpin <brendan.halpin@ul.ie> - 2012-12-21 00:55 +0000
  Re: fit gives different results for identical functions with different var names Karl <mail.kfr@gmx.net> - 2012-12-21 12:42 +0100
    Re: fit gives different results for identical functions with different var names Marcus Hanson <marcus.hanson@gmail.com> - 2012-12-21 07:32 -0800
      Re: fit gives different results for identical functions with   different var names Hans-Bernhard Bröker <HBBroeker@t-online.de> - 2012-12-21 19:21 +0100
        Re: fit gives different results for identical functions with   different var names Marcus Hanson <marcus.hanson@gmail.com> - 2012-12-21 11:54 -0800
          Re: fit gives different results for identical functions with     different var names Hans-Bernhard Bröker <HBBroeker@t-online.de> - 2012-12-22 01:31 +0100

csiph-web