Displaying 20 results from an estimated 10000 matches similar to: "Moving quantile()?"
2010 Apr 09
2
How to use tapply for quantile
I am trying to calculate quantiles of a data frame column split up by
two factors:
# Calculate the quantiles
quarts = tapply(gdf$tt, list(gdf$Runway, gdf$OnHour), FUN=quantile,
na.rm = TRUE)
This does not work:
> quarts
04L 04R 15R 22L 22R 27 32
33L 33R
0 NULL Numeric,5 NULL Numeric,5 NULL Numeric,5 NULL
Numeric,5 NULL
1 NULL
2012 Apr 03
2
Looking for the name of a certain kind of quantile plot
Hi,
While playing with quantile-quantile plots, I wrote up some code which
plots something strangely different. Here's the pseudocode:
testhist <- hist(sample_data)
refhist <- hist(rnorm(n, mean=0,sd=1)) # for some large-ish n
cumtest <- cumsum(testhist)
cumref <- cumsum(refhist)
plot(cumref,cumtest)
This produces a straight line of slope 1 for a sample with the same
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 Nov 26
3
Best way to preallocate numeric NA array?
These are the ways that occur to me.
## This produces a logical vector, which will get converted to a numeric
## vector the first time a number is assigned to it. That seems
## wasteful.
x <- rep(NA, n)
## This does the conversion ahead of time but it's still creating a
## logical vector first, which seems wasteful.
x <- as.numeric(rep(NA, n))
## This avoids type conversion but still
2009 May 09
5
Reading large files quickly
I'm finding that readLines() and read.fwf() take nearly two hours to
work through a 3.5 GB file, even when reading in large (100 MB) chunks.
The unix command wc by contrast processes the same file in three
minutes. Is there a faster way to read files in R?
Thanks!
2009 Feb 06
1
16 digits and beyond? R64-bit a solution?
Hi,
I am working with some extremely small p-values and I want to capture
the corresponding quantiles.
I see the help file it says:
'qnorm' is based on Wichura's algorithm AS 241 which provides
precise results up to about 16 digits.
What happen after the 16th digits?
If I am running R in a server 64-bit, can that improve the chances that
beyond 16th digits to still have
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
2011 Mar 24
3
tapply with specific quantile value
All -
I have an example data frame
x l.c.1
43.38812035 085
47.55710661 085
47.55710661 085
51.99211429 085
51.99211429 095
54.78449958 095
54.78449958 095
56.70201864 095
56.70201864 105
59.66361903 105
61.69573564 105
61.69573564 105
63.77469479 115
64.83191994 115
64.83191994 115
66.98222118 115
66.98222118 125
66.98222118 125
66.98222118 125
66.98222118 125
and I'd like to get the 3rd
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 Jun 11
1
Documentation of B-spline function
Goodmorning,
This is a documentation related question about the B-spline function in R.
In the help file it is stated that:
"df degrees of freedom; one can specify df rather than knots; bs() then chooses df-degree-1 knots at suitable quantiles of x (which will ignore missing values)."
So if one were to specify a spline with 6 degrees of freedom (and no intercept) then a basis
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
2009 Jan 22
3
quantile question
Hi,
A simple quantile question:
I need to calculate the 95% and 5% quantiles (aka percentiles) for the
following data:
67.12
64.51
62.06
55.45
51.41
43.78
10.74
10.14
if I use the formula: 95% quantile point= 95 (8+1)/100, I get the 8.55th
point as the 95% quantile. Which does not make too much sense as I have only
8 data points.
The other option is to use (95*8)/100 = 7.6th data point (which can
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 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
2012 Oct 30
6
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 theoretical one. I feel that when I compute median from
given
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", "help", or "[un]subscribe"
(in the "body", not the
2011 Feb 10
1
How to determine the quantile boundary from an ECDF?
Given a dataset x, the ecdf is ecdf(x). Then I can use ecdf(x)(y) to find
the percentile of y. Given the ecdf is there a way to determine what is the
value of y that is the boundary of let's say 95 percentile? In other words,
is there a function I can call on the ecdf like:
fomeFunc( ecdf( x ), 0.95 )
Which will return the highest value of y, for which ecdf( y ) < 0.95?
The only solution
2012 Jul 10
1
Why 95% "quantile" empty in R or why 95% "quantile" = 1 with data values between 0 and 1?
I am calling quantiles as follows. I don't understand why sometimes the
columns (data values) above 95% are returned as "NULL"!! When I drop the
percentile down to 92%, I see colums appearing. Why would any quantile be
empty? I see sometimes that 95% percentile is being chosen as "1" for my
data between 0 and 1, where obviously there's no column value equal to 1.
But
2011 Dec 01
1
hi all.regarding quantile regression results..
i know this is not about R.
After applying quantile regression with t=0.5,0.6 on the data set WBC(
Wisconsin Breast Cancer)with 678 observations and 9 independent
variables(inp1,inp2,...inp9) and 1 dependent variable(op) i have got the
following results for beta values.
when t=0.5(median regression) beta values b1=0.002641,b2=0.045746,b3=0.
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] 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 explain me