# search for: quantile

Displaying 20 results from an estimated 420 matches for "quantile".

2006 Mar 16
5
problem for wtd.quantile()
Dear R-users, I don''t know if there is a problem in wtd.quantile (from library "Hmisc"): -------------------------------- x <- c(1,2,3,4,5) w <- c(0.5,0.4,0.3,0.2,0.1) wtd.quantile(x,weights=w) ------------------------------- The output is: 0% 25% 50% 75% 100% 3.00 3.25 3.50 3.75 4.00 The version of R I am using is: 2.1.0 Best,Jing
2012 Jul 14
1
Quantile Regression - Testing for Non-causalities in quantiles
Dear all, I am searching for a way to compute a test comparable to Chuang et al. ("Causality in Quantiles and Dynamic Stock Return-Volume Relations"). The aim of this test is to check wheter the coefficient of a quantile regression granger-causes Y in a quantile range. I have nearly computed everything but I am searching for an estimator of the density of the distribution at several points of th...
2008 Sep 27
3
quantile / centile
I''m wondering if there is a simple way to assign a quantile to a vector in a data frame, much like one could in Stata using centile. Let''s say I want 100 slices in my assignation. I can easily see what the limits of each slice by using quantile: quantile(my.df\$my.var, probs=seq(0, 1, 0.01)) But how do I assign the appropriate value to each row/...
2009 Jul 21
5
how to change the "quantile" method in bwplot
Hi, everyone, Since quantile calculation has nine different methods in R, I wonder how I specify a method when calling the bwplot() in lattice. I couldn''t find any information in the documentation. Thanks. -- Jun Shen PhD PK/PD Scientist BioPharma Services Millipore Corporation 15 Research Park Dr. St Charles, M...
2018 Apr 19
2
create multiple categorical variables in a data frame using a loop
Hi All, I want to create a categorical variable, cat.pfoa, in the file of pfas.pheno (a data frame) based on log2pfoa values. I can do it using the following code. pfas.pheno <-within(pfas.pheno, {cat.pfoa<-NA cat.pfoa[pfas.pheno\$log2pfoa <=quantile(pfas.pheno\$log2pfoa,0.25, na.rm =T)]<-0 cat.pfoa[pfas.pheno\$log2pfoa >=quantile(pfas.pheno\$log2pfoa,0.75, na.rm =T)]<-2 cat.pfoa[pfas.pheno\$log2pfoa >=quantile(pfas.pheno\$log2pfoa,0.25, na.rm =T) &pfas.pheno\$log2pfoa <=quantile(pfas.pheno\$log2pfoa,0.75, na.rm =T)]&...
2017 Jun 15
1
"reverse" quantile function
David, thanks for the response. In your response the quantile function (if I see correctly) runs on the columns versus I need to run it on the rows, which is an easy fix, but that is not exactly what I had in mind... essentially we can remove t() from my original code to make "res" look like this: res<-apply(z, 1, quantile, probs=c(0.3)) but...
2017 Jun 16
2
"reverse" quantile function
It would depend on which one of the 9 quantile definitions you are using. The discontinuous ones aren't invertible, and the continuous ones won't be either, if there are ties in the data. This said, it should just be a matter of setting up the inverse of a piecewise linear function. To set ideas, try x <- rnorm(5) curve(quantile(...
2016 Apr 19
2
Interquartile Range
...#39;s function had a typo in it - was that the problem? Or did you not change the call to ddply to use that function. Here is something that might "work" for you: library(plyr) data <- data.frame(groupColumn=rep(1:5,1:5), col1=2^(0:14)) myIqr <- function(x) { paste(round(quantile(x,0.25),0),round(quantile(x,0.75),0),sep="-") } ddply(data, ~groupColumn, summarise, col1_myIqr=myIqr(col1), col1_IQR=stats::IQR(col1)) # groupColumn col1_myIqr col1_IQR #1 1 1-1 0 #2 2 2-4 1 #3 3 12-24 12 #4...
2017 Jun 15
1
"reverse" quantile function
...as via R-help <r-help at r-project.org> wrote: > > Dear All, > > we have: > > t<-seq(0,24,1) > a<-10*exp(-0.05*t) > b<-10*exp(-0.07*t) > c<-10*exp(-0.1*t) > d<-10*exp(-0.03*t) > z<-data.frame(a,b,c,d) > > res<-t(apply(z, 1, quantile, probs=c(0.3))) > > > > my goal is to do a 'reverse" of the function here that produces "res" on a data frame, ie: to get the answer 0.3 back for the percentile location when I have "res" available to me... For a single vector this would be done using ec...
2012 Oct 30
12
standard error for quantile
Dear all I have a question about quantiles standard error, partly practical partly theoretical. I know that x<-rlnorm(100000, log(200), log(2)) quantile(x, c(.10,.5,.99)) computes quantiles but I would like to know if there is any function to find standard error (or any dispersion measure) of these estimated values. And here is a the...
2016 Apr 19
1
Interquartile Range
To be precise: paste(round(quantile(x,0.25),0),round(quantile(x,0.75),0),sep="-") is an expression that evaluates to a character string: "round(quantile(x,.25),0) - round(quantile(x,0.75),0)" no matter what the argument of your function, x. Hence return(paste(...)) will return this exact character string and ne...
2016 Apr 19
1
Interquartile Range
...ith having an open mind is that people keep coming along and sticking things into it." -- Opus (aka Berkeley Breathed in his "Bloom County" comic strip ) On Tue, Apr 19, 2016 at 10:25 AM, Bert Gunter <bgunter.4567 at gmail.com> wrote: > To be precise: > > paste(round(quantile(x,0.25),0),round(quantile(x,0.75),0),sep="-") > > is an expression that evaluates to a character string: > "round(quantile(x,.25),0) - round(quantile(x,0.75),0)" > > no matter what the argument of your function, x. Hence > > return(paste(...)) will return th...
2009 Jun 09
5
Non-linear regression/Quantile regression
Hi, I''m relatively new to R and need to do a quantile regression. Linear quantile regression works, but for my data I need some quadratic function. So I guess, I have to use a nonlinear quantile regression. I tried the example on the help page for nlrq with my data and it worked. But the example there was with a SSlogis model. Trying to write dat.nl...
1998 Feb 12
1
R-beta: Quantile function
Is the following behaviour of the quantile function what one would expect? > a <- 1:100 > quantile(a,.6) 60% 60.4 Philippe -.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.- r-help mailing list -- Read http://www.ci.tuwien.ac.at/~hornik/R/R-FAQ.html Send "info", &quot...
2011 Mar 28
2
quantile function -> I need only the quantile value itself
Hi, I am using the quantile function currently and I have just bumped into a little problem. I have a very small data frame something like this: small_df <- c(7,3,4,7,1,10,12,1,12,4,4,8,6,11,9,10,4,13,3,9,6,5,2,10,7,14,2,7,10,10,7,8,2,11,3,10,11,3,11,14,12,7,6,11) small_df Now in the next step I would like to calculate...
2005 Jul 09
2
Quantile normalization and NA
Hi, I am new to R, I am doing quantile normalization with a dat matix of 384X124 and I find that while computing the quantile normailzation it introduces ''NA'' into some of the cells, can someone help me to overcome this problem ? This is the command that goes like upto g62 for 124 colomns >g1 <- normalize.quan...
2018 Apr 19
1
create multiple categorical variables in a data frame using a loop
Hello, When programming it is better to use dat[["variable"]] than dat\$variable. So your code could be pfas.pheno[[cat.var]] <- NA pfas.pheno[[cat.var]][pfas.pheno[,i] <= quantile(pfas.pheno[,i],0.25, na.rm =T)] <- 0 etc. Untested. Hope this helps, Rui Barradas On 4/19/2018 7:20 PM, Ding, Yuan Chun wrote: > Hi All, > > I want to create a categorical variable, cat.pfoa, in the file of pfas.pheno (a data frame) based on log2pfoa values. I can do it u...
2016 Apr 19
1
Interquartile Range
...ple keep coming along > and sticking things into it." > -- Opus (aka Berkeley Breathed in his "Bloom County" comic strip ) > > > On Tue, Apr 19, 2016 at 10:25 AM, Bert Gunter <bgunter.4567 at gmail.com> wrote: >> To be precise: >> >> paste(round(quantile(x,0.25),0),round(quantile(x,0.75),0),sep="-") >> >> is an expression that evaluates to a character string: >> "round(quantile(x,.25),0) - round(quantile(x,0.75),0)" >> >> no matter what the argument of your function, x. Hence >> >> retur...
2002 May 14
2
quantile() and boxplot.stats()
Hello, I faced something I can''t understand. When I use boxplot.stats(1:10) and quantiles(1:10) the results are different for 25% and 75%: > boxplot.stats(1:10) \$stats  1.0 3.0 5.5 8.0 10.0 > quantile(1:10) 0% 25% 50% 75% 100% 1.00 3.25 5.50 7.75 10.00 Actually, I expected the value 3 for 25% and 8 for 75% as results of quantile(1:10). Can you please expla...
2016 Apr 19
1
Interquartile Range
...gt; -- Opus (aka Berkeley Breathed in his "Bloom County" comic strip ) >> > >> > >> > On Tue, Apr 19, 2016 at 10:25 AM, Bert Gunter <bgunter.4567 at gmail.com> >> wrote: >> >> To be precise: >> >> >> >> paste(round(quantile(x,0.25),0),round(quantile(x,0.75),0),sep="-") >> >> >> >> is an expression that evaluates to a character string: >> >> "round(quantile(x,.25),0) - round(quantile(x,0.75),0)" >> >> >> >> no matter what the argument of yo...