Am 31.10.2015 um 11:48 schrieb Schaff, Frederik:
Now it might sometimes be the case (especially if I restrict the
sample) that some of these values, like the median, become constant
expressions. Atm I need to refine the script manually (excluding the
constant variable) each time this happens. At the same time, I lose
all the information regarding the median, say, in the boxplot that is
produced. Is there a way to allow the boxplot command to draw a
"constant" boxplot?
I'm not sure if the error is coming from gnuplot or from gretl. But
would it be an option for you to preprocess the list in gretl and
exclude those series that are constant in-sample? (With a suitable
informative output, of course.) I mean you don't really need the see a
degenerate boxplot, do you?
You could check it like this:
list outlist = null
loop foreach i originallist
if var($i) > 1e-20 # some arbitrary small number
outlist += $i
endif
endloop
and then continue to work with 'outlist'.
I guess a work-around would be to simply add a
very small random number, say U=1e-100, to each of the values of the
series before sending it to the boxplot. Unfortunately I do not know
how to automate this. Is there an easy way to provide some function
like "NonConstList(list or series) " which I could wrap around my
list before plotting (and that does not alter the original data, i.e.
creates a temporary new list each time)?
If you really want to use this trick, you could create a random series
(with bounded support, like the uniformly distributed), like this in the
above loop:
if var($i) < 1e-20
series new$i = $i + uniform() * 1e-10
outlist += new$i
endif
hth,
sven