Hi there! Still struggling to translate Matlab code into R's tsDyn package.
Here is my question: Is there in R an equivalent function to Matlab's
prctile()? To the moment I thought it was quantile(), but I just
realized I was wrong. The definition of the Matlab function:
prctile
Percentiles of a
It looks like
prctile(X,p) is the same as quantile(X,p)
i.e
x<-0:100
quantile(x,0.5) is the median(x)
and
quantile(x,0.1)=10 is the value that is greater than 10% percent of the
values in X
"José Luis Aznarte M." wrote:
>
> Hi there! Still struggling to translate Matlab code into R's tsDyn
>
Hola Jose Luis,
Sure, you can use quantile(). Use the probs argument. For example, to
get the median do
quantile(X,probs=0.5).
Do ?quantile to learn about the different type of quantiles calculated
by the funcion.
Saludos,
Julian
Jose Luis Aznarte M. wrote:
> Hi there! Still struggling t
Thank you all! But the problem is that quantile() returns "how many
data" are greater than p percent, and not a value in the domain of the
vector under scrutiny. For example, I have a vector
> x
[1] "-0,39559" "1,1916""0,23214" "1,656" "-0,3439" "-0,50568"
[7] "0,52281" "0,
Original Message
Subject: Re: [R] Percentiles in R
From: Jose Luis Aznarte M. <[EMAIL PROTECTED]>
To: [EMAIL PROTECTED]
Date: 11.09.2007 19:09
> Thank you all! But the problem is that quantile() returns "how many
> data" are greater than p percent,
Try
quantile(x, .1, type=1)
or read
?quantile
for other options.
url:www.econ.uiuc.edu/~rogerRoger Koenker
email[EMAIL PROTECTED]Department of Economics
vox: 217-333-4558University of Illinois
fax: 217-244-6678
On Tue, Sep 11, 2007 at 07:09:24PM +0200, Jose Luis Aznarte M. wrote:
> Thank you all! But the problem is that quantile() returns "how many
> data" are greater than p percent, and not a value in the domain of the
> vector under scrutiny. For example, I have a vector
not quite, quantile retur
Ok, of course you were right. As Stefan pointed out, it was a
problem of the type of the vector: it was a factor and hence the
quantile was not what expected. Thank you all!!
Jose Luis Aznarte M. escribió:
> Hi there! Still struggling to translate Matlab code into R's tsDyn package.
> Here i
8 matches
Mail list logo