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


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

Re: fitting to more than 5 variables

From sfeam <sfeam@users.sourceforge.net>
Newsgroups comp.graphics.apps.gnuplot
Subject Re: fitting to more than 5 variables
Followup-To comp.graphics.apps.gnuplot
Date 2013-06-10 16:28 -0700
Organization gnuplot development team
Message-ID <kp5n6l$rn6$1@dont-email.me> (permalink)
References <481037c4-a6a8-45ed-8d33-e0d57a70a0cf@googlegroups.com> <kp0aqp$hl9$1@dont-email.me> <1a15410a-f12a-47a0-b04c-17ae13004c40@googlegroups.com>

Followups directed to: comp.graphics.apps.gnuplot

Show all headers | View raw


trg818@gmail.com wrote:

> On Sunday, June 9, 2013 12:26:55 AM UTC+2, sfeam wrote:
>> There is not a 5-parameter limit in defining a function.
> Correct, but that's not the problem.
>> Also there is not a 5-parameter limit in the "via" keyword.
>>   fit Q(x,y) using 1:2:3:(1) via q1,q2,q3,q4,q5,q6,q7,q8
>> Even the combination is accepted:
>>   fit F(q1,q2,q3,q4,q5,q6,q7,q8,q9) 'foo.dat'  using 1:2:3 \
>>       via q1,q2,q3,q4,q5,q6,q7,q8,q9
> It is accepted because you are fitting a function of only 3 independent
> variables that has 9 parameters/coefficients. My function has eight (not
> nine, as I originally wrote) independent variables, i.e., the data space
> is eight-dimensional, and there are 9 parameters:
> 
> P(l,T,d,XS,XC,XS2,XN,N)=a*l+ \
> (b+c*d)/T+d*log10(1.-XS)+e*log10(1.-XC)+f*log10(1.-XS2)+g*log10(1.-XN)+h*N+i
> fit P(l,T,d,XS,XC,XS2,XN,N) 'DU.dat' via a,b,c,d,e,f,g,h,i
> 
> The error I get is:
>          undefined variable: l
> and if I remove the term with the l and try with only 8 variables, the
> error is that T is an undefined variable, and so on.
>> So what limit have you encountered, exactly?
> The online help says: "The fit function may have up to five independent
> variables." This is with Gnuplot v.4.6 patchlevel 1 on a Mac (macports
> install).

OK, I understand now.  

The limitation comes not from the number of variables, but from the fact
that the maximum number of input data columns is 7, since this is the
fixed size of the internal structure that holds each data point.

The run-time memory requirements of gnuplot increase proportionally with
the size of this internal data structure.  I.e. redefining the structure
to hold 10 values (8 parameter dimensions + 2 spatial coords) would increase
the memory required by ~42%.  This is trivial for small data sets, but can
become an issue for very large data sets.  Historically there has been more
user demand to handle huge data sets than demand to handle small data sets
with high dimensionality.  

On the other hand, historically these limits were a consequence of 
16- or 32-bit memory indexing. One could argue that the trade-off should be
revisited in the era of 64-bit computing.  Bastian Maerkisch has been working
to incorporate improvements from several sources into gnuplot's fit routines
in the development version.  I do not recall seeing discussion of allowing
higher dimensionality in the data, but maybe I missed it.

If you are willing to be a guinea pig for testing new code, perhaps you should
raise this issue on the gnuplot development mailing list:
 gnuplot-beta@lists.sourceforge.net

I can imagine a stupid-but-easy solution that simply doubles the size of the
data structure on 64-bit systems. This would affect all plotting and fitting.
A cleaner solution might be to allocate space dynamically in the fit routines
if additional dimensions are required.

	Ethan

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


Thread

fitting to more than 5 variables trg818@gmail.com - 2013-06-07 17:18 -0700
  Re: fitting to more than 5 variables sfeam <sfeam@users.sourceforge.net> - 2013-06-08 15:26 -0700
    Re: fitting to more than 5 variables trg818@gmail.com - 2013-06-09 16:35 -0700
      Re: fitting to more than 5 variables sfeam <sfeam@users.sourceforge.net> - 2013-06-10 16:28 -0700
        Re: fitting to more than 5 variables sfeam <sfeam@users.sourceforge.net> - 2013-06-11 15:59 -0700

csiph-web