MathGroup Archive 1995

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

Search the Archive

Re: Fitting data on a vertical line

  • To: mathgroup at
  • Subject: [mg1563] Re: Fitting data on a vertical line
  • From: beretta at ATHENA.MIT.EDU (Robert K Beretta)
  • Date: Sat, 24 Jun 1995 06:19:17 -0400
  • Organization: Massachusetts Institute of Technology

In article <3sd9dm$n5n at> phpull at (Joe Wade Pulley) writes:
>	I have recently accidentally asked Mathematica to do a linear
>least squares fit to a set of data which were exactly vertically
>placed.  Instead of giving me an error or an infinite slope,
>Mathematica spits out some sort of fit which is totally wrong.
>For example,  if I make up a list of data which is similar to mine, I
>get the following results.
>{{2.1, 3}, {2.1, 4}, {2.1, 5}, {2.1, 6}, {2.1, 7}}
>0.924214 + 1.94085 x
>Obviously, this equation does not "fit" the data I have given.  The
>equation x=2.1 would.  Can anyone explain this very unusual behavior.


I do not believe that the return value is totally wrong.  When a least squares
fitting method is applied to a data set with n values for the same coordinate,
the method will average the values at that coordinate and multiply the weight
of the particular datum by n.  If we look at the value of the Fit function
with x set to 2.1, we see that it is equal to the average of the datum values.


   0.924214 + 1.94085 x

   ft /. x->2.1 


Thus, the function ft provides the best fit possible for the solitary
coordinate x = 2.1, which is the only point where any information is available.
Since the slope of the function described by the data is indeterminate (it is
no more Infinity than -Infinity) Mma returned ... something else for the slope.

Honestly, I would have expected an "indeterminate" error message from this
calculation, or maybe a more recognizable function, like "5.0 + 0.0 x".  But
really, the function ft is just as "right" as any other function that is equal
to 5.0 at x = 2.1.

For what it's worth,
Bob Beretta
beretta at

  • Prev by Date: roots
  • Next by Date: How to parametric plot deriv of interpolating func?
  • Previous by thread: Fitting data on a vertical line
  • Next by thread: Re: Fitting data on a vertical line