Page 1 of 1

standard deviation and average

Posted: Tue Jan 29, 2019 3:56 pm
by miorinnovo
I'd like to create charts of my variables that include the average and the standard deviation of each series. SO the first variable x1 would be plotted against the average of x1 and the average of x1 plus and minus the standard deviation. Now in order to do this I believe I have to create a scalar for each and then generate a new series of that one variable repeated. I have many variables with different naming conventions. My question, is there a simple way to program the creation of these scalars and series? Thanks!

Re: standard deviation and average

Posted: Tue Jan 29, 2019 4:38 pm
by EViews Matt
Hello,

My quick-and-dirty way to create such graphs is via a group, e.g.,

Code: Select all

group g x1 @mean(x1) @mean(x1)+@stdev(x1) @mean(x1)-@stdev(x1) g.line
The graph can be frozen and it's line styles, legend, etc., modified to create the look you want.

Re: standard deviation and average

Posted: Tue Jan 29, 2019 6:36 pm
by miorinnovo
Thats so much better than what i was going for. Thanks!

And can I program this for all variables in one shot somehow?

Re: standard deviation and average

Posted: Wed Jan 30, 2019 10:02 am
by EViews Matt
Sure, you can always introduce a loop that will iterate through your series. For example,

Code: Select all

%series = @wlookup("*", "series") for %s {%series} group g {%s} @mean({%s}) @mean({%s})+@stdev({%s}) @mean({%s})-@stdev({%s}) %graph_name = %s + "_graph" freeze({%graph_name}) g.line next delete g

Re: standard deviation and average

Posted: Wed Jan 30, 2019 1:22 pm
by miorinnovo
Fantastic, thanks!