I have a series of data that I would like to extrapolate out another 20 times. The data in question is:

list = 
  {33.25, 33.5625, 33.875, 34.1875, 34.5, 34.8125, 35.125, 35.4375, 35.75, 
   36.0625, 36.375, 36.6875, 37.}

(Each list item appears to increase by 0.3125 from the previous list item, but I would like for it to be able to adaptable to any random non-linear progression.)

What method should be use in Mathematica's for extrapolating data in a way that will give results similar to Microsoft Excel's Fill -> Series -> Autofill function?

  • 2
    $\begingroup$ The answer is highly non-unique. "Best method" according to what criterion? $\endgroup$ – AccidentalFourierTransform Jul 21 '18 at 18:05
  • 1
    $\begingroup$ Alright, scratch best method. Give me any method so we can begin discussion. I could care less if it's the best. $\endgroup$ – ylluminate Jul 21 '18 at 18:09
  • 1
    $\begingroup$ What process generated the "semi-random series of numbers"? What do you know about that process? What does the theory of that process indicate about the expected statistical nature of its output? $\endgroup$ – Bob Hanlon Jul 21 '18 at 18:10
  • 1
    $\begingroup$ I do not know. There are patterns at some points and then the patterns go away at other points. I was hoping that Mathematica could make some sense out of the series and then extrapolate some additional expansion to the series that would make sense. $\endgroup$ – ylluminate Jul 21 '18 at 18:16
  • 1
    $\begingroup$ Ah ha, I found an anomaly in the data that was not removed in the set. There were 1/2 steps on 4 of the data points that were throwing it off and it was not clear that these were present at first. Once I removed these the rest of the data fell inline and I was able to just simply use Series -> AutoFill in Excel to extrapolate the future figures in question. I'll adjust the question accordingly as I think it will be much cleaner now and probably has been asked before even at this point given that I can frame it in terms of how Excel Series AutoFill works. $\endgroup$ – ylluminate Jul 21 '18 at 18:52

The first thing you need to do is calculate what formula is in play behind your list. Consider the following:

list={33.25, 33.5625, 33.875, 34.1875, 34.5, 34.8125, 35.125, 35.4375, 35.75, 36.0625, 36.375, 36.6875, 37.}

You can calculate the formula behind this list with this code:

fit = FindFormula[list]
(*32.9375 + 0.3125 #1 &*)

As you can see, Mathematica calculates that your list starts with 32.9375 and then adds 0.3125 to it. Using this, you can now calculate the list as long as you want. For instance, currently you only have the first 13 values for list, but if you want to extend that to the first 20, you can use this:

(*{33.25, 33.5625, 33.875, 34.1875, 34.5, 34.8125, 35.125, 35.4375, 35.75, 36.0625, 36.375, 36.6875, 37., 37.3125, 37.625, 37.9375, 38.25, 38.5625, 38.875, 39.1875}*)

The example above uses very simple formulas, but it should work for any pattern and actually offer you much more robustness than Excel AutoFill.

Original Answer:

The OP's original question only referred to generating random numbers. As such, here is the simple answer:

If you are wanting a list of random integers, you can use code such as this:

RandomInteger[{0, 100}, 50]

That will give you 50 integers between 0 and 100. Of course you can set your own parameters.

If you are looking for real numbers, you can use the following:

RandomReal[{0, 100}, 50]

There are quite a few more options you can read about in this Wolfram Guide.

  • $\begingroup$ I think the OP wants the data to follow a linear fit or something, rather than being random $\endgroup$ – b3m2a1 Jul 21 '18 at 19:08
  • 1
    $\begingroup$ @b3m2a1 The OP completely changed the question. $\endgroup$ – kickert Jul 21 '18 at 19:46
  • 1
    $\begingroup$ I just read the change log. Entirely reasonable answer to the original question. $\endgroup$ – b3m2a1 Jul 21 '18 at 19:49

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.