jimbib webber <[EMAIL PROTECTED]> wrote in news:[EMAIL PROTECTED]:
> Each number in the below list resides in a quantile. When put in > order, there are 10 numbers, so the first is in the 0.1 quantile, the > second in the 0.2 etc. > > Lets say we have 10 examples of systolic blood pressure from 30 year > olds: > 104,95,106,105,110,150,101,98,85,104 > What I want to do is in R, calculate the corresponding quantiles from > So, using the same mean and variance as the above random sample, > create a normal distribution. From this normal distribution, I want to > calculate 10 corresponding quantiles. > > Then, I want to plot a qqplot of both data sets to see the > distribution. > > One person told me to do this: > > qnorm(c(0.25,0.5,0.75),mean=mean(x),sd=sd(x)) > > Output: > [1] 3.76997 5.50000 7.23003 > > ...But this does not give me 10 corresponding quantiles? > > Another person told me to do this: > >> > > x=c(104,95,106,105,110,150,101,98,85,104) > >> > > n=length(x) > >> > > p=(1:n-0.5)/n > >> > > z=qnorm(p, mean(x), sd(x),)[order(order(x))] > > But this seems to generate 10 new numbers. And not give corresponding > quantiles from a normal distribution. Try: qqnorm(x); qqline(x, col = 2) ....as suggested in the examples in the help message from ?qqplot. If you want the quantiles, invoking str(qqnorm(x)) suggests that the "x- values" can be recovered by: qqnorm(x)$x ....and therefore the quantiles from: pnorm(qqnorm(x)$x) -- David Winsemius ______________________________________________ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.