## Calculation of standard deviation in stochastic simulation

For technical support, tips and tricks, suggestions, or any other information regarding the EViews model object.

Moderators: EViews Gareth, EViews Moderator, EViews Chris

DannyBachman
Posts: 5
Joined: Fri Apr 13, 2012 11:24 am

### Calculation of standard deviation in stochastic simulation

When you do a stochastic simulation, you can get confidence limits and a standard deviation series. How are these calculated?

EViews Gareth
Fe ddaethom, fe welon, fe amcangyfrifon
Posts: 11811
Joined: Tue Sep 16, 2008 5:38 pm

### Re: Calculation of standard deviation in stochastic simulati

Confidence interval is based on standard deviation. Standard deviation is simply calculated in the normal way from the simulation results.

DannyBachman
Posts: 5
Joined: Fri Apr 13, 2012 11:24 am

### Re: Calculation of standard deviation in stochastic simulati

Sorry, you will have to pretend I am especially dense here (not hard to do, really). What is the "normal" way? Is that the sample standard deviation for a given period just the standard formula calculated for the observations for all the simulations in that period? I just want to be sure I understand.

EViews Gareth
Fe ddaethom, fe welon, fe amcangyfrifon
Posts: 11811
Joined: Tue Sep 16, 2008 5:38 pm

### Re: Calculation of standard deviation in stochastic simulati

At each observation of the solve, calculate the standard deviation of the simulated solution values. So you're not calculating a standard deviation across time periods, rather across stochastic solves.

DannyBachman
Posts: 5
Joined: Fri Apr 13, 2012 11:24 am

### Re: Calculation of standard deviation in stochastic simulati

Thanks, Gareth. I think we are saying the same thing (you are confirming what I thought). We are working on getting the confidence limits directly from the simulations (e.g.), picking out the 97.5th highest and lowest simulation) rather than using the calculated standard deviations.

EViews Gareth
Fe ddaethom, fe welon, fe amcangyfrifon
Posts: 11811
Joined: Tue Sep 16, 2008 5:38 pm

### Re: Calculation of standard deviation in stochastic simulati

To be more concrete:

Code: Select all

`create(page=page1) d5 1990 1991rndseed 1series y=nrndseries x=nrndequation eq1.ls y c xeq1.makemodel(m)m.stochastic(p=page2)m.solve(s=s)show y_0spageselect page2series sd = @stdevpsby(y_0, @obsid)show sd`