Notice: On April 23, 2014, Statalist moved from an email list to a forum, based at statalist.org.
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: st: Get list of non-omitted variables after a regression
From
"Roger B. Newson" <[email protected]>
To
[email protected]
Subject
Re: st: Get list of non-omitted variables after a regression
Date
Mon, 10 Mar 2014 14:13:30 +0000
Another possibility is to use the -parmest- package, which you can
download from SSC, to create an output dataset (or resultsset) with 1
observation per parameter and data on parameter names, estimates,
confidence limits, P-values and other parameter attributes. -parmest-
has an -omit- option, which causes the resultsset to contain a binary
variable -omit-, indicating that the parameter is omitted. You can also
download the -parmparse- package from SSC, which is intended to be used
in -parmest- resultssets, and which can extract other information from
the parameter name, such as the factors involved and the base-category
status for each factor. -parmest- is very useful for mass-production of
parameters, which you seem to be doing.
I hope this helps.
Best wishes
Roger
Roger B Newson BSc MSc DPhil
Lecturer in Medical Statistics
Respiratory Epidemiology, Occupational Medicine
and Public Health Group
National Heart and Lung Institute
Imperial College London
Royal Brompton Campus
Room 33, Emmanuel Kaye Building
1B Manresa Road
London SW3 6LR
UNITED KINGDOM
Tel: +44 (0)20 7594 7931
Email: [email protected]
Web page: http://www.imperial.ac.uk/nhli/r.newson/
Departmental Web page: http://www.imperial.ac.uk/nhli/reomph/
Opinions expressed are those of the author, not of the institution.
On 10/03/2014 13:46, Seed, Paul wrote:
The simplest solution is to get the column names off the regression matrix.
*********** Start Stata code ***************
sysuse auto, clear
stepwise , pe(0.05) : regress price mpg rep78 headroom trunk weight length turn displacement gear_ratio foreign
local n : colnames e(b)
di "`n'"
* If you want to lose the constant...
local c _cons
local n : list n-c
di "`n'"
* Note, I am using macro extended functions to avoid silent, automatic
* truncation of macros at 245 characters whenever "=" occurs.
*********** End Stata code ******************
Paul T Seed, Women's Health, KCL
Date: Sat, 8 Mar 2014 16:30:49 -0600
From: Scott Merryman <[email protected]>
Subject: Re: st: Get list of non-omitted variables after a regression
See - _rmcoll , forcedrop -
Scott
On Sat, Mar 8, 2014 at 3:38 PM, Ludovico Zaraga
<[email protected]> wrote:
Hello,
Is there a simple way of getting a list (in the form of a macro) of
non-omitted variables after running a regression in Stata? I am using
a very large number of variables, so I can't do this by hand.
Thanks,
Ludovico
*
* For searches and help try:
* http://www.stata.com/help.cgi?search
* http://www.stata.com/support/faqs/resources/statalist-faq/
* http://www.ats.ucla.edu/stat/stata/
*
* For searches and help try:
* http://www.stata.com/help.cgi?search
* http://www.stata.com/support/faqs/resources/statalist-faq/
* http://www.ats.ucla.edu/stat/stata/