Thanks a lot Turner. Latter I also tried following : oo<-quantile(original, probs = seq(0, 1, 0.01), type = 8) pp<-quantile(predicted, probs = seq(0, 1, 0.01), type = 8) plot(oo,pp)
But plot for above and following (as you suggested) are not same. What may be the error ? Thanks. On Fri, Feb 17, 2012 at 3:01 PM, Rolf Turner <rolf.tur...@xtra.co.nz> wrote: > On 17/02/12 21:32, nandan amar wrote: > >> Hello, >> I am having two data set original and predicted. >> I want to dind QQ-plot fot it. >> I tried in following manner : >> >>> qq(original~predicted) >>> >> and error was : >> >> Error in qq.formula(o ~ p) : y must have exactly 2 levels >> >> There is an option "qtype" which dosent make any difference. >> >> What is the correct way for plotting QQ-plot or am I missing something. >> > > To start with, you are missing telling us that the function qq() is > from the *lattice* package. > > Secondly you are missing reading the error message. What > does it *say*? Think about it. > > It says that (rather strangely, it seems to me) that the left hand > side of the formula must be a factor with two levels. Obviously > then you must combine your observations into a single vector > and create a factor indicating to which of the two samples each > entry of that vector belongs. Something like: > > y <- c(original,predicted) > f <- factor(rep(c("o","p"),c(**length(original),length(**predicted)))) > require(lattice) > print(qq(f ~ y)) > > Alternatively you could save hassle and use base graphics: > > qqplot(original,predicted) > > cheers, > > Rolf Turner > > -- Amar Kumar Nandan Karnataka, India, 560100 â:+91-9019054471 â:nandan.a...@gmail.com http://aknandan.co.nr [[alternative HTML version deleted]]
______________________________________________ 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.