Page 1 of 1

Help for calculating quantile with 0 and NA in my series

Posted: Wed Dec 13, 2017 4:01 pm
by sudesh
Hi,

I would like to calculate the quantile of my series however I noticed that it's taking the 0 and NA into consideration.

I would like to know how can I calculate the quantile without the 0 and NA.

The value that I'm looking for correspond to the minimum value:

I think that
@quantile({%j}_{%y}_{%x}_{%i}, 0) = @min({%j}_{%y}_{%x}_{%i})

My code:
string type = "r"
string curlist = "CAD"
string certain = "AU"
string list_eq = "eq2b"


for %j {type}
for %y {curlist}
for %x {list_eq}
for %i {certain}


if @isobject(%j+"_"+%y+"_"+%x+"_"+%i)=1 then
smpl if {%j}_{%y}_{%x}_{%i} <> 0 and {%j}_{%y}_{%x}_{%i} <> na

scalar {%j}_q0_{%y}_{%x}_{%i} = @quantile({%j}_{%y}_{%x}_{%i}, 0)

endif
next
next
next
next

Re: Help for calculating quantile with 0 and NA in my series

Posted: Thu Dec 14, 2017 12:09 pm
by EViews Matt
Hello,

There are many ways to calculate quantiles (from Wolfram MathWorld). The default method used by @quantile will always return NA for the 0-th quantile, regardless of whether there are NAs in your data or not. I believe the only quantile method that would return the minimum of the series for the 0-th quantile is the Gumbel method (add option "g" to @quantile). I assume you want quantiles other than the 0-th otherwise you could just use @min.