numericDeriv              package:stats              R Documentation

_E_v_a_l_u_a_t_e _d_e_r_i_v_a_t_i_v_e_s _n_u_m_e_r_i_c_a_l_l_y

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

     'numericDeriv' numerically evaluates the gradient of an
     expression.

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

     numericDeriv(expr, theta, rho = parent.frame(), dir = 1.0)

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

    expr: The expression to be differentiated.  The value of this
          expression should be a numeric vector.

   theta: A character vector of names of numeric variables used in
          'expr'.

     rho: An environment containing all the variables needed to
          evaluate 'expr'.

     dir: A numeric vector of directions to use for the finite
          differences.

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

     This is a front end to the C function 'numeric_deriv', which is
     described in _Writing R Extensions_.

     The numeric variables must be of type 'real' and not 'integer'.

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

     The value of 'eval(expr, envir = rho)' plus a matrix attribute
     called 'gradient'.  The columns of this matrix are the derivatives
     of the value with respect to the variables listed in 'theta'.

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

     Saikat DebRoy saikat@stat.wisc.edu

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

     myenv <- new.env()
     assign("mean", 0., envir = myenv)
     assign("sd", 1., envir = myenv)
     assign("x", seq(-3., 3., len = 31), envir = myenv)
     numericDeriv(quote(pnorm(x, mean, sd)), c("mean", "sd"), myenv)

