MathGroup Archive 1995

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

Search the Archive

Re: Fitting data on a vertical line

  • To: mathgroup at
  • Subject: [mg1565] Re: Fitting data on a vertical line
  • From: rubin at (Paul A. Rubin)
  • Date: Sat, 24 Jun 1995 06:39:26 -0400
  • Organization: Michigan State University

In article <3sd9dm$n5n at>,
   phpull at (Joe Wade Pulley) wrote:
->	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.

The equation x=2.1 is not a linear model in x, which is what you requested. 
 You are asking for "the" linear function of x which minimizes total 
squared error at the data points.  Since all data points have the same 
abscissa (2.1), any linear function whose value at x=2.1 is 5 ties for 
least squared error.  Note that the function coughed up by Fit qualifies 
(it evaluates to 5 at x=2.1).  It happens that there are uncountably many 
possible OLS fits to this data.  Why Fit chose that one is a mystery to me, 
but it is in fact a correct answer.


* Paul A. Rubin                                  Phone: (517) 432-3509   *
* Department of Management                       Fax:   (517) 432-1111   *
* Eli Broad Graduate School of Management        Net:   RUBIN at MSU.EDU    *
* Michigan State University                                              *
* East Lansing, MI  48824-1122  (USA)                                    *
Mathematicians are like Frenchmen:  whenever you say something to them,
they translate it into their own language, and at once it is something
entirely different.                                    J. W. v. GOETHE

  • Prev by Date: How to force an expression into Rational Function form?
  • Next by Date: Re: Recursion problem?
  • Previous by thread: How to force an expression into Rational Function form?
  • Next by thread: Fitting data on a vertical line