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)

_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., env = myenv)
     assign("sd", 1., env = myenv)
     assign("x", seq(-3., 3., len = 31), env = myenv)
     numericDeriv(quote(pnorm(x, mean, sd)), c("mean", "sd"), myenv)

