densityfd                package:fda                R Documentation

_C_o_m_p_u_t_e _a _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

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

     Like the regular S-PLUS function density, this function computes a
     probability density function for a sample of values of a random
     variable. However, in this case the density function is defined by
     a functional data object Wfdobj along with a normalizing constant
     C. The density function p(x) has the form  p(x) = C exp[W(x)]
     where function W(x) is defined by the functional data object
     Wfdobj.

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

     densityfd(x, Wfdobj, Lfdobj=3, lambda=0, conv=0.0001, iterlim=20,
               active=2:nbasis, dbglev=1)

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

       x: A vector of variable values for which the density is
          required. 

 Wfdobj : A functional data object defining a single univariate
          function. 

 Lfdobj : Either a nonnegative integer or a linear differential
          operator object. If present, the derivative or the value of
          applying the operator is evaluated rather than the functions
          themselves. 

 lambda : A nonnegative value controlling the amount of roughness in
          the data. 

   conv : A criterion for convergence of the iterations. 

iterlim : A limit on the number of iterations. 

 active : A logical vector of length equal to the number of
          coefficients defining Wfdobj. If an entry is T, the
          corresponding coefficient is estimated, and if F, it is held
          at the value defining the argument Wfdobj. Normally the first
          coefficient is set to 0 and not estimated, since it is
          assumed that W(0) = 0. 

  dbglev: Either 0, 1, or 2. This controls the amount information
          printed out on each iteration, with 0 implying no output, 1
          intermediate output level, and 2 full output. 

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

     The goal of the function is provide a smooth density function
     estimate that approaches some target density by an amount that is
     controlled by the linear differential operator Lfdobj and the
     penalty parameter. For example, if the second derivative of W(t)
     is penalized heavily, this will force the function to approach a
     straight line, which in turn will force the density function
     itself to be nearly normal or Gaussian. Similarly, to each
     textbook density function there corresponds a W(t), and to each of
     these in turn their corresponds a linear differential operator
     that will, when apply to W(t), produce zero as a result. 

     To plot the density function or to evaluate it, evaluate Wfdobj,
     exponentiate the resulting vector, and then divide by the
     normalizing constant C.

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

     A list containing:  Wfdobj  A functional data object defining
     function W(x) that that optimizes the fit to the data of the
     monotone function that it defines.  C  The normalizing constant. 
     Flist  A list containing results for the final converged solution:
      f  The optimal function value being minimized.  grad  The
     gradient vector at the optimal solution.  norm  The norm of the
     gradient vector at the optimal solution.  iternum  The number of
     iterations.  iterhist  A iternum+1 by 5 matrix containing the
     iteration history.

_N_o_t_e:

_A_u_t_h_o_r(_s):

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

     See Chapter 5 in J. O. Ramsay and B. W. Silverman (2002) Applied
     Functional Data Analysis for an example of density estimation and
     further references.

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

     posfd, smooth.monotone, eval.monfd

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

