cdensE                package:mclust                R Documentation

_C_o_m_p_o_n_e_n_t _D_e_n_s_i_t_y _f_o_r _a _P_a_r_a_m_e_t_e_r_i_z_e_d _M_V_N _M_i_x_t_u_r_e _M_o_d_e_l

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

     Computes component densities for points in a parameterized MVN
     mixture model.

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

     cdensE(data, mu, sigmasq, eps, warnSingular, logarithm = FALSE, ...)
     cdensV(data, mu, sigmasq, eps, warnSingular, logarithm = FALSE, ...)
     cdensEII(data, mu, sigmasq, eps, warnSingular, logarithm = FALSE, ...)
     cdensVII(data, mu, sigmasq, eps, warnSingular, logarithm = FALSE, ...)
     cdensEEI(data, mu, decomp, eps, warnSingular, logarithm = FALSE, ...)
     cdensVEI(data, mu, decomp, eps, warnSingular, logarithm = FALSE, ...)
     cdensEVI(data, mu, decomp, eps, warnSingular, logarithm = FALSE, ...)
     cdensVVI(data, mu, decomp, eps, warnSingular, logarithm = FALSE, ...)
     cdensEEE(data, mu, eps, warnSingular, logarithm = FALSE, ...)
     cdensEEV(data, mu, decomp, eps, warnSingular, logarithm = FALSE, ...)
     cdensVEV(data, mu, decomp, eps, warnSingular, logarithm = FALSE, ...)
     cdensVVV(data, mu, eps, warnSingular, logarithm = 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: The mean for each component. If there is more than one
          component, 'mu' is a matrix whose columns are the means of
          the components. 

 sigmasq: for the one-dimensional models ("E", "V") and spherical
          models ("EII", "VII"). This is either a vector whose _k_th
          component is the variance for the _k_th component in the
          mixture model ("V" and "VII"), or a scalar giving the common
          variance for all components in the mixture model ("E" and
          "EII"). 

  decomp: for the diagonal models ("EEI", "VEI", "EVI", "VVI") and some
          ellipsoidal models ("EEV", "VEV"). This is a list described
          in more detail in 'cdens'. 

logarithm: A logical value indicating whether or not the logarithm of
          the component densities should be returned. The default is to
          return the component densities, obtained from the log
          component densities by exponentiation. 

     ...: An argument giving the variance that takes one of the
          following forms:

          _d_e_c_o_m_p for models "EII" and "VII"; see above.

          _c_h_o_l_S_i_g_m_a see Sigma, for "EEE".

          _S_i_g_m_a for the equal variance model "EEE". A _d_ by _d_ matrix
               giving the common covariance for all components of the
               mixture model.

          _c_h_o_l_s_i_g_m_a see sigma, for "VVV".

          _s_i_g_m_a for the unconstrained variance model "VVV". A _d_ by
               _d_ by _G_ matrix array whose  '[,,k]'th entry is the
               covariance matrix for the _k_th component of the mixture
               model.

               The form of the variance specification is the same as
               for the output for the 'em', 'me', or 'mstep' methods
               for the specified mixture model.

               Also used to catch unused arguments from a 'do.call'
               call.

     eps: A scalar tolerance for deciding when to terminate
          computations due to computational singularity in covariances.
          Smaller values of 'eps' allow computations to proceed nearer
          to singularity. The default is '.Mclust\$eps'.  

warnSingular: A logical value indicating whether or not a warning
          should be issued whenever a singularity is encountered. The
          default is '.Mclust\$warnSingular'.  

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

     A numeric matrix whose '[i,j]'th  entry is the density of
     observation _i_ in component _j_.  The densities are not scaled by
     mixing proportions.

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

     C. Fraley and A. E. Raftery (2002a). 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 (2002b). 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:

     'cdens', 'dens', 'EMclust', 'mstep', 'mclustOptions', 'do.call'

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

     n <- 100 ## 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))
     clPairs(x, cl = xclass, sym = c("1","2")) ## display the data

     modelVII <- meVII(x, z = unmap(xclass))
     modelVVI <- meVVI(x, z = unmap(xclass))
     modelVVV <- meVVV(x, z = unmap(xclass))

     names(modelVII)
     args(cdensVII)
     cdenVII <- cdensVII(data = x, mu = modelVII$mu, pro = modelVII$pro,
                         decomp = modelVII$decomp)
     names(modelVVI)
     args(cdensVVI)
     cdenVVI <- cdensVII(data = x, mu = modelVVI$mu, pro = modelVVI$pro,
                         decomp = modelVVI$decomp)
     names(modelVVV)
     args(cdensVVV)
     cdenVVV <- cdensVVV( data = x, mu = modelVVV$mu, pro = modelVVV$pro,
                          cholsigma = modelVVV$cholsigma)

     cbind(class=xclass,VII=map(cdenVII),VVI=map(cdenVVI),VVV=map(cdenVVV))

     ## alternative call

     ## Not run: 
     cdenVII <- do.call("cdensVII", c(list(data = x), modelVII))
     cdenVVI <- do.call("cdensVVI", c(list(data = x), modelVVI))
     cdenVVV <- do.call("cdensVVV", c(list(data = x), modelVVV))

     cbind(class=xclass,VII=map(cdenVII),VVI=map(cdenVVI),VVV=map(cdenVVV))
     ## End(Not run)

