Let's say I have a series: Y
(with 100 observations: Obs1:2.3, Obs2:1.3, Obs3:4.2,..,Obs99:86.7,Obs100:56.7)
I sort the variable Y, using sort(a), and call it: YS
(with the values: Obs1:1.3, Obs2:2.3, Obs3:2.4, Obs4:2.9, Obs5:5.6, Obs6:7.4,...,Obs94:94.3, Obs95:95.2, Obs96:96.1, Obs97:96.4, Obs98:99.4, Obs99:99.6, Obs100:99.7).
I know I can use @quantile to give me the e.g. the 5% percentile (in this case 5.6), or 95% percentile (in this case 96.1). However, this is not what I want. I want the following:
I HAVE A SCALAR THAT WILL SERVE AS A CUT-OFF POINT. IF MY SCALAR IS E.G. 99.2 I WANT TO KNOW HOW MANY PERCENT OF THE OBSERVATIONS IN THE SERIES "YS" THAT ARE HIGHER/LOWER. In this case 3% of the observations are higher,and 97% of the observations in YS are lower, so this value 99.2 should be the 97th percentile. In this case I want to save the value 0.9700, so 0.9700 is the value I look for.
IN SUMMARY, I WANT TO SEE HOW MANY PERCENT OF THE OBSERVATIONS IN SERIES YS THAT ARE LOWER/HIGHER THAN A SCALAR THAT I HAVE (WITHOUT MAKING ANY DISTRIBUTIONAL ASSUMPTIONS).
Do you have any command for this? This can be used for many purposes but for example to find a pvalue.
percentile
Moderators: EViews Gareth, EViews Moderator, EViews Jason, EViews Matt
-
startz
- Non-normality and collinearity are NOT problems!
- Posts: 3796
- Joined: Wed Sep 17, 2008 2:25 pm
Re: percentile
@mean(Y<99.2)
Re: percentile
You can as well store it as a scalar:
smpl if Y<99.2
!pval=@obs(Y)/@obsrange
smpl @all
And I have one question, the manual defines @obs(x[,s]) suggesting that a sample may be defined but
!pval=@obs(Y,"if Y<99.2")/@obsrange doesn't work for me
is there an alternative syntax?
Javier
smpl if Y<99.2
!pval=@obs(Y)/@obsrange
smpl @all
And I have one question, the manual defines @obs(x[,s]) suggesting that a sample may be defined but
!pval=@obs(Y,"if Y<99.2")/@obsrange doesn't work for me
is there an alternative syntax?
Javier
Who is online
Users browsing this forum: No registered users and 2 guests
