MyNixOS website logo
Description

Compare Big Datasets to the Uniform Distribution.

A quantile-quantile plot can be used to compare a sample of p-values to the uniform distribution. But when the dataset is big (i.e. > 1e4 p-values), plotting the quantile-quantile plot can be slow. geom_QQ uses all the data to calculate the quantiles, but thins it out in a way that focuses on points near zero before plotting to speed up plotting and decrease file size, when vector graphics are stored.

gg_QQ_unif

ggbigQQ extends ggplot2 to allow the user to make a quantile-quantile plot with a big dataset. Specifically, geom_big_qq uses all the data provided to calculate quantiles, but drops points that would overplot before plotting. <!-- There's no use in having ten thousand points in a plot to define a line -- we can't even see most of them! --> In this way, the resultant figure maintains all the accuracy of a Q-Q plot made with a large dataset, but renders as fast as one from a smaller dataset and, when stored as a vector graphic, has the file size of a Q-Q plot from a smaller dataset.

Examples

Here's an example where geom_qq takes 14 seconds to render the plot on my intel i5 and geom_big_qq takes 1 second to produce the same plot.

set.seed(27599)
d <- data.frame(s = runif(n = 5e5))

# # takes 14 seconds
# d %>%
#   ggplot(mapping = aes(sample = s)) +
#   geom_qq(distribution = qunif) +
#   QQ_scale_x() +
#   QQ_scale_y()


# takes 1 second
d %>%
  ggplot(mapping = aes(sample = s)) +
  geom_QQ_unif() +
  scale_x_QQ() +
  scale_y_QQ() +
  theme_minimal()

This geom works with other aesthetics, too.

set.seed(27599)
n <- 5e5
d <- data.frame(fac1 = sample(x = LETTERS[1:3], size = n, replace = TRUE),
                fac2 = sample(x = LETTERS[1:3], size = n, replace = TRUE),
                s = runif(n = n))

# takes 1 second
d %>%
  ggplot(mapping = aes(sample = s, color = fac1)) +
  geom_QQ_unif() +
  facet_wrap(~ fac2) +
  scale_x_QQ() +
  scale_y_QQ() +
  theme_minimal()

Metadata

Version

0.1.5

License

Unknown

Platforms (75)

    Darwin
    FreeBSD
    Genode
    GHCJS
    Linux
    MMIXware
    NetBSD
    none
    OpenBSD
    Redox
    Solaris
    WASI
    Windows
Show all
  • aarch64-darwin
  • aarch64-genode
  • aarch64-linux
  • aarch64-netbsd
  • aarch64-none
  • aarch64_be-none
  • arm-none
  • armv5tel-linux
  • armv6l-linux
  • armv6l-netbsd
  • armv6l-none
  • armv7a-darwin
  • armv7a-linux
  • armv7a-netbsd
  • armv7l-linux
  • armv7l-netbsd
  • avr-none
  • i686-cygwin
  • i686-darwin
  • i686-freebsd
  • i686-genode
  • i686-linux
  • i686-netbsd
  • i686-none
  • i686-openbsd
  • i686-windows
  • javascript-ghcjs
  • loongarch64-linux
  • m68k-linux
  • m68k-netbsd
  • m68k-none
  • microblaze-linux
  • microblaze-none
  • microblazeel-linux
  • microblazeel-none
  • mips-linux
  • mips-none
  • mips64-linux
  • mips64-none
  • mips64el-linux
  • mipsel-linux
  • mipsel-netbsd
  • mmix-mmixware
  • msp430-none
  • or1k-none
  • powerpc-netbsd
  • powerpc-none
  • powerpc64-linux
  • powerpc64le-linux
  • powerpcle-none
  • riscv32-linux
  • riscv32-netbsd
  • riscv32-none
  • riscv64-linux
  • riscv64-netbsd
  • riscv64-none
  • rx-none
  • s390-linux
  • s390-none
  • s390x-linux
  • s390x-none
  • vc4-none
  • wasm32-wasi
  • wasm64-wasi
  • x86_64-cygwin
  • x86_64-darwin
  • x86_64-freebsd
  • x86_64-genode
  • x86_64-linux
  • x86_64-netbsd
  • x86_64-none
  • x86_64-openbsd
  • x86_64-redox
  • x86_64-solaris
  • x86_64-windows