Learn R Programming

nonmem2R (version 0.2.4)

stat_QQnorm: Quantile-Quantile Plots

Description

Quantile-Quantile Plots with ggplot2

Usage

stat_QQnorm(mapping = NULL, data = NULL, geom = "point",
  position = "identity", na.rm = FALSE, show.legend = NA,
  inherit.aes = TRUE, ...)

Arguments

mapping

Set of aesthetic mappings created by aes or aes_.

data

The data to be displayed in this layer.

geom

Use to override the default geom

position

Position adjustment, either as a string, or the result of a call to a position adjustment function.

na.rm

If FALSE, the default, missing values are removed with a warning. If TRUE, missing values are silently removed.

show.legend

logical. Should this layer be included in the legends? NA, the default, includes if any aesthetics are mapped. FALSE never includes, and TRUE always includes.

inherit.aes

If FALSE, overrides the default aesthetics, rather than combining with them.

...

other arguments passed on to layer.

Aesthetics

geom_smooth understands the following aesthetics (required aesthetics are in bold):
x, alpha, colour, fill, group, shape, size, stroke

Details

Provide normal QQplot

Examples

Run this code
dd<-data.frame(gr=c(rep("A",20),rep("B",40)))
dd$dv<-2*(dd$gr=="B")+rnorm(nrow(dd))/(1+2*(dd$gr=="A"))
dd<-dd[order(dd$gr,dd$dv),]
dd$px<-NA
for(gri in levels(dd$gr)){
  dd$px[dd$gr==gri]<-qqnorm(dd$dv[dd$gr==gri],plot=FALSE)$x
}
ggplot(dd, aes(dv)) +
  stat_QQnorm()+
  facet_wrap(~gr)
if (FALSE) {
ggplot(dd, aes(dv,color=factor(gr))) +
  stat_QQnorm()
  }

Run the code above in your browser using DataLab