How do I emulate Excel's Series AutoFill function?

2

1

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?

2The answer is highly non-unique. "Best method" according to what criterion? – AccidentalFourierTransform – 2018-07-21T18:05:47.460

1Alright, scratch best method. Give me any method so we can begin discussion. I could care less if it's the best. – ylluminate – 2018-07-21T18:09:34.483

1What 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? – Bob Hanlon – 2018-07-21T18:10:44.493

1I 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. – ylluminate – 2018-07-21T18:16:40.377

1Ah 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. – ylluminate – 2018-07-21T18:52:47.777

1@ylluminate, you have completely changed the question after receiving a valid answer to your original question. – kickert – 2018-07-21T20:03:29.277

1Unfortunately the answer was not valid from what I can tell. It really didn't line up with my intention at all since it didn't have an actual random component to it, but perhaps you read it differently than I had intended it or I simply did not verbalize it properly. But thanks very much for answering and I've accepted it & calling this done. :) – ylluminate – 2018-07-21T22:43:30.790

1@ylluminate, The function FindFormula will work regardless of how standardized the data is that you throw at it. Give it a shot... you can throw a completely random list at it and it will still try to match the formula and you can extrapolate the list just like Excel AutoFill. As noted, Mathematica is much more robust. If you are looking to do curve fitting for a given dataset, there are a lot of other guides out there to outline that process. – kickert – 2018-07-21T23:33:34.133

1

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:

fit[Range[20]]
(*{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.

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.

I think the OP wants the data to follow a linear fit or something, rather than being random – b3m2a1 – 2018-07-21T19:08:02.440

1@b3m2a1 The OP completely changed the question. – kickert – 2018-07-21T19:46:23.213

1I just read the change log. Entirely reasonable answer to the original question. – b3m2a1 – 2018-07-21T19:49:05.653