I generate a QQ plot to compare the distribution of my ranom number generator with a beta distribution. I can do this using the usual plot commands in R via
samples1 <- read.csv("test1-clean.dat")
qqplot( samples1$p0, qbeta(seq(0,1,length=length(samples1$p0)),1,3) )
abline( 0, 1 )
but I want to use the ggplot2
library, and I just cannot get my head around the documentation (I am a n00b when it comes to R)
I tried
qplot( sample = p0, data = samples1 ) + stat_qq( distribution = qbeta, seq(0,1,length=length(samples1$p0)), 1, 3 )
but that leads to an error of the form
Error: ggplot2 doesn't know how to deal with data of class numeric
Any suggestions? Also, good references on learning R would be great (I am familiar with C, C++, Matlab, etc, but R seems a bit odd to me right now)
Update:
As suggested below, I tried
params = list(shape1 = 1, shape2 = 3, lower.tail = TRUE, log.p = FALSE)
qplot( sample = p0, data = samples3 ) + stat_qq( distribution = qbeta, dparams = params )
This still does not seem to work. The error I get is
Error in function (p, shape1, shape2, ncp = 0, lower.tail = TRUE, log.p = FALSE) :
element 2 is empty;
the part of the args list of '.Internal' being evaluated was:
(p, shape1, shape2, lower.tail, log.p)
I tried adding lower.tail and log.p into params, as well as the list of probabilities p, but that did not change the error message.