# What does LinearModelFit depend on except for its arguments?

I thought this would be always true, but most likely it returns false.

random = {RandomReal[{-1, 1}, {500, 5}], RandomReal[{-1, 1}, 500]};
SameQ @@ Table[LinearModelFit[random], {100}]
(*False*)


How is this explained?

-
your code returns true on Mathematica version 9 on macos – chris Apr 8 '14 at 7:59
This question appears to be off-topic because the problem the user claims to be experiencing can not be reproduced. – m_goldberg Apr 8 '14 at 12:23
@chris FWIW, I get around 50% False for multiple evaluation on 9.01 on Windows. – Yves Klett Apr 8 '14 at 14:20
so it seems to be an OS dependent problem/bug? – chris Apr 8 '14 at 14:25
I can reproduce this problem. Please don't close this question – Sjoerd C. de Vries Apr 8 '14 at 14:44

Update: This seems to be a problem restricted to 32 bits Windows systems

random = {RandomReal[{-1, 1}, {500, 5}], RandomReal[{-1, 1}, 500]};


and then a slight change:

mods = Tally@Table[LinearModelFit[random], {1000}]


I tally the resulting FittedModels. I sometimes get only a single model (counted 1000 times) and sometimes two models (each about 500 times).

When I get two models, they never differ in the fitted parameter values, but in a different aspect. The following line checks all model properties for differences.

Select[LinearModelFit[random]["Properties"], mods[[1, 1]][#] != mods[[2, 1]][#] &] // Quiet


{"MeanPredictionConfidenceIntervals", "MeanPredictionConfidenceIntervalTableEntries", "PredictedResponse", "SinglePredictionConfidenceIntervalTableEntries"}

The differences in these are always very small, a typical example:

mods[[1, 1]]["MeanPredictionConfidenceIntervals"] -
mods[[2, 1]]["MeanPredictionConfidenceIntervals"] // Flatten // Union


{-1.11022*10^-16, -5.55112*10^-17, -4.16334*10^-17, \ -2.77556*10^-17, -2.08167*10^-17, -1.38778*10^-17, -6.93889*10^-18, \ -3.46945*10^-18, 0., 3.46945*10^-18, 6.93889*10^-18, 1.38778*10^-17, 2.08167*10^-17, 2.77556*10^-17, 5.55112*10^-17}

This looks like a very small rounding error though it is strange that it occurs at random. Originally I thought the confidence intervals might be found using bootstrapping, which involves randomness, but the amount of randomness here seems to small for that. This Mathgroup thread, pointing in the direction of Intel's Math-Kernel-Library (MKL) may be related.

-