Statalist The Stata Listserver


[Date Prev][Date Next][Thread Prev][Thread Next][Date index][Thread index]

Re: st: -ml display- help


From   jpitblado@stata.com (Jeff Pitblado, StataCorp LP)
To   statalist@hsphsun2.harvard.edu
Subject   Re: st: -ml display- help
Date   Fri, 16 Mar 2007 13:37:39 -0500

Partha Deb <partha.deb@hunter.cuny.edu> wants to change what is reported in
the title for the first column of the estimates table after -ml- fits a model.

> I have a question about how to modify default display information in the 
> header line of the coefficients table following estimation using -ml model- .
> 
> To the best of my understanding, in models with one dependent variable, -ml 
> display- returns something like this:
> 
> ------------------------------------------------------------------------------
>           mpg |      Coef.   Std. Err.      z    P>|z|     [95% Conf. Interval]
> -------------+----------------------------------------------------------------
> 
> while in models with more than one dependent variable - ml display- returns this:
> 
> ------------------------------------------------------------------------------
>               |      Coef.   Std. Err.      z    P>|z|     [95% Conf. Interval]
> -------------+----------------------------------------------------------------
> 
> I'd like to insert some text in the space where the variable name would be in 
> a single dependent variable model.  How can I do that?

For single equation models, -ml display- will report the contents of
-e(depvar)- in the column 1 heading provided there are no spaces in
-e(depvar)-.  Here is an example do-file:

***** BEGIN:
* xmpl.do

capture program drop mylogit_lf
capture program drop mylogit

program mylogit_lf
	version 9.2
	args lnf xb
	quietly replace `lnf' = ln(invlogit( `xb')) if $ML_y1 == 1
	quietly replace `lnf' = ln(invlogit(-`xb')) if $ML_y1 == 0
end

program mylogit, eclass
	version 9.2
	if replay() {
		if ("`e(cmd)'" != "mylogit") error 301
		ml display `0'
	}
	syntax [varlist] [if] [in] [, Level(cilevel) ]
	gettoken y xvars : varlist
	ml model lf mylogit_lf (`y': `y' = `xvars'), max
	ereturn local depvar "AltMessage"
	ereturn local cmd mylogit
	ml display, level(`level')
end

sysuse auto

mylogit for mpg turn

* end: xmpl.do
***** END:

Here is a portion of the output (notice the 'AltMessage'):

***** BEGIN:
------------------------------------------------------------------------------
  AltMessage |      Coef.   Std. Err.      z    P>|z|     [95% Conf. Interval]
-------------+----------------------------------------------------------------
         mpg |  -.0752537   .0695708    -1.08   0.279      -.21161    .0611025
        turn |  -.6226835   .1550278    -4.02   0.000    -.9265323   -.3188347
       _cons |   24.51152   6.781471     3.61   0.000     11.22008    37.80295
------------------------------------------------------------------------------
***** END:

--Jeff
jpitblado@stata.com
*
*   For searches and help try:
*   http://www.stata.com/support/faqs/res/findit.html
*   http://www.stata.com/support/statalist/faq
*   http://www.ats.ucla.edu/stat/stata/



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