Stata 15 help for mleval

[R] ml -- Programs for use by ml method d0, d1, d2, lf0, lf1, lf2, and gf0 log-likelihood evaluators

Syntax for subroutines for use by ml log-likelihood evaluators

mleval newvar = vecname [, eq(#)]

mleval scalarname = vecname , scalar [eq(#)]

mlsum scalarname_lnf = exp [if] [, noweight]

mlvecsum scalarname_lnf rowvecname = exp [if] [, eq(#)]

mlmatsum scalarname_lnf matrixname = exp [if] [, eq(#[,#])]

mlmatbysum scalarname_lnf matrixname varname_a varname_b [varname_c] [if] , by(varname) [eq(#[,#])]

Description

These commands assist in coding the likelihood-evaluation program when using ml methods d0, d1, d2, lf0, lf1, lf2, and gf0. They are of no assistance when coding a method lf evaluator.

mleval is a subroutine used by method d0, d1, d2, lf0, lf1, lf2, and gf0 evaluators to evaluate the coefficient vector that they are passed.

mlsum is a subroutine used by method d0, d1, and d2 evaluators to define the value ln L that is to be returned.

mlvecsum is a subroutine used by method d1 and d2 evaluators to define the gradient vector g that is to be returned. It is suitable for use only when the likelihood function meets the linear-form restrictions.

mlmatsum is a subroutine for use by method d2 and lf2 evaluators to define the Hessian matrix, H, that is to be returned. It is suitable for use only when the likelihood function meets the linear-form restrictions.

mlmatbysum is a subroutine for use by method d2 evaluator to help define the Hessian matrix, H, that is to be returned. It is suitable for use when the likelihood function contains terms made up of grouped sums, such as in panel-data models. For such models, use mlmatsum to compute the observation-level outer products and mlmatbysum to compute the group-level outer products. mlmatbysum requires that the data be sorted by the variable identified in the by() option.

Options for use with mleval

eq(#) specifies the equation number, i, for which theta_ij = x_ij * b_i is to be evaluated. eq(1) is assumed if eq() is not specified.

scalar asserts that the ith equation is known to evaluate to a constant, meaning that the equation was specified as (), (name:), or /name on the ml model statement. If you specify this option, the new variable created is created as a scalar. If the ith equation does not evaluate to a scalar, an error message is issued.

Option for use with mlsum

noweight specifies that weights ($ML_w) be ignored when summing the likelihood function.

Option for use with mlvecsum

eq(#) specifies the equation for which a gradient vector dlnL/db_i is to be constructed. The default is eq(1).

Option for use with mlmatsum

eq(#[,#]) specifies the equations for which the Hessian matrix is to be constructed. The default is eq(1), which is the same as eq(1,1), which means d^2lnL/(db_1 db_1'). Specifying eq(i,j) results in d^2lnL/(db_i db_j').

Options for use with mlmatbysum

by(varname) is required and specifies the group variable.

eq(#[,#]) specifies the equations for which the Hessian matrix is to be constructed. The default is eq(1), which is the same as eq(1,1), which means d^2lnL/(db_1 db_1'). Specifying eq(i,j) results in d^2lnL/(db_i db_j').

Examples

See mlmethod for outlines of log-likelihood evaluators that use the mleval, mlsum, mlvecsum, and mlmatsum commands. [R] ml contains more examples. Further examples can be found in Maximum Likelihood Estimation with Stata, 4th Edition (Gould, Pitblado, and Poi 2010) - available from StataCorp.


© Copyright 1996–2018 StataCorp LLC   |   Terms of use   |   Privacy   |   Contact us   |   What's new   |   Site index