surfacePlot              package:mclust              R Documentation

_D_e_n_s_i_t_y _o_r _u_n_c_e_r_t_a_i_n_t_y _s_u_r_f_a_c_e _f_o_r _t_w_o _d_i_m_e_n_s_i_o_n_a_l _m_i_x_t_u_r_e_s.

_D_e_s_c_r_i_p_t_i_o_n:

     Plots a density or uncertainty surface  given data in more than
     two dimensions and parameters of an MVN mixture model for the
     data.

_U_s_a_g_e:

     surfacePlot(data, mu, pro, ..., type = c("contour", "image", "persp"), 
             what = c("density", "uncertainty", "skip"), 
             transformation = c("none", "log", "sqrt"),          
             grid = 50, nlevels = 20, scale = FALSE, identify = FALSE,
             verbose = FALSE, xlim, ylim, swapAxes = FALSE)

_A_r_g_u_m_e_n_t_s:

    data: A numeric vector, matrix, or data frame of observations.
          Categorical variables are not allowed. If a matrix or data
          frame, rows correspond to observations and columns correspond
          to variables. 

      mu: A matrix whose columns are the means of each group.  

     pro: A list with 'scale', 'shape' and 'orientation' components
          giving an alternative form for the covariance structure of
          the mixture model. 

     ...: An argument specifying the covariance structure of the model.
          If used an indirect function call via 'do.call' (see example
          below), it is usually not necessary to know the precise form
          for this argument. This argument usually take one of the
          following forms:

          '_s_i_g_m_a' A three dimensional array in which 'sigma[,,k]' gives
               the covariance for the _k_th group.

          '_d_e_c_o_m_p' A list with 'scale', 'shape' and 'orientation'
               components giving an alternative form for the covariance
               structure of the mixture model.

    type: Any subset of 'c("contour","image","persp")' indicating the
          plot type. For more than one selection, users will be asked
          to choose from a menu. 

    what: Any subset of 'c("density","uncertainty","skip")' indicating
          what to plot. For more than one selection, users will be
          asked to choose from a menu. The '"skip"' produces and empty
          plot, which may be useful if multiple plots are displayed
          simultaneously.  

transformation: Any subset of 'c("none","log","sqrt")' indicating  a
          transformation to be applied to the surface values before
          plotting. For more than one selection, users will be asked to
          choose from a menu.  

    grid: The number of grid points (evenly spaced on each axis).  The
          mixture density and uncertainty is computed at  'grid x grid'
          points to produce the surface plot. Default: '50'. 

 nlevels: The number of levels to use for a contour plot. Default:
          '20'. 

   scale: A logical variable indicating whether or not the two chosen
          dimensions should be plotted on the same scale, and thus
          preserve the shape of the distribution. Default: 'scale=F'  

identify: A logical variable indicating whether or not to add a title
          to the plot identifying the dimensions used. 

 verbose: A logical variable telling whether or not to print an
          indication that the function is in the process of computing
          values at the grid points, which typically takes some time to
          complete. 

xlim, ylim : An argument specifying bounds for the ordinate, abscissa
          of the plot. This may be useful for when comparing plots. 

swapAxes: A logical variable indicating whether or not the axes should
          be swapped for the plot. 

_V_a_l_u_e:

     An invisible list with components x, y, and z in which x and y are
     the values used to define the grid and z is the transformed
     density or uncertainty at the grid points.

_S_i_d_e _E_f_f_e_c_t_s:

     One or more plots showing location of the mixture components,
     classification, uncertainty, and/or classification errors.

_D_e_t_a_i_l_s:

     For an image plot, a color scheme may need to be selected on the
     display device in order to view the plot.

_R_e_f_e_r_e_n_c_e_s:

     C. Fraley and A. E. Raftery (2002). Model-based clustering,
     discriminant analysis, and density estimation. _Journal of the
     American Statistical Association 97:611-631_.  See <URL:
     http://www.stat.washington.edu/mclust>.

     C. Fraley and A. E. Raftery (2002). MCLUST:Software for
     model-based clustering, density estimation and discriminant
     analysis. Technical Report, Department of Statistics, University
     of Washington.  See <URL: http://www.stat.washington.edu/mclust>.

_S_e_e _A_l_s_o:

     'mclust2Dplot', 'do.call'

_E_x_a_m_p_l_e_s:

     n <- 250 ## create artificial data
     set.seed(0)
     x <- rbind(matrix(rnorm(n*2), n, 2) %*% diag(c(1,9)),
                matrix(rnorm(n*2), n, 2) %*% diag(c(1,9))[,2:1])
     xclass <- c(rep(1,n),rep(2,n))

     xEMclust <- summary(EMclust(x),x)
     surfacePlot(x, mu = xEMclust$mu, sigma = xEMclust$sigma, pro=xEMclust$pro,
                 type = "contour", what = "density", transformation = "none")

     ## Not run: do.call("surfacePlot", c(list(data = x), xEMclust))

