Statalist The Stata Listserver


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

st: RE: Returning list of independent variables used in ml model command


From   "Maarten Buis" <[email protected]>
To   <[email protected]>
Subject   st: RE: Returning list of independent variables used in ml model command
Date   Wed, 18 Apr 2007 18:11:17 +0200

--- Rachel wrote:
> I'm using estsave to save my ml estimates as I go along.  Is there any
> way to exctract a list of independent variables used in the equations
> after using estsave to save and recall the results?

These names are present in the column names of the parameter vector:

*----------- begin example --------
sysuse auto, clear
recode rep78 1/2=3
mlogit rep78 price mpg

matrix b = e(b)
*create matrix with the estimates

matrix b = b[1,"4:"]
*select the equation called 4
*in your case you would select eqn1
*by typing: matrix b = b[1,"eqn1:"]

local x : colnames b
*get the column names 

local cons "_cons"
local x : list x - cons
*remove the name _cons

di "`x'"
*----------- end example -----------
(For more on how to use examples I sent to the Statalist, see:
http://home.fsw.vu.nl/m.buis/stata/exampleFAQ.html )

Hope this helps,
Maarten

-----------------------------------------
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/
-----------------------------------------



*
*   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