Mathematica Stack Exchange is a question and answer site for users of Mathematica. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I am trying to find the best-fit trend for my data. Here I just generated it but let's say I don't know my data trend at all.

test = RandomVariate[NormalDistribution[100, 10], 100];
data = TemporalData[test];
proc = EstimatedProcess[data, ARMAProcess[3, 3]];
forecast = TimeSeriesForecast[proc, data, {5}, Method -> Automatic]
sims = RandomFunction[proc, {0, 10^2}, 4];
ListLinePlot[Join[data["Paths"], sims["Paths"]], 
PlotStyle -> {Directive[Thick, ColorData[1, 1]], ColorData[10, 1], 
ColorData[10, 2], ColorData[10, 3], ColorData[12, 4]}, 
PlotLegends -> {"data", "Simulations"}, ImageSize -> 550]

As results of the fit shows, neither of AutoRegressive methods of Mathematica are being fitted to my data. How can I use the Euler-Maruyama method mentioned here and disscuded here for fitting my data and have the fitness test data for it? How can I also do the Monte Carlo simulations for them and show upper, lower bound and mean of simulations on my data?

share|improve this question
Isn't the problem that your data is non-zero mean? A common method is to subtract out the mean, do the fit with zero-mean data, and then add it back at the end. It's just a constant. – bill s Jun 19 '13 at 3:27
@bills yes you are right.I just notice the mistake in the first line of the code.But still I have fitness problem cause the result table is not giving proper P values .How can I use the Euler-Maruyama? – Alex Jun 19 '13 at 5:45
Is it imperative to use auto-regressive and/or Monte-Carlo methods? If not, Quantile Regression can be applied to find the trend and conditional PDF's. After finding a sufficient number of PDF's we can form a goodness of fit test. – Anton Antonov Feb 29 at 21:40

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Browse other questions tagged or ask your own question.