Help for calculating quantile with 0 and NA in my series

For questions regarding programming in the EViews programming language.

Moderators: EViews Gareth, EViews Jason, EViews Moderator, EViews Matt

sudesh
Posts: 51
Joined: Fri Nov 03, 2017 7:30 pm

Help for calculating quantile with 0 and NA in my series

Postby sudesh » Wed Dec 13, 2017 4:01 pm

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

EViews Matt
EViews Developer
Posts: 269
Joined: Thu Apr 25, 2013 7:48 pm

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

Postby EViews Matt » Thu Dec 14, 2017 12:09 pm

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.


Return to “Programming”

Who is online

Users browsing this forum: No registered users and 4 guests