1

I start with a list of lists:

d1={{{0, 10}, {1, 20}, {2, 30}, {3, 40}, {4, 50}, {5, 60}, {6, 70}, {7, 
   80}, {8, 90}}, {{0, 10}, {1, 20}, {2, 30}, {3, 40}, {4, 50}, {5, 
   60}, {6, 70}, {7, 80}}, {{0, 10}, {1, 20}, {2, 30}, {3, 40}, {4, 
   50}, {5, 60}, {6, 70}}, {{0, 10}, {1, 20}, {2, 30}, {3, 40}, {4, 
   50}, {5, 60}}, {{0, 10}, {1, 20}, {2, 30}, {3, 40}, {4, 50}}};

I would like to apply a LinearModelFit on each list, but as a repetive process, i.e., something looking like:

Do[LinearModelFit[d1[[i]], x, x] // Normal, {i, 5}]

Can someone help (mathematica 10)? Thank you all in advance for your time.

PS: The command

LinearModelFit[d1[[1]], x, x, ConfidenceLevel -> .99] // Normal

works perfectly but I would like something more automated.

eldo
  • 67,911
  • 5
  • 60
  • 168
noob
  • 13
  • 3

1 Answers1

1

Use Table and Length@d1 as iteration limit

Normal@Table[LinearModelFit[d1[[i]], x, x, ConfidenceLevel -> .99], {i, Length@d1}]

enter image description here

Or, even shorter

Normal@Map[LinearModelFit[#, x, x, ConfidenceLevel -> .99] &, d1]
eldo
  • 67,911
  • 5
  • 60
  • 168