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


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

Re: two regression curves for two ranges of the same data set on the same chart

From TonyG <tgozdz@gmail.com>
Newsgroups comp.graphics.apps.gnuplot
Subject Re: two regression curves for two ranges of the same data set on the same chart
Date 2012-04-13 05:23 -0700
Organization http://groups.google.com
Message-ID <2701c207-2fc6-44e6-8a38-64d63d789553@f6g2000vbc.googlegroups.com> (permalink)
References <c83ddafa-3bf9-4354-885a-8ff56e314cde@v22g2000vby.googlegroups.com> <9up42tFd5tU1@mid.dfncis.de>

Show all headers | View raw


On Apr 12, 6:42 pm, Hans-Bernhard Bröker <HBBroe...@t-online.de>
wrote:
> On 12.04.2012 22:50, TonyG wrote:
>
> > I've been trying to obtain two sets of regression coefficients for the
> > same data file, using two ranges of x values, then plot the two lines
> > and the data points on the same graph.
>
> > f(x)=a*x+b
> > f(x1)=a1*+b1,  then
>
> That one almost certainly doesn't do what you wanted.  There's no x1 on
> the right hand side, and you just overwrote your earlier definition of
> f(x).  You must have meant
>
>         f1(x) = a1*x+b1
>
> > fit [x=*:25] f(x)... via a, b  and
> > fit [x1=25:*] f(x1) ... via a1, b1
>
>         f(x) = (x<=25) ? (a*x+b) : (a1*x+b1)
>         fit f(x) via a, b, a1, b1
>
> would have been simpler.
>
> > The trouble is with the x1... gnuplot doesn't understand what it is.
>
> I'd have to state that you don't understand it either...

You've got that right--but do you have to embarrass me publicly and
say it aloud?  ;-)

Is the simplified syntax that you used to fit two regression
expressions in a single line  (fit f(x) via a, b, a1, b1) a feature
documented anywhere in the gnuplot Help files or examples, or is it
simply the use of a C conditional?  I've been looking for such
examples, but to no avail.

Anyway, thanks for your quick response and suggestion; I think it
should clear that I made a simple typo by omitting x1 in the second
expression after the multiplication sign, which is there...

I have another (date format and datafile separator) question, in a
follow-up post.

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


Thread

two regression curves for two ranges of the same data set on the same chart TonyG <tgozdz@gmail.com> - 2012-04-12 13:50 -0700
  Re: two regression curves for two ranges of the same data set on the same chart Hans-Bernhard Bröker <HBBroeker@t-online.de> - 2012-04-13 00:42 +0200
    Re: two regression curves for two ranges of the same data set on the same chart TonyG <tgozdz@gmail.com> - 2012-04-13 05:23 -0700
      Re: two regression curves for two ranges of the same data set on the   same chart Hans-Bernhard Bröker <HBBroeker@t-online.de> - 2012-04-13 20:37 +0200

csiph-web