Fitting data on a vertical line
- To: mathgroup at christensen.cybernetics.net
- Subject: [mg1548] Fitting data on a vertical line
- From: phpull at unix1.sncc.lsu.edu (Joe Wade Pulley)
- Date: Sat, 24 Jun 1995 03:47:48 -0400
- Organization: Louisiana State University
Hello, 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. In[1]:= ls={{2.1,3},{2.1,4},{2.1,5},{2.1,6},{2.1,7}} Out[1]= {{2.1, 3}, {2.1, 4}, {2.1, 5}, {2.1, 6}, {2.1, 7}} In[2]:= ft=Fit[ls,{1,x},x] Out[2]= 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. -- Joe Wade Pulley Department of Physics and Astronomy Louisiana State University Baton Rouge, LA 70803 phpull at unix1.sncc.lsu.edu