Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Very regular pattern of the variance profile #22

Closed
skycolt opened this issue Oct 3, 2019 · 3 comments · Fixed by #24
Closed

Very regular pattern of the variance profile #22

skycolt opened this issue Oct 3, 2019 · 3 comments · Fixed by #24

Comments

@skycolt
Copy link

skycolt commented Oct 3, 2019

Screen Shot 2019-10-03 at 3 59 28 PM

Hello,

I am doing simulation with simple simulation and plot command.
result = simulate(model, Direct(), time = 10000.0, epochs = 50, trials = 1000)
plot(result; plot_type = :meantrajectory)

I got the result that you can see from the attached picture. There are very regular patterns for the variance of all the variables. if you look carefully, similar pattern also exist for your example. as a stochastic simulation, I don't expect the variance to change so regularly. Do you think it a problem? Is there something I can do like to choose a better random number generator?

Thanks

@skycolt
Copy link
Author

skycolt commented Oct 3, 2019

I get the data from result file and drew the figure myself. It now looks like this:
Screen Shot 2019-10-03 at 5 08 49 PM

I think you may have something wrong in your plot function, maybe on calculating the error.

@alanderos91
Copy link
Owner

I have not seriously considered whether the built-in RNG is appropriate for stochastic simulation in general. Adding other RNG types is straightforward, but I have not introduced it yet (I've been working on a rather big change offline).

That being said, I don't think the RNG is causing the regular pattern. I have come across this myself but never been able to reproduce it (but it happens often enough). I suspected it is related to the way the "regular paths" are constructed. Measurements over regular intervals are binned; see here.

How did you simulate the data you plotted in your second figure? If you used the "fixed interval" option then it isolates the problem to the plotting recipe here.

@skycolt
Copy link
Author

skycolt commented Oct 4, 2019

Now I don't think it's the problem of RNG but that's definitely an option great to have. I used the following code to generate the cure for one species. It looks like the problem is somewhere post simulation.

result = simulate(model, OptimizedDirect(), time = 10000.0, epochs = 200, trials = 2000)
data=result.simulation_data
for i=1:2000
s1[i,:]=data[i].xdata[1,:]
end
plot(1:201,mean(s1,dims=1)',yerr=std(s1,dims=1)')

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants