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: how to convert regression coefficients into variables
From
"Steve Martin" <[email protected]>
To
<[email protected]>
Subject
RE: st: how to convert regression coefficients into variables
Date
Wed, 30 Mar 2011 14:09:29 +0100
Thanks Roger.
I now have a dataset of the form:
id parameter estimate
1 spend 3
1 imd 6
1 lonepen 8
2 spend 4
2 imd 7
2 lonepen 9
But I would like it as:
id spend imd lonepen
1 3 6 8
2 4 7 9
I guess this is a reshape but I can't work it out!
Steve
-----Original Message-----
From: [email protected]
[mailto:[email protected]] On Behalf Of Roger Newson
Sent: 30 March 2011 11:08
To: [email protected]
Subject: Re: st: how to convert regression coefficients into variables
Another possibility is to use the -flist()- option of -parmest- to store
a list of -tempfile- names in a global macro. This global macro can then
be input to -append- in Stata Version 11 (or to the SSC package
-dsconcat- in Stata Versions 10 or below) to produce a concatenated
resultsset, containing the contents of the multiple resultssets. For
each observation in the concatenated resultsset, the dataset of origin
can be identified, if the user specifies an -idstr()- option or an
-idnum()- option in the original -parmest- command.
For an example of this method, see the penultimate example in the
on-line help for -parmest-, which you can access in Stata by typing
help parmest
I hope this helps.
Best wishes
Roger
Roger B Newson BSc MSc DPhil
Lecturer in Medical Statistics
Respiratory Epidemiology 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 7352 8121 ext 3381
Fax: +44 (0)20 7351 8322
Email: [email protected]
Web page: http://www.imperial.ac.uk/nhli/r.newson/
Departmental Web page:
http://www1.imperial.ac.uk/medicine/about/divisions/nhli/respiration/popgene
tics/reph/
Opinions expressed are those of the author, not of the institution.
On 30/03/2011 09:41, Nick Cox wrote:
> Possibly something along these lines
>
> forval i = 1/9 {
>
>
> On Wed, Mar 30, 2011 at 9:25 AM, Steve Martin<[email protected]>
wrote:
>> Yes, thanks Dimitriy!
>>
>> I've one more query. Following Roger's example, I'm writing the
parameters
>> from successive estimations to tempfiles using: parmest,
saving(`"`tf1'"',
>> replace).
>>
>> I would like to use this in conjunction with a forvalues i=1/9 command.
How
>> should I specify `"`tf1'"' if I want to replace the 1 in `"`tf1'"' with
i?
>>
>> Steve
>>
>>
>> -----Original Message-----
>> From: [email protected]
>> [mailto:[email protected]] On Behalf Of Dimitriy V.
>> Masterov
>> Sent: 29 March 2011 19:31
>> To: [email protected]
>> Subject: Re: st: how to convert regression coefficients into variables
>>
>> Steve,
>>
>> Take a look at Roger Newson's package parmest at ssc.
>>
>> Does that accomplish what you want?
>>
>> DVM
>>
>> On Tue, Mar 29, 2011 at 2:26 PM, Steve Martin<[email protected]>
>> wrote:
>>> I am using -cnsreg- to estimate a constrained regression model in Stata
>> 11.
>>>
>>>
>>> I am interested in how the coefficient (call this b2) on one particular
>>> regressor changes as I change the constraints (call the values of these
b3
>>> and b4) on two of the other regressors.
>>>
>>> At the moment the results for each regression are written to a
>> spreadsheet.
>>>
>>> However, it would be useful if I could save the values of b2, b3 and b4
>> from
>>> each regression (eg by writing to a file) with a view to plotting b2, b3
>> and
>>> b4 from the 30 or so regressions I estimate.
>>> Is this possible?
>>>
>>> Thanks.
>>>
>>> Steve
>>>
>>>
>>>
>>>
>>>
>>> *
>>> * For searches and help try:
>>> * http://www.stata.com/help.cgi?search
>>> * http://www.stata.com/support/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/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/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/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/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/statalist/faq
* http://www.ats.ucla.edu/stat/stata/