qqmath                package:lattice                R Documentation

_Q-_Q _P_l_o_t _w_i_t_h _T_h_e_o_r_e_t_i_c_a_l _D_i_s_t_r_i_b_u_t_i_o_n

_D_e_s_c_r_i_p_t_i_o_n:

     Quantile-Quantile plot of a sample and a theoretical distribution

_U_s_a_g_e:

     qqmath(x, ...)

     ## S3 method for class 'formula':
     qqmath(x,
            data = parent.frame(),
            allow.multiple = is.null(groups) || outer,
            outer = !is.null(groups),
            distribution = qnorm,
            f.value = NULL,
            auto.key = FALSE,
            aspect = "fill",
            panel = "panel.qqmath",
            prepanel = NULL,
            scales, strip, groups,
            xlab, xlim, ylab, ylim,
            drop.unused.levels = lattice.getOption("drop.unused.levels"),
            ...,
            default.scales = list(),
            subscripts,
            subset)
     ## S3 method for class 'numeric':
     qqmath(x, data, ylab, ...)

_A_r_g_u_m_e_n_t_s:

       x: The object on which method dispatch is carried out.

          For the '"formula"' method, a formula of the form '~ x | g1 *
          g2 * ...', where 'x' must be a numeric.  For the '"numeric"'
          method, a numeric vector. 

    data: For the 'formula' method, an optional data frame in which
          variables in the formula (as well as 'groups' and 'subset',
          if any) are to be evaluated.  By default, the environment
          where the function was called from is used.  Ignored with a
          warning in other methods. 

distribution: a quantile function that takes a vector of probabilities
          as argument and produces the corresponding quantiles.
          Possible values are 'qnorm', 'qunif' etc. Distributions with
          other required arguments need to be passed in as user defined
          functions. 

 f.value: optional numeric vector of probabilities, quantiles
          corresponding to which should be plotted.  Can also be a
          function of a single integer (representing sample size) that
          returns such a numeric vector.  The typical value for this
          argument is the function 'ppoints', which is also the S-PLUS
          default.  If specified, the probabilities generated by this
          function is used for the plotted quantiles, using the
          'quantile' function for the sample, and the function
          specified as the 'distribution' argument for the theoretical
          distribution.  

          'f.value' defaults to 'NULL', which has the effect of using
          'ppoints' for the quantiles of the theoretical distribution,
          but the exact data values for the sample.  This is similar to
          what happens for 'qqnorm', but different from the S-PLUS
          default of 'f.value=ppoints'.

          For large 'x', this argument can be useful in plotting a
          smaller set of quantiles, which is usually enough to capture
          the pattern. 

   panel: The panel function to be used.  Unlike in older versions, the
          default panel function does most of the actual computations
          and has support for grouping.  See 'panel.qqmath' for
          details. 

allow.multiple, outer, auto.key, aspect, prepanel, scales,
strip, groups, xlab, xlim, ylab, ylim, drop.unused.levels,
default.scales, subscripts, subset: See
          'xyplot' 

     ...: Further arguments.  See corresponding entry in 'xyplot' for
          non-trivial details. 

_D_e_t_a_i_l_s:

     'qqmath' produces a Q-Q plot of the given sample and a theoretical
     distribution.  The default behaviour of 'qqmath' is different from
     the corresponding S-PLUS function, but is similar to 'qqnorm'. See
     the entry for 'f.value' for specifics.

     The implementation details are also different from S-PLUS.  In
     particular, all the important calculations are done by the panel
     (and prepanel function) and not 'qqmath' itself.  In fact, both
     the arguments 'distribution' and 'f.value' are passed unchanged to
     the panel and prepanel function.  This allows, among other things,
     display of grouped Q-Q plots, which are often useful.  See the
     help page for 'panel.qqmath' for further details.

     This and all other high level Trellis functions have several
     arguments in common. These are extensively documented only in the
     help page for 'xyplot', which should be consulted to learn more
     detailed usage.

_V_a_l_u_e:

     An object of class '"trellis"'. The 'update' method can be used to
     update components of the object and the 'print' method (usually
     called by default) will plot it on an appropriate plotting device.

_A_u_t_h_o_r(_s):

     Deepayan Sarkar Deepayan.Sarkar@R-project.org

_S_e_e _A_l_s_o:

     'xyplot', 'panel.qqmath', 'panel.qqmathline',
     'prepanel.qqmathline', 'Lattice', 'quantile'

_E_x_a_m_p_l_e_s:

     qqmath(~ rnorm(100), distribution = function(p) qt(p, df = 10))
     qqmath(~ height | voice.part, aspect = "xy", data = singer,
            prepanel = prepanel.qqmathline,
            panel = function(x, ...) {
               panel.qqmathline(x, ...)
               panel.qqmath(x, ...)
            })
     vp.comb <-
         factor(sapply(strsplit(as.character(singer$voice.part), split = " "),
                       "[", 1),
                levels = c("Bass", "Tenor", "Alto", "Soprano"))
     vp.group <-
         factor(sapply(strsplit(as.character(singer$voice.part), split = " "),
                       "[", 2))
     qqmath(~ height | vp.comb, data = singer,
            groups = vp.group, auto.key = list(space = "right"),
            aspect = "xy",
            prepanel = prepanel.qqmathline,
            panel = function(x, ...) {
               panel.qqmathline(x, ...)
               panel.qqmath(x, ...)
            })

