Displaying 20 results from an estimated 9000 matches similar to: "quntile(table)?"
2008 Jan 07
2
How should I improve the following R code?
I'm looking for a way to improve code that's proven to be inefficient.
Suppose that a data source generates the following table every minute:
Index Count
------------
0 234
1 120
7 11
30 1
I save the tables in the following CSV format:
time,index,count
0,0:1:7:30,234:120:11:1
1,0:2:3:19,199:110:87:9
That is, each line represents a table, and I
2009 Jan 19
1
conditional weighted quintiles
Dear All,
I am economist and working on poverty / income inequality. I need descriptive
statitics like the ratio of education expentitures between different income
quintiles where each household has a different weight. After a bit of
google search I found 'Hmisc' and 'quantreg' libraries for weighted quantiles.
The problem is that these packages give me only weighted quintiles;
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 Mar 16
4
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
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]]
2012 Nov 19
5
help on matrix column removal based on another matrix results
Hi everyone, now I am trying to finish writing the code (I had asked for
assistance on subtracting arrays)
This is what I what I am running in R:
> source("/home/ie/Documents/TTU/GA_Research/GLUE/R-Project/R_GLUE_Example/NSEr.R")
NSEr <- function (obs, sim)
{
{jjh <- (as.vector(obs) - sim)^2
Xjjhs <- apply(Xjjh, 2, sum)
Yii <- (obs - mean(obs))^2
Yiis <- apply(Yii, 2,
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
2017 Nov 24
2
number to volume weighted distribution
Hi Duncan
I tried Ecdf and/or wtd.quantile from Hmisc and it is working (probably).
Ecdf(x, q=.5)
Ecdf(x, weights=xw,col=2, add=T, q=.5)
wtd.quantile(x)
0% 25% 50% 75% 100%
10 10 10 100 300
wtd.quantile(x, weights=xw, type="i/n")
0% 25% 50% 75% 100%
10.0000 138.8667 192.5778 246.2889 300.0000
But could you please be more specific in this?
>
2017 Nov 24
0
number to volume weighted distribution
Hi Petr,
I think that Duncan suggests something like this:
x<- c(rep(10,20), rep(300,5), rep(100, 10))
tx <- table(x)
prop.x <- tx / sum(tx)
vx <- as.integer(names(tx))
prop.wx <- tx * vx / sum(tx * vx)
plot(ecdf(x))
plot(vx, cumsum(prop.x), ylim = 0:1)
plot(vx, cumsum(prop.wx), ylim = 0:1)
Best regards,
Thierry
ir. Thierry Onkelinx
Statisticus / Statistician
Vlaamse
2010 Oct 01
2
function which can apply a function by a grouping variable and also hand over an additional variable, e.g. a weight
Hi,
I was wondering if there is an easy way to accomplish the following in R:
Often I want to apply a function, e.g. weighted.quantile from the Hmisc package
to grouped subsets of a data.frame (grouping variable) but then I also need to
hand over the weights which seems not possible with summaryBy or aggregate or
the like.
Is there a function to do this? Currently I do this with loops but it
2007 Feb 07
3
boxplot statistics in ggplot
I need to make weighted boxplots. I found that ggplot makes them. I
would however like to label them with the boxplot statistics (the
median, q1 and q3). In the boxplot function in r-base, I could output
boxplot statistics and then write a text on the plot to place the
labels. How would one do it with ggplot?
Vikas
2006 Aug 30
5
working with summarized data
The data sets I am working with all have a weight variable--e.g.,
each row doesn't mean 1 observation.
With that in mind, nearly all of the graphs and summary statistics
are incorrect for my data, because they don't take into account the
weight.
****
For example "median" is incorrect, as the quantiles aren't calculated
with weights:
sum( weights[X < median(X)] )
2004 Nov 26
2
(no subject)
Good afternoon,
I'd like to know how to superimpose a Student distribution pt on a
histogram. I think I have to use the plot function but I don,t know the
details.
Other question: what is a quntile function?
Can you help me?
Thank you.
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
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
2010 May 17
3
applying quantile to a list using values of another object as probs
Hi r-users,
I have a matrix B and a list of 3x3 matrices (mylist). I want to
calculate the quantiles in the list using each of the value of B as
probabilities.
The codes I wrote are:
B <- matrix (runif(12, 0, 1), 3, 4)
mylist <- lapply(mylist, function(x) {matrix (rnorm(9), 3, 3)})
for (i in 1:length(B))
{
quant <- lapply (mylist, quantile, probs=B[i])
}
But quant
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
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