[R] probabilty plot
Francisco J. Zagmutt
gerifalte28 at hotmail.com
Thu Jul 5 20:11:53 CEST 2007
I just glanced at the link, but I think this is what you are after:
x=rnorm(1000)#1000 random samples from N(0,1)
y=rlnorm(1000)#1000 random samples from Lognormal(0,1)
fx=ecdf(x)#Empirical cumulative density function of x
fy=ecdf(y)#Empirical cumulative density function of y
#Histogram of data
n=seq(-4,30,.1)#Quantiles to be applied to the F(x)
plot(fx(n), fy(n))#Probability plot
If you are testing data against a known distribution (i.e. Normal) you
may want to use the distribution function for that distribution (i.e.
pnorm for the Normal distr) instead of the ecdf since that will provide
you with an exact answer. i.e.
Now, QQ plots are usually more useful to compare distributions since
they are more sensitive to small discrepancies in the data. Take a look
at qqplot and qqnorm for examples of how to create qqplots in R
I hope this helps.
along zeng wrote:
> Hi all,
> I am a freshman of R,but I am interested in it! Those days,I am
> learning pages on NIST,with url
> I am meeting a problem about probability plot and I don't know how to
> plot a data set with R.
> Could somebody tell me the answer,and a example is the best! I will
> look forward to your answer.
> Thank you very much.
> R-help at stat.math.ethz.ch mailing list
> 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