Logl
Likelihood object. Used for performing maximum likelihood estimation of user-specified likelihood functions.
Logl Declaration
logl likelihood object declaration.
To declare a logl object, use the logl keyword, followed by a name to be given to the object.
Logl Method
ml maximum likelihood estimation.
Logl Views
append add line to the specification.
cellipse confidence ellipses for coefficient restrictions.
checkderivs compare user supplied and numeric derivatives.
coefcov coefficient covariance matrix.
display display table, graph, or spool in object window.
grads examine the gradients of the log likelihood.
label label view of likelihood object.
output table of estimation results.
spec likelihood specification.
wald Wald coefficient restriction test.
Logl Procs
clearhist clear the contents of the history attribute.
copy creates a copy of the logl.
makegrads make group containing gradients of the log likelihood.
olepush push updates to OLE linked objects in open applications.
setattr set the value of an object attribute.
updatecoefs update coefficient vector(s) from likelihood.
Logl Statements
The following statements can be included in the specification of the likelihood object. These statements are optional, except for “@logl” which is required. See
“The Log Likelihood (LogL) Object” for further discussion.
@byeqn evaluate specification by equation.
@byobs evaluate specification by observation (default).
@deriv specify an analytic derivative series.
@derivstep set parameters to control step size.
@logl specify the likelihood contribution series.
@param set starting values.
@temp remove temporary working series.
Logl Data Members
Scalar Values (system data)
@aic Akaike information criterion.
@coefcov(i,j) covariance of coefficients i and j.
@coefs(i) coefficient i.
@hq Hannan-Quinn information criterion.
@linecount scalar containing the number of lines in the Logl object.
@logl value of the log likelihood function.
@ncoefs number of estimated coefficients.
@regobs number of observations used in estimation.
@sc Schwarz information criterion.
@stderrs(i) standard error for coefficient i.
@tstats(i) t-statistic value for coefficient i.
Vectors and Matrices
@coefcov covariance matrix of estimated parameters.
@coefs coefficient vector.
@pvals vector containing the coefficient probability values.
@stderrs vector of standard errors for coefficients.
@tstats vector of z-statistic values for coefficients.
String values
@attr("arg") string containing the value of the arg attribute, where the argument is specified as a quoted string.
@command full command line form of the estimation command.
@description string containing the Logl object’s description (if available).
@detailedtype returns a string with the object type: “LOGL”.
@displayname returns the Logl’s display name. If the Logl has no display name set, the name is returned.
@line(i) returns a string containing the i-th line of the Logl object.
@method command line form of the estimation method.
@name returns the Logl’s name.
@remarks string containing the logl object’s remarks (if available).
@smpl sample used for Logl estimation.
@svector returns an Svector where each element is a line of the Logl object.
@svectornb same as @svector, with blank lines removed.
@type returns a string with the object type: “LOGL”.
@updatetime returns a string representation of the time and date at which the Logl was last updated.
Logl Examples
To declare a likelihood named LL1:
logl ll1
To define a likelihood function for OLS (not a recommended way to do OLS!):
ll1.append @logl logl1
ll1.append res1 = y-c(1)-c(2)*x
ll1.append logl1 = log(@dnorm(res1/@sqrt(c(3))))-log(c(3))/2
To estimate LL1 by maximum likelihood (the “showstart” option displays the starting values):
ll1.ml(showstart)
To save the estimated covariance matrix of the parameters from LL1 as a named matrix COV1:
matrix cov1=ll1.@coefcov
Append a specification line to a logl.
Syntax
logl_name.append text
Type the text to be added after the append keyword.
Examples
logl ll1
ll1.append @logl logl1
ll1.append res1 = y-c(1)-c(2)*x
ll1.append logl1 = log(@dnorm(res1/@sqrt(c(3))))-log(c(3))/2
declares a logl object called LL1, and then appends a specification that estimates an ordinary least squares model.
Cross-references
See
“Specification” for discussion of logl specifications.
Confidence ellipses for coefficient restrictions.
The cellipse view displays confidence ellipses for pairs of coefficient restrictions for an estimation object.
Syntax
logl_name.cellipse(options) restrictions
Enter the object name, followed by a period, and the keyword cellipse. This should be followed by a list of the coefficient restrictions. Joint (multiple) coefficient restrictions should be separated by commas.
Options
ind=arg | Specifies whether and how to draw the individual coefficient intervals. The default is “ind=line” which plots the individual coefficient intervals as dashed lines. “ind=none” does not plot the individual intervals, while “ind=shade” plots the individual intervals as a shaded rectangle. |
size= number (default=0.95) | Set the size (level) of the confidence ellipse. You may specify more than one size by specifying a space separated list enclosed in double quotes. |
dist= arg | Select the distribution to use for the critical value associated with the ellipse size. The default depends on estimation object and method. If the parameter estimates are least-squares based, the  distribution is used; if the parameter estimates are likelihood based, the  distribution will be employed. “dist=f” forces use of the F-distribution, while “dist=c” uses the  distribution. |
prompt | Force the dialog to appear from within a program. |
p | Print the graph. |
Examples
The two commands:
log1.cellipse c(1), c(2), c(3)
log1.cellipse c(1)=0, c(2)=0, c(3)=0
both display a graph showing the 0.95-confidence ellipse for C(1) and C(2), C(1) and C(3), and C(2) and C(3).
log1.cellipse(dist=c,size="0.9 0.7 0.5") c(1), c(2)
displays multiple confidence ellipses (contours) for C(1) and C(2).
Cross-references
Check derivatives of likelihood object.
Displays a table containing information on numeric derivatives and, if available, the user-supplied analytic derivatives.
Syntax
logl_name.checkderiv(options)
Options
p | Print the table of results. |
Examples
ll1.checkderiv
displays a table that evaluates the numeric derivatives of the logl object LL1.
Cross-references
See
“The Log Likelihood (LogL) Object” for a general discussion of the likelihood object and the
@deriv statement for specifying analytic derivatives.
Clear the contents of the history attribute for logl objects.
Removes the logl’s history attribute, as shown in the label view of the logl.
Syntax
logl_name.clearhist
Examples
L1.clearhist
L1.label
The first line removes the history from the logl L1, and the second line displays the label view of L1, including the now blank history field.
Cross-references
See
“Labeling Objects” for a discussion of labels and display names.
Clear the contents of the remarks attribute.
Removes the logl’s remarks attribute, as shown in the label view of the logl.
Syntax
logl_name.clearremarks
Examples
l1.clearremarks
l1.label
The first line removes the remarks from the logl L1, and the second line displays the label view of L1, including the now blank remarks field.
Cross-references
See
“Labeling Objects” for a discussion of labels and display names.
Coefficient covariance matrix.
Displays the covariances of the coefficient estimates for an estimated likelihood object.
Syntax
logl_name.coefcov(options)
Options
p | Print the coefficient covariance matrix. |
Examples
ll2.coefcov
displays the coefficient covariance matrix for the likelihood object LL2 in a window.
To store the coefficient covariance matrix as a sym object, use the @coefcov object data member:
sym eqcov = ll2.@coefcov
Cross-references
See
“The Log Likelihood (LogL) Object” for a general discussion of the likelihood object.
Creates a copy of the logl.
Creates either a named or unnamed copy of the logl.
Syntax
logl_name.copy
logl_name.copy dest_name
Examples
L1.copy
creates an unnamed copy of the logl L1.
L1.copy L2
creates L2, a copy of the logl L1.
Cross-references
Display table, graph, or spool output in the logl object window.
Display the contents of a table, graph, or spool in the window of the logl object.
Syntax
logl_name.display object_name
Examples
logl1.display tab1
Display the contents of the table TAB1 in the window of the object LOGL1.
Cross-references
Most often used in constructing an EViews Add-in. See
“Custom Object Output”.
Display names for likelihood objects.
Attaches a display name to a likelihood object which may be used to label output in place of the standard object name.
Syntax
logl_name.displayname display_name
Display names are case-sensitive, and may contain a variety of characters, such as spaces, that are not allowed in likelihood object names.
Examples
lg1.displayname Hours Worked
lg1.label
The first line attaches a display name “Hours Worked” to the likelihood object LG1, and the second line displays the label view of LG1, including its display name.
Cross-references
See
“Labeling Objects” for a discussion of labels and display names.
Gradients of the objective function.
Displays the gradients of the objective function (where available) for an estimated likelihood object.
The (default) summary form shows the value of the gradient vector at the estimated parameter values (if valid estimates exist) or at the current coefficient values. Evaluating the gradients at current coefficient values allows you to examine the behavior of the objective function at starting values. The tabular form shows a spreadsheet view of the gradients for each observation. The graphical form shows this information in a multiple line graph.
Syntax
logl_name.grads(options)
Options
g | Display multiple graph showing the gradients of the objective function with respect to the coefficients evaluated at each observation. |
t (default) | Display spreadsheet view of the values of the gradients of the objective function with respect to the coefficients evaluated at each observation. |
p | Print results. |
Examples
To show a summary view of the gradients:
ll2.grads
To display and print the table view:
ll2.grads(t, p)
Cross-references
Display or change the label view of likelihood object, including the last modified date and display name (if any).
As a procedure, label changes the fields in the likelihood object label.
Syntax
logl_name.label
logl_name.label(options) [text]
Options
The first version of the command displays the label view of the likelihood object. The second version may be used to modify the label. Specify one of the following options along with optional text. If there is no text provided, the specified field will be cleared.
c | Clears all text fields in the label. |
d | Sets the description field to text. |
s | Sets the source field to text. |
u | Sets the units field to text. |
r | Appends text to the remarks field as an additional line. |
p | Print the label view. |
Examples
The following lines replace the remarks field of the logl object L2 with “Data from CPS 1988 March File”:
l2.label(r)
l2.label(r) Data from CPS 1988 March File
To append additional remarks to L2, and then to print the label view:
l2.label(r) Log of hourly wage
l2.label(p)
To clear and then set the units field, use:
l2.label(u) Millions of bushels
Cross-references
See
“Labeling Objects” for a discussion of labels.
Declare likelihood object.
Syntax
logl logl_name
Examples
logl ll1
declares a likelihood object named LL1.
ll1.append @logl logl1
ll1.append res1 = y-c(1)-c(2)*x
ll1.append logl1 = log(@dnorm(res1/@sqrt(c(3))))-log(c(3))/2
specifies the likelihood function for LL1 and estimates the parameters by maximum likelihood.
Cross-references
See
“The Log Likelihood (LogL) Object” for further examples of the use of the likelihood object.
See also
Logl::append for adding specification lines to an existing likelihood object, and
Logl::ml for estimation.
Make a group containing individual series which hold the gradients of the objective function.
Syntax
logl_name.makegrads(options) [ser1 ser2 ...]
The argument specifying the names of the series is also optional. If the argument is not provided, EViews will name the series “GRAD##” where ## is a number such that “GRAD##” is the next available unused name. If the names are provided, the number of names must match the number of target series.
Options
n=arg | Name of group object to contain the series. |
Examples
ll2.grads(n=out)
creates a group named OUT containing series named GRAD01, GRAD02, and GRAD03.
ll2.grads(n=out) g1 g2 g3
creates the same group, but names the series G1, G2 and G3.
Cross-references
See
“Check Derivatives” for further discussion.
Make a model from a likelihood object.
Syntax
logl_name.makemodel(name) assign_statement
If you provide a name for the model in parentheses after the keyword, EViews will create the named model in the workfile. If you do not provide a name, EViews will open an untitled model window if the command is executed from the command line.
Examples
ll3.makemodel(logmod) @prefix s_
makes a model named LOGMOD from the estimated logl object. LOGMOD includes an assignment statement “ASSIGN @PREFIX S_”. Use the command “show logmod” or “logmod.spec” to open the LOGMOD window.
Cross-references
See
“Models” for a discussion of specifying and solving models in EViews.
Maximum likelihood estimation of logl models.
Syntax
logl_name.ml(options)
Options
optmethod = arg | Optimization method: “bfgs” (BFGS); “newton” (Newton-Raphson), “opg” or “bhhh” (OPG or BHHH), “legacy” (EViews legacy). Newton-Raphson is the default method. |
optstep = arg | Step method: “marquardt” (Marquardt); “dogleg” (Dogleg); “linesearch” (Line search). Marquardt is the default method. |
cov=arg | Covariance method: “ordinary” (default method based on inverse of the estimated information matrix), “huber” or “white” (Huber-White sandwich methods)., |
covinfo = arg | Information matrix method: “opg” (OPG); “hessian” (observed Hessian). (Applicable when non-legacy “optmethod=”.) |
b | Use Berndt-Hall-Hall-Hausman (BHHH) algorithm (default is Marquardt). |
m=integer | Set maximum number of iterations. |
c=scalar | Set convergence criterion. The criterion is based upon the maximum of the percentage changes in the scaled coefficients. |
showopts / ‑showopts | [Do / do not] display the starting coefficient values and estimation options in the estimation output. |
prompt | Force the dialog to appear from within a program. |
p | Print basic estimation results. |
Examples
bvar.ml
estimates the logl object BVAR by maximum likelihood.
Cross-references
See
“The Log Likelihood (LogL) Object” for a discussion of user specified likelihood models.
Push updates to OLE linked objects in open applications.
Syntax
logl_name.olepush
Cross-references
See
“Object Linking and Embedding (OLE)” for a discussion of using OLE with EViews.
Display estimation output.
output changes the default object view to display the estimation output (equivalent to using
Logl::results).
Syntax
logl_name.output
Options
p | Print estimation output for estimation object |
Examples
The output keyword may be used to change the default view of an estimation object. Entering the command:
log2.output
displays the estimation output for likelihood object LOG2.
Cross-references
Displays the results view of an estimated likelihood object.
Syntax
logl_name.results(options)
Options
Examples
ll1.results(p)
prints the estimation results from the estimated logl, LL1.
Set the object attribute.
Syntax
logl_name.setattr(attr) attr_value
Sets the attribute attr to attr_value. Note that quoting the arguments may be required. Once added to an object, the attribute may be extracted using the @attr data member.
Examples
a.setattr(revised) never
String s = a.@attr("revised")
sets the “revised” attribute in the object A to the string “never”, and extracts the attribute into the string object S.
Cross-references
Display the text specification view for logl objects.
Syntax
logl_name.spec(options)
Options
p | Print the specification text. |
Examples
lg1.spec
displays the specification of the logl object LG1.
Cross-references
Update coefficient object values from likelihood object.
Copies coefficients from the likelihood object into the appropriate coefficient vector or vectors.
Syntax
logl_name.updatecoefs
Follow the name of the likelihood object by a period and the keyword updatecoefs.
Examples
ll1.updatecoefs
places the coefficients from LL1 in the default coefficient vector C.
Cross-references
Wald coefficient restriction test.
Syntax
logl_name.wald restrictions
Enter the likelihood object name, followed by a period, and the keyword. You must provide a list of the coefficient restrictions, with joint (multiple) coefficient restrictions separated by commas.
Options
Examples
ll1.wald c(2)=0, c(3)=0
tests the null hypothesis that the second and third coefficients in LL1 are jointly zero.
Cross-references