I am looking for a quantile-quantile plot using ggplot2.
I have these data:
model <- c(539.4573, 555.9882, 594.6838, 597.5712, 623.6659, 626.7169, 626.8539, 627.9992, 629.1139, 634.7405, 636.3438, 646.4692, 654.3024, 663.0181, 670.0985, 672.8391, 680.5557, 683.2600, 683.5159, 692.0328, 695.7185, 698.9505, 702.3676, 707.4271, 726.6507, 726.8524, 732.1197, 741.6183, 750.3617, 752.5978, 757.1609, 762.2874, 767.0678, 776.9476, 779.2352, 782.1193, 782.5098, 803.1828, 806.0310,806.0684, 809.3937, 812.8044, 825.6459, 825.6808, 826.4363, 828.0537, 832.3820, 836.0761, 862.7044, 864.1710, 892.0614, 897.7099, 902.7762, 913.0856)
Obs <- c(736.7720, 616.2387, 495.6597, 603.4706, 522.7708, 503.3286, 597.6499, 566.3173, 569.5813, 550.1589, 730.7077, 526.1033, 642.2166, 720.7170, 537.8696, 656.8828, 736.4988, 555.2904, 711.7803, 670.0493, 638.9948, 799.1116, 825.8668, 608.9737, 750.3825, 601.7922, 612.7352, 656.2068, 609.9878, 714.7711, 717.5175, 640.4917, 725.3937, 842.0838, 671.0265, 808.6822, 780.3558, 706.0857, 733.9746, 746.1896, 758.6903, 877.6814, 959.6846, 656.9653, 882.5842, 860.7533, 683.0813, 722.5920, 600.4500, 823.8956, 772.9894, 904.1999, 875.9391, 892.0576)
And I can have my quantile-quantile plot with qqplot:
qqplot(x=model, y=Obs)

The problem is that I have these data in a data frame, with multiple groups (for the example I use the same model but in fact I have three different models):
df <- rbind(data.frame(Model=model, Obs=Obs, type="a"), data.frame(Model=model, Obs=Obs, type="b"), data.frame(Model=model, Obs=Obs, type="c"))
And I want to plot a qqplot for each type:
p <- ggplot(df)
p <- (p + stat_qq(aes(sample=Model, colour=type)))
print(p)
This works but it plots the quantiles of each model against a normal distribution. I want to plot them against the observed quantiles. In the help of "stat_qq", it is mentionned for distribution: "Distribution function to use, if x not specified". So I guessed that x would replace the normal distribution:
p <- ggplot(df)
p <- (p + stat_qq(aes(sample=Model, x=Obs, colour=type)))
print(p)
But I have the following error:
Error : geom_point requires the following missing aesthetics: x
Can someone help me?