Differentiate the Mean Function of a Nonlinear Model
Differentiate the Mean Function of a Nonlinear Model
Calculates the gradient and Hessian of the mean function of a nonlinear heteroscedastic model.
Dmean(nlregObj, hessian =TRUE)
Arguments
nlregObj: a nonlinear heteroscedastic model fit as obtained from a call to nlreg.
hessian: logical value indicating whether the Hessian should be computed. The default is TRUE.
Details
The mean function is differentiated with respect to the regression coefficients as specified in the coef component of the nlreg object. The returned function definition, however, includes all parameters --- regression coefficients and variance parameters --- as arguments. When evaluated, it implicitly refers to the data to whom the model was fitted and which must be on the search list. The gradient and Hessian are calculated for each data point: the gradient attribute is a \emphnxp matrix and the hessian
attribute is a \emphnxpxp array, where \emphn and \emphp are respectively the number of data points and the number of regression coefficients.
Returns
a function whose arguments are named according to the parameters of the nonlinear model nlregObj. When evaluated, it returns the value of the mean function along with attributes called gradient and hessian, the latter if requested. These are the gradient and Hessian of the mean function with respect to the regression coefficients.
Note
Dmean and Dvar are the two workhorse functions of the nlreg library. The details are given in Brazzale (2000, Section 6.1.2) .
The symbolic differentiation algorithm is based upon the D function. As this algorithm is highly recursive, the hessian = TRUE argument should only be used if the Hessian matrix is needed. Whenever possible, derivatives should be stored so as to be re-used in further calculations. This is, for instance, achieved by the nonlinear heteroscedastic model fitting routine nlreg through the argument hoa = TRUE.
References
Becker, R. A., Chambers, J. M. and Wilks, A. R. (1988) The New S Language: A Programming Environment for Data Analysis and Graphics. London: Chapman & Hall. Section 9.6.
Brazzale, A. R. (2000) Practical Small-Sample Parametric Inference. Ph.D. Thesis N. 2230, Department of Mathematics, Swiss Federal Institute of Technology Lausanne.