KDE                 package:fractal                 R Documentation

_N_o_n_p_a_r_a_m_e_t_r_i_c _m_u_l_t_i_d_i_m_e_n_s_i_o_n_a_l _p_r_o_b_a_b_i_l_i_t_y _d_e_n_s_i_t_y _f_u_n_c_t_i_o_n _e_s_t_i_m_a_t_i_o_n

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

     Given a training matrix, this function estimates a
     multidimensional probability density function using the
     Epanechnikov kernel as a smoother. The density function is
     estimated at a specified and arbitrary set of points, i.e., at
     points not necessarily members of the training set.

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

     KDE(x, at=NULL, n.grid=100)

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

       x: a matrix whose columns contain the coordinates for each
          dimension. Each row represents the location of a single point
          in a multidimensional embedding.

      at: the locations of the points over which the KDE is to be
          calculated. Default: a multidimensional uniform grid of
          points spanning the training data space (defined by 'x').

  n.grid: the number of divisions per dimension to using in forming the
          default grid when the 'at' input is unspecified. Default:
          '100'.

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

     The kernel bandwidth is constant (non-adaptive) and is determined
     by first computing the minimum variance of all dimensions
     (columns) of 'x'. This minimum variance is then used in Scott's
     Rule to compute the final bandwidth.

     This function is primarily used for estimating the mutual
     information of a time series and is included here for illustrative
     purposes.

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

     an object of class 'KDE'.

_S_3 _M_E_T_H_O_D_S:


     _e_d_a._p_l_o_t extended data analysis plot showing the original data
          along with a perspective and contour plot of the resulting
          KDE. In the case that the primary input 'x' is a single
          variable (a time series), only the KDE is plotted.

     _p_l_o_t plot the KDE or original (training) data. Options are:

          _s_t_y_l_e a character string denoting the type of plot to
               produce. Choices are '"original"', '"perspective"', and
               '"contour"' for plotting the original training data, a
               perspective plot of the KDE, or a contour plot of the
               KDE over the specifed dimensions.  In the case that the
               primary input 'x' is a single variable (a time series),
               this parameter is automatically set to unity and a KDE
               is plotted. Default: '"original"'.

          _d_i_m_e_n_s_i_o_n_s a two-element integer vector denoting the
               dimensions/variables/columns to select from the training
               data and resulting multidimensional KDE for perspective
               and contour plotting. In the case that the primary input
               'x' is a single variable (a time series), this parameter
               is automatically set to unity and a KDE is plotted.
               Default: '1:2' for multivariate training data, 1 for
               univariate training data.

          _x_l_a_b character string defining the x-axis label. Default:
               'dimnames' of the specified 'dimensions' of the training
               data. If missing, '"X"' is used. For univariate training
               data, the x-axis label is set to the name of the
               original time series.

          _y_l_a_b character string defining the y-axis label. Default:
               'dimnames' of the specified 'dimensions' of the training
               data. If missing, '"Y"' is used. For univariate training
               data, the y-axis label is set to '"KDE"'.

          _z_l_a_b character string defining the z-axis label for
               perspective plots. Default: '"KDE"'.

          _g_r_i_d a logical flag. If 'TRUE', a grid is plotted for the
               '"original"' style plot. Default: '"FALSE"'.

          ... Optional arguments to be passed directly to the specified
               plotting routine. .in -5


          _p_r_i_n_t a summary of the KDE object is printed.. Available
               options are:

               _j_u_s_t_i_f_y text justification ala 'prettPrintList'.
                    Default: '"left"'.

               _s_e_p header separator ala 'prettyPrintList'. Default:
                    '":"'.

               ... Additional print arguments sent directly to the
                    'prettyPrintList' function). .in -5


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

     'timeLag'.

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

     ## create a mixture of 2-D Gaussian distributed 
     ## RVs with different means, standard 
     ## deviations, point density, and orientation. 
     n.sample <- c(1000, 500, 300)
     ind      <- rep(1:3, n.sample)
     x <- rmvnorm(sum(n.sample),
         mean = rbind(c(-10,-20), c(10,0), c(0,0))[ ind, ],
         sd   = rbind(c(5,3), c(1,3) , c(0.3,1))[ ind, ],
         rho  = c(0.5, 1, -0.4)[ind])

     ## perform the KDE 
     z <- KDE(x)
     print(z)

     ## plot a summary of the results 
     eda.plot(z)

     ## form KDE of beamchaos series 
     plot(KDE(beamchaos),type="l")

