4

After I input the following:

data = Table[{3 + i + RandomReal[{-3, 7}], 
i + RandomReal[{-2, 5}]}, {i, 1, 20}];

model = LinearModelFit[data, x, x]

I got something weird:

(*   FittedModel[-1.65238+<<19>>x]     *)

Does anyone know what <<19>>x means?

rm -rf
  • 88,781
  • 21
  • 293
  • 472
Lei Chen
  • 73
  • 2
  • 3
  • Try model[x] ;-) – chris Nov 25 '12 at 17:44
  • I followed the tutorial precisely but the tutorial displayed the result that is understandable: FittedModel[-1.65238+0.694915x]

    How can I tweak the preference to get the same result?

    – Lei Chen Nov 25 '12 at 18:07
  • it does for me (http://i.stack.imgur.com/eLOqb.png); please try from a new session? – chris Nov 25 '12 at 18:13
  • @chris Perhaps something with a precision setting. data = SetPrecision[ Table[{3 + i + RandomReal[{-3, 7}], i + RandomReal[{-2, 5}]}, {i, 1, 20}], 200]; gets a similar result. – Sjoerd C. de Vries Nov 25 '12 at 18:59

2 Answers2

14

<<19>> or Skeleton[19] means that some output (here 19 elements) is omitted. See the ShortAndShallowOutput tutorial in the Documentation Center for more information.

rm -rf
  • 88,781
  • 21
  • 293
  • 472
ssch
  • 16,590
  • 2
  • 53
  • 88
  • How can I tweak the input to get something understandable? – Lei Chen Nov 25 '12 at 17:58
  • 2
    @LeiChen It is important to realize that the output that you see is only a symbolical representation of the actual output. What you get returned is an object which knows several methods as Chris showed. How the object is depicted on your screen is totally irrelevant. It could have been a pink elephant, that doesn't matter, it's only decoration. If you're after the fit itself you can use model["BestFit"] – Sjoerd C. de Vries Nov 25 '12 at 19:17
  • @Sjoerd C. de Vries Thanks! – Lei Chen Nov 25 '12 at 19:43
6

LinearModelFit returns a full statistical information set.

For instance

   model[x] 

would return

   (* 0.778634 x+1.13751  *)

or

   model["ANOVATable"]

Mathematica graphics

More generally, try

   model /@ model["Properties"]

Mathematica graphics

chris
  • 22,860
  • 5
  • 60
  • 149