Notice: On March 31, it was **announced** that Statalist is moving from an email list to a **forum**. The old list will shut down on April 23, and its replacement, **statalist.org** is already up and running.

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

From |
"Roger B. Newson" <r.newson@imperial.ac.uk> |

To |
statalist@hsphsun2.harvard.edu |

Subject |
Re: st: testing coefficients using parmby command |

Date |
Fri, 27 Jul 2012 13:59:17 +0100 |

#delim ; global tflist ""; levelsof id, lo(ids); foreach ID of num `ids' {; regr y x1 ,robust; test (_cons=0) (x1=1); scal stestp=r(p); tempfile tfcur; parmest, label idstr(`ID'&`=stestp') saving(`"`tfcur'"', replace) flis(tflist); }; clear; append using $tflist; split idstr, parse(&) gene(S_); destring S_1, gene(id); destring S_2, gene(testp); drop idstr S_*; sort id, stable;

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: r.newson@imperial.ac.uk Web page: http://www.imperial.ac.uk/nhli/r.newson/ Departmental Web page: http://www1.imperial.ac.uk/medicine/about/divisions/nhli/respiration/popgenetics/reph/ Opinions expressed are those of the author, not of the institution. On 27/07/2012 13:14, David Ashcraft wrote:

Thanks Roger. Do you have any example that I can follow? What you have said makes complete sense but it is a little overwhelming for me to implement. Regards David ----- Original Message ----- From: Roger B. Newson <r.newson@imperial.ac.uk> To: statalist@hsphsun2.harvard.edu Cc: Sent: Friday, July 27, 2012 1:22:38 PM Subject: Re: st: testing coefficients using parmby command To do this, you have to use -parmest- inside a loop, instead of using -parmby-. You need to loop over the values of -id-. In each iteration of the loop, you nee to execute your command for the current -id- group, use -test- to extract the test statistics for the current -id- group, and then use -parmest- for each -id- group, storing the test statistics in the -idnum()- or -idstr)_- options of -parmest-, and storing the results for the current -id- group in a -tempfile-. After doung this, you can concatenate the resultssets created, using -append- or maybe -dsconcat-, and then you will have a combined resultsset in memory, complete with test statistics. 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: r.newson@imperial.ac.uk Web page: http://www.imperial.ac.uk/nhli/r.newson/ Departmental Web page: http://www1.imperial.ac.uk/medicine/about/divisions/nhli/respiration/popgenetics/reph/ Opinions expressed are those of the author, not of the institution. On 26/07/2012 12:34, David Ashcraft wrote:I am using parmby command to regress a number of equations by id as per below: parmby "regr y x1 ,robust",by(id) label saving(myparms3,replace) Now I want to test for each id: test _cons=0 test X1=1 test (_cons=0)(X1=1) and store these results on myparms3 file. At the moment when I run the last three commands, it simply give me the result of last regression. Any help will be highly appreciated. Regards David * * 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/

**Follow-Ups**:**Re: st: testing coefficients using parmby command***From:*"Roger B. Newson" <r.newson@imperial.ac.uk>

**References**:**st: testing coefficients using parmby command***From:*David Ashcraft <ashcraftd@rocketmail.com>

**Re: st: testing coefficients using parmby command***From:*"Roger B. Newson" <r.newson@imperial.ac.uk>

**Re: st: testing coefficients using parmby command***From:*David Ashcraft <ashcraftd@rocketmail.com>

- Prev by Date:
**Re: st: count instances across a group of variables** - Next by Date:
**Re: st: testing coefficients using parmby command** - Previous by thread:
**Re: st: testing coefficients using parmby command** - Next by thread:
**Re: st: testing coefficients using parmby command** - Index(es):