Displaying 20 results from an estimated 900 matches similar to: "Percentiles/Quantiles with Weighting"
2003 May 01
4
List of lists? Data frames? (Or other data structures?)
Hi, I'm faced with the following problem and would appreciate some
advice.
I could have a data frame x that looks like this:
aa bb
a 1 "A"
b 2 "B"
The advantage of this is that I could access all the individual
components easily. Also I could access all the rows and columns
easily.
Alternatively, I could have a list of
2007 Aug 13
1
simulate data from multivariate normal with pre-specified correlation matrix
For example, the correlation matrix is 3x3 and looks like
1 0.75 0 0 0
0.75 1 0 0 0
0 0 0 0 0
Can I write the code like this?
p<- 3 # number of variables per observation
N<- 10 # number of samples
# define population correlation matrix sigma
sigma<-matrix(0,p,p) #creates a px p matrix of 0
rank<-2
for (i in 1:rank){
for (j in 1:rank){
rho<-0.75
2009 Jun 12
1
coupled ODE population model
I'm fairly new to R, and I'm trying to write out a population model that
satisfies the following;
the system consists of s species, i= 1, 2,...,s
network of interactions between species is specified by a (s x s) real matrix,
C[i,j]
x[i] being the relative population of the "ith" species (0 =< x[i] =< 1,
sum(x[i]=1)
the evolution rule being considered is as follows;
2005 Jan 07
2
Getting empirical percentiles for data
Dear List,
I have some discrete data and want to calculate the percentiles and the
percentile ranks for each of the unique scores. I can calculate the
percentiles with quantile().
I know that "ecdf" can be used to calculate the empirical cumulative
distribution. However, I don't know how to exact the cumulative
probabilities for each unique element. The requirement is similar
2012 Jul 30
3
Calculating percentiles for multiple dates
I was hoping to calculate the percentile for each date. So group all of one
date together, calculating the value of the 2.5 and 97.5 percentile.
--
View this message in context: http://r.789695.n4.nabble.com/Calculating-percentiles-for-multiple-dates-tp4638183p4638378.html
Sent from the R help mailing list archive at Nabble.com.
2010 Jul 03
1
Inverting a scale(X)
G'day, All.
I have been trying to trackdown a problem in my R analysis script. I perform a scale() operation on a matrix then do further work.
Is there any way of inverting the scale() such that
sX <- scale(X)
Xprime <- inv.scale(x); # does inv.scale exist?
resulting in Xprime_{ij} == X_{ij} where Xprime_{ij} \in R
There must be some way of doing it but I'm such a newb
2013 Jan 21
1
Percentiles with R for a big data.frame
Dear R users,
I came up to a problem dealing with percentiles in R.
>From my previous questions: I do have a big data.frame, with lots of
columns and rows. The following command enables me to calculate means for
all data frame.
dat1$newID<-rep(1:(nrow(dat1)/12),each=12) #if nrow(dat1)/12 is integer
dat2<-with(dat1,aggregate(cbind(dat1[,1:71]),by=list(newID),mean))
What I need is to
2007 Sep 11
5
Percentiles in R
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 sample
SyntaxY = prctile(X,p)
Description
Y = prctile(X,p) calculates a value that is
2011 Mar 10
1
getting percentiles by factor
Hello,
I'm trying to get percentiles (PERCENTRANK for excel users) by factor in the
following data.frame:
myExample <- data.frame(Ret=seq(-2, 2.5,
by=0.5),PE=seq(10,19),Sectors=rep(c("Financial","Industrial"),5))
myExample <- na.omit(myExample)
Thanks to Patrick I I managed to put together the following lines which does
it for the "Ret" column:
myecdf
2004 Apr 26
2
Looking for help in calculating percentiles
Hi All:
I am working with a dataset on Arsenic toxicity, and I am trying to
calculate the 20th, 40th, 60th, 80th, and highest percentiles for a
variable, dietary Moisture (variable name dMoist).
The inbuilt function quantile(dMoist) would print 0, 25th, 50th, 75th, and
100th percentile. Does there exist a function that can calculate xth
percentile (where x = 10th, 20th, ... etc) values?
2012 Apr 20
1
Package "demography" - calculating percentiles of survival probabilities distribution
Hi,
I am using the package "demography" from Rob Hyndman for the
Lee-Carter-Model. It is an amazing powerful tool but I am struggling with
one issue:
I want to compute different percentiles of the survival probability
distribution derived from the Lee-Carter-Forecast (e.g. the 50%tile,
60%tile, 75%tile and 99%tile) for each of the next 10 years. Is there any
possibility to retrieve
2011 Apr 17
3
Box plot with 5th and 95th percentiles instead of 1.5 * IQR: problems implementing an existing solution...
Hi all,
I'm just getting started with R and I would appreciate some help. I'm having
trouble creating a boxplot with whiskers at the 95th and 5th percentiles
instead of at 1.5 * IQR. I have read the relevant documentation, and checked
existing mails on this topic. I found a small modification that should work
: https://stat.ethz.ch/pipermail/r-help/2001-November/016817.html and tried
to
2001 Nov 25
2
Boxplots using percentiles?
The standard R boxplot appears to use quartiles to determine the height of
the rectangles and a range parameter - RNG - (default=1.5 I think) that
determines the length of the whiskers as <= RNG x Interquartile Range. Is
it possible to instead define the range as extending to the 95th percentile?
If so, how would this be done?
nb, I'm plotting multiple boxplots on a single chart so a
2011 Dec 23
3
data vector to corresonding percentile ranks
I have a problem where I need to calculate the corresponding cohort
percentile ranks for each of several variables.
Essentially, what I need is a function that will calculate the
distribution-free percentiles from each variable's data vector, returning a
corresponding vector of percentiles:
e.g.:
percentile.my.data<-/function/(my.data)
I tried to make ecdf() perform this task but
2004 Sep 01
1
AW: Looking for help in calculating percentiles
How do I calculate the 95th percentile when I know the 25th, the median and the 75th??
Thanks,
Harmony Tenney
[[alternative HTML version deleted]]
2004 Apr 06
2
percentile-percentile plot
Hi,
Is there a function that does percentile-percentile plot. I do not mean
the qqplot. I need to plot the percentiles rather than points themselves.
I am hoping for a plot that tells me that the x percentile of one data set
corresponds to the y percentile of the other. for example a point on the
plot of (.5, .2) will tell me that the 50th percentile of the first data
and the 20th percentile of
2004 Mar 03
1
Calculating percentiles from Grouped Data (gapply)
Dear R-list,
I try to calculate the 10- and 90-Percentile from grouped data.
Using 'lappy' it works fine but I have no success with 'gapply':
df <- data.frame(test = runif(100))
df <- df[order(df[,1]),]
z <- rep(1:10, each = 10)
lapply(split(df, z), function(x) quantile(x, probs=c(10,90)/100))
library(nlme)
gapply(as.data.frame(df), which=1,
function(x)
2010 Jul 27
1
problem with zero-weighted observations in predict.lm?
In modelling functions some people like to use
a weight of 0 to drop an observation instead of
using a subset value of FALSE. E.g.,
weights=c(0,1,1,...)
instead of
subset=c(FALSE, TRUE, TRUE, ...)
to drop the first observation.
lm() and summary.lm() appear to treat these in the
same way, decrementing the number of degrees of
freedom for each dropped observation. However,
predict.lm() does
2012 Nov 08
3
difference percentile R vs SPSS
Dear list,
I am calculating the 95th percentile of a set of values with R and with SPSS
In R:
> normal200<-rnorm(200,0,1)
> qnorm(0.95,mean=mean(normal200),sd=sd(normal200),lower.tail =TRUE)
[1] 1.84191
In SPSS, if I use the same 200 values and select Analyze -> Descriptive Statistics -> Frequencies
and under "Statistics", I type in '95' under Percentiles,
2007 Jun 18
2
Calculating Percentile in R
Hi all,
I have a problem on how R calculates Percentiles :
Suppose I have following data set:
> data1
[1] -16648185 -14463457 -14449400 -13905309 -13443436 -13234755 -12956282 -11660896
[9] -10061040 -9805005 -9789583 -9754642 -9562164 -9391709 -9212182 -9151073
[17] -9092732 -9068214 -8978151 -8943912 -8761890 -8632106 -8541580 -8501249
[25] -8234466 -8219015