Displaying 20 results from an estimated 10000 matches similar to: "Plotting and quantiles"
2010 Aug 01
3
remove extreme values or winsorize – loop - dataframe
Hi everyone!
#I need a loop or a function that creates a X2 variable
that is X1 without the extreme values (or X1 winsorized)
by industry and year.
#My reproducible example:
firm<-sort(rep(1:1000,10),decreasing=F)
year<-rep(1998:2007,1000)
industry<-rep(c(rep(1,10),rep(2,10),rep(3,10),rep(4,10),rep(5,10),rep(6,10),rep(7,10),rep(8,10),rep(9,10),
rep(10,10)),1000)
X1<-rnorm(10000)
2010 Jul 07
3
quantiles on rows of a matrix
I'm trying to obtain the mean of the middle 95% of the values from each row
of a matrix (that is, the highest and lowest 2.5% of values in each row
are removed before calculating the mean). I am having all sorts of
problems with this; for example the command:
apply(matrix1,1,function(x) quantile(c(.05,.90),na.rm=T))
returns the exact same quantile values for each row, which is clearly
2003 May 29
2
R summary
Dear all
i use R only a few days and don't understand the difference between
fivenum(x) und summary(x).
> x
[1] 20.77 22.56 22.71 22.99 26.39 27.08 27.32 27.33 27.57 27.81 28.69 29.36
[13] 30.25 31.89 32.88 33.23 33.28 33.40 33.52 33.83 33.95 34.82
> fivenum(x)
[1] 20.770 27.080 29.025 33.280 34.820
> summary(x)
Min. 1st Qu. Median Mean 3rd Qu. Max.
20.77 27.14
2009 Jan 16
2
Winsorizing Multiple Variables
Hi All,
I want to take a matrix (or data frame) and winsorize each variable.
So I can, for example, correlate the winsorized variables.
The code below will winsorize a single vector, but when applied to
several vectors, each ends up sorted independently in ascending order
so that a given observation is no longer on the same row for each
vector.
So I need to winsorize the variable but
2007 Feb 05
3
Confidence intervals of quantiles
Can anyone please tell me if there is a function to calculate confidence
intervals for the results of the quantile function.
Some of my data is normally distributed but some is also a squewed
distribution or a capped normal distribution. Some of the data sets contain
about 700 values whereas others are smaller with about 100-150 values, so I
would like to see how the confidence intervals change
2012 Jan 03
6
calculate quantiles of a custom function
Hi,
I guess that my problem has an obvious answer, but I have not been able to
find it.
Suppose I create a custom function, consisting of two beta-distributions:
myfunction <- function(x) {
dbeta(x,2,6) + dbeta(x,6,2)
}
How can I calculate the quantiles of myfunction?
I have not seen any continous function treated in the docs, and applying the
"quantile function" gives me an
2013 Feb 19
3
Quantiles of a subset of data
bradleyd wrote
> Excuse the request from an R novice! I have a data frame (DATA) that has
> two numeric columns (YEAR and DAY) and 4000 rows. For each YEAR I need to
> determine the 10% and 90% quantiles of DAY. I'm sure this is easy enough,
> but I am a new to this.
>
>> quantile(DATA$DAY,c(0.1,0.9))
> 10% 90%
> 12 29
>
> But this is for the entire
2012 Feb 13
1
non linear quantile regression - Median not plotting where it should
Hi,
I'm attempting to calculate the 0.25 and 0.97 quantiles for tree height (0-50 meters) against tree age (0-300 years) and I am running into some difficulty with the plotted grafic. I've run the examples in the quantreg help and can get those to work properly and by plugging in my data I can also get the lines plotted on my dataset. Unfortunately I'm running into a problem with the
2006 Mar 03
2
Compute quantiles with values and correspondent frequencies
Dear List,
quantile(x) function allows to obtain specified quantiles of a vector of observations x.
Is there an analogous function to compute quantiles in the case one have the vector of the observations x and the correspondent vector f of relative frequencies ?
Thank you
Paolo Radaelli
[[alternative HTML version deleted]]
2006 Apr 19
1
Hmisc + summarize + quantile: Why only quantiles for first variable in data frame?
Hi,
I'm working on a data set that contains a couple of factors and a
number of dependent variables. From all of these dependent variables
I would like to calculate mean, standard deviation and quantiles.
With the function FUN I get all the means and stdev that I want but
quantiles are only calculated for the first of the dependent
variables (column 8 in the summarize command). What do I
2011 Feb 17
7
removing lower and upper quantiles from an arry
I'm trying to work out the simplest way to remove the upper and lower quantiles, in this case upper and lower 25% from an array. I can do it in two steps but when I try it in one, it fails. Is there something simple missing from my syntax or are there other simple elegant way to accomplish this?
Thanks
J
> i <-1:20
> i2 <- i[i<quantile(i,.75)]
> i3 <-
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
2003 May 30
0
R summary (and quantiles)
When all else fails, read the help page...
?fivenum says to look at ?boxplot.stats, and the "Details" section of
?boxplot.stats has, well, details. Tukey had reasons to call those hinges
rather than quartiles.
Andy
> -----Original Message-----
> From: Knut M. Wittkowski [mailto:kmw at rockefeller.edu]
> Sent: Thursday, May 29, 2003 5:58 PM
> To: Matthias Kirschner
>
2008 Oct 07
2
weighted quantiles
I have a set of values and their corresponding weights. I can use the
function weighted.mean to calculate the weighted mean, I would like to be
able to similarly calculate the weighted median and quantiles? Is there a
function in R that can do this?
thanks,
Spencer
[[alternative HTML version deleted]]
2009 Feb 17
6
Percentiles/Quantiles with Weighting
Hi All,
I am looking at applications of percentiles to time sequenced data. I had
just been using the quantile function to get percentiles over various
periods, but am more interested in if there is an accepted (and/or
R-implemented) method to apply weighting to the data so as to weigh recent
data more heavily.
I wrote the following function, but it seems quite inefficient, and not
really very
2010 Jan 17
1
Confusion in 'quantile' and getting rolling estimation of sample quantiles
Guys:
1).When I using the 'quantile' function, I get really confused. Here is what
I met:
> x<-zoo(rnorm(500,0,1))
> quantile(x,0.8)
400
1.060258
> c=rnorm(500,0,1)
> quantile(c,0.8)
80%
0.9986075
why do the results display different? Is that because of the different type
of the class?
2).And I want to use the 'rollapply' function to compute a
2006 Mar 11
1
Quicker quantiles?
Motivated by Deepayan's recent inquiries about the efficiency of the
R 'quantile'
function:
http://tolstoy.newcastle.edu.au/R/devel/05/11/3305.html
http://tolstoy.newcastle.edu.au/R/devel/06/03/4358.html
I decided to try to revive an old project to implement a version of
the Floyd
and Rivest (1975) algorithm for finding quantiles with O(n)
comparisons. I
used
2008 Oct 20
4
aggregating along bins and bin-quantiles
Dear all,
I would like to aggregate a data frame (consisting of 2 columns - one
for the bins, say factors, and one for the values) along bins and
quantiles within the bins.
I have tried
aggregate(data.frame$values, list(bin = data.frame
$bin,Quantile=cut2(data.frame$bin,g=10)),sum)
but then the quantiles apply to the population as a whole and not the
individual bins. Upon this
2007 Nov 30
2
Quantiles and QQ plots
I have 20 variables:
5,9,6,1,5,9,7,4,5,6,3,2,4,8,9,6,1,8,4,8
How do I calculate the corresponding quantiles from a normal distribution
with the same mean and variance as the sample?
Also, how do I draw a QQ plot of the data?
Thanks for any help!
--
View this message in context: http://www.nabble.com/Quantiles-and-QQ-plots-tf4925742.html#a14097909
Sent from the R help mailing list archive at
2005 Nov 30
2
OT: Statistics question
I apologise for asking this question here but I am hoping that someone
can either give me direct guidance and/or point me to a better group for
this type of disucssion.
I have what I feel should be a fairly simple problem but which my
limited stats knowledge can't answer. I have two overlapping
distributions (both normal) and I want to answer the question how do I
calculate the cut-off value