Stata 15 help for moptobj

Title

[P] moptobj -- Recallable ML evaluator

Syntax

Syntax is presented under the following headings:

Step 1: Initialization Step 2: Perform a single function evaluation Step 3: Clean up

Step 1: Initialization

command ... , ... moptobj(name)

Step 2: Perform a single function evaluation

void Mopt_reset_params(name, b)

real scalar Mopt_ll_eval(name)

Step 3: Clean up

void Mopt_moptobj_cleanup(name)

Step 1: Initialization

To use a recallable ML evaluator in Mata, you must first run a Stata estimation command that supports the moptobj() option. This option saves the underlying moptimize() structure in Mata memory under name.

Certain temporary variables created during the command execution are saved in the current dataset as permanent variables with the name prefix.

The commands that support the moptobj() option are betareg, binreg, biprobit, clogit, cloglog, fracreg, glm, gsem, heckman, heckoprobit, heckprobit, hetprobit, hetregress, intreg, logistic, logit, mlogit, mprobit, nbreg, ologit, oprobit, poisson, probit, streg, tnbreg, tpoisson, truncreg, zinb, zip, and zioprobit.

Step 2: Performing a single function evaluation

The first function replaces the current coefficient vector with a new one; the second function returns the log likelihood evaluated at the new values of the coefficient vector.

Mopt_reset_params(name, b) replaces the current coefficient vector with b. The new vector must be of the same dimension as the current one.

Mopt_ll_eval(name) performs one evaluation of the function at the current coefficient vector.

Step 3: Clean up

Mopt_moptobj_cleanup(name) removes the moptimize() structure from memory and drops any permanent temporary variables created in step 1.

Description

moptobj() represents a collection of Stata estimation commands and Mata functions that support a recallable ML evaluator.

Remarks

The recallable ML evaluator utilities are not documented in the manual because they would not interest many users.

The suggested workflow is as follows:

------------------------------------------------------------ command ... , ... moptobj(name) mata: for (i=1; i<=n; i++) { ... b = ... Mopt_reset_params(name, b) ll = Mopt_ll_eval(name) ... } Mopt_moptobj_cleanup(name) end ------------------------------------------------------------


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