Statalist The Stata Listserver


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

Re: st: problems with the -ereturn repost- command


From   Maarten buis <[email protected]>
To   [email protected]
Subject   Re: st: problems with the -ereturn repost- command
Date   Sat, 13 Jan 2007 10:03:52 +0000 (GMT)

--- Zurab Sajaia <[email protected]> wrote:
> although -glm- works fine, I'm afraid it doesn't solve my problem,
> I'm writing some 'pre'postestimation command, it does some
> modifications of the estimated b matrix and saves back to e(b) for
> any postestimation commands to follow afterwards. So it might mean
> that it won't work with -probit- and -logit- this way...

You can write a program that restimates the model with -glm-. This does
not have to be very time consuming since you can feed the results from
-probit- and -logit- as initial values to -glm-. See the example below:

Hope this helps,
Maarten

*------------ begin example ---------------
set more off
set rmsg on

capture program drop Toglm
program define Toglm
	*! 1.0.0  MLB 13 Jan 2007
	if "`e(cmd)'" == "probit" {
		tempname init
		local indepvars : colnames e(b)
		local cons "_cons"
		local indepvars : list indepvars - cons
		matrix `init' = e(b)
		qui glm `e(depvar)' `indepvars', from(`init') /*             
                 */ family(binomial) link(probit)
	}
	if "`e(cmd)'" == "logit" {
		tempname init
		local indepvars : colnames e(b)
		local cons "_cons"
		local indepvars : list indepvars - cons
		matrix `init' = e(b)
		qui glm `e(depvar)' `indepvars', from(`init')  /*
                 */ family(binomial) link(logit)
	}
end

sysuse auto, clear

probit foreign weight mpg trunk
di e(cmd)
Toglm
di e(cmd)

logit foreign weight mpg trunk
di e(cmd)
Toglm
di e(cmd)

reg foreign weight mpg trunk
di e(cmd)
Toglm
di e(cmd)
*----------- end example ---------------

-----------------------------------------
Maarten L. Buis
Department of Social Research Methodology
Vrije Universiteit Amsterdam
Boelelaan 1081
1081 HV Amsterdam
The Netherlands

visiting address:
Buitenveldertselaan 3 (Metropolitan), room Z434

+31 20 5986715

http://home.fsw.vu.nl/m.buis/
-----------------------------------------


	
	
		
___________________________________________________________ 
New Yahoo! Mail is the ultimate force in competitive emailing. Find out more at the Yahoo! Mail Championships. Plus: play games and win prizes. 
http://uk.rd.yahoo.com/evt=44106/*http://mail.yahoo.net/uk 
*
*   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–2024 StataCorp LLC   |   Terms of use   |   Privacy   |   Contact us   |   What's new   |   Site index