[R] Quantiles and QQ plots

Daniel Malter daniel at umd.edu
Sat Dec 1 03:28:15 CET 2007


Your vector:

x=c(5,9,6,1,5,9,7,4,5,6,3,2,4,8,9,6,1,8,4,8)

Check descriptives:

mean(x)
sd(x)

get quantiles for a normal with mean and standard deviation of x:

qnorm(c(0.25,0.5,0.75),mean=mean(x),sd=sd(x))

Output:

[1] 3.76997 5.50000 7.23003

to get the quantile plot install library "car" and load library by typing in
the R prompt: library(car) 

qq.plot(x)

But you can easily look at the histogram of your vector - hist(x) - to see
that this does not look very normal

Daniel



-----Ursprüngliche Nachricht-----
Von: r-help-bounces at r-project.org [mailto:r-help-bounces at r-project.org] Im
Auftrag von alfieim29
Gesendet: Friday, November 30, 2007 6:26 PM
An: r-help at r-project.org
Betreff: [R] 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 Nabble.com.

______________________________________________
R-help at 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.



More information about the R-help mailing list