Hi Sven,
I verified this and in fact, missing values aren't ignored. If you have
just a single missing value in one of the series that is part of the
list, the resulting mean or sd is NA. So, for example, if you have three
series: A, B, and C, with values 100, 200 and NA for 1960, the resulting
mean for a list with A, B and C is NA, and not 150, as desirable.
Here is the transcript from the function reference:
"If x is a list, returns a series y such that yt is the sample standard
deviation of the values of the variables in the list at observation t,
or NA if there are any missing values at t. "
It seems that the guide and function reference are not in accordance.
--
*Filipe Rodrigues da Costa*
Send me an email to: filipe(a)pobox.io
Reach me through *Telegram* at:
https://t.me/rodriguesdacosta
On Sat, 3 Jun 2017, at 17:53, Sven Schreiber wrote:
Am 03.06.2017 um 17:56 schrieb Filipe Rodrigues da Costa:
> I'm trying to use the functions sd(x), and mean(x) in a list instead of
> a series. From what I understood, these functions ignore NAs when used
> in a series, but when used in a list they return NA if any missing value.
Hi,
have you actually verified that this is really what's happening? In the
guide I see the following explanation:
"The functions max, min, mean, sd, sum and var behave “horizontally”
rather than “vertically” when their argument is a list. For instance,
the following commands
list Xlist = x1 x2 x3
series m = mean(Xlist)
produce a series m whose i-th element is the average of x 1,i ,x 2,i and
x 3,i ; missing values, if any, are implicitly discarded."
To me that sounds as if it works as you intend.
cheers,
sven
_______________________________________________
Gretl-users mailing list
Gretl-users(a)lists.wfu.edu
http://lists.wfu.edu/mailman/listinfo/gretl-users