Bookmark and Share

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: testing coefficients using parmby command


From   "Kasongo, Webster" <[email protected]>
To   "[email protected]" <[email protected]>
Subject   RE: st: testing coefficients using parmby command
Date   Fri, 27 Jul 2012 09:45:27 -0500

Thanks
Hi
Is cross-classified random effect model analysis implementable in in stata 12?
Any codes?
Webster

-----Original Message-----
From: [email protected] [mailto:[email protected]] On Behalf Of Alexander Turner
Sent: Friday, July 27, 2012 9:42 AM
To: [email protected]
Subject: RE: st: testing coefficients using parmby command

send your question to [email protected] ________________________________________
From: [email protected] [[email protected]] on behalf of Kasongo, Webster [[email protected]]
Sent: 27 July 2012 14:39
To: [email protected]
Subject: RE: st: testing coefficients using  parmby command

How do I ask a question on statlist

-----Original Message-----
From: [email protected] [mailto:[email protected]] On Behalf Of David Ashcraft
Sent: Friday, July 27, 2012 9:37 AM
To: [email protected]
Subject: Re: st: testing coefficients using parmby command

Thanks a lot Roger, It was a great help. It worked out very well. Now I am missing only level of significance that I believe I can do myself. Best Regards

David


----- Original Message -----
From: Roger B. Newson <[email protected]>
To: [email protected]
Cc:
Sent: Friday, July 27, 2012 4:01:54 PM
Subject: Re: st: testing coefficients using  parmby command

Sorry, my -regress- command should have been:

regr y x1 if id==`ID', robust;

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

Opinions expressed are those of the author, not of the institution.

On 27/07/2012 13:59, Roger B. Newson wrote:
> There are a large numbers of assorted -parmest- examples in the 
> on-line help for -parmest-, and in the various references cited there.
> However, in your case, the trick is probably to use -levelsof- to get 
> a list of levels of -id-, and to loop over those, storing the 
> temporary filenames in a global macro. The resultssets can then be 
> concatenated, and the
> -idstr()- option can be used for storing information specific to each 
> resultsset on one or more resultsset-specific quantities. The -split- 
> command can be usefful, if we have multiple resultsset-specific 
> variables. As in:
>
> #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;
>
> This will create an output dataset (or resultsset) in the memory, with
> 1 observation per fitted parameter and 2 extra variables -id- and 
> -testp-, containing the appropriate value of -id- and the test 
> P-value, respectively.
>
> Many variations on this theme are possible. For instance, if -id- has 
> value labels and/or a variable label orand/or a format, then we might 
> use the SSC package -descsave-, with the -dofile()- option, to 
> re-create these in the concatenated resultsset.
>
> 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/p
> opgenetics/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 <[email protected]>
>> To: [email protected]
>> 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: [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/
>> 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/
*
*   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/


© Copyright 1996–2018 StataCorp LLC   |   Terms of use   |   Privacy   |   Contact us   |   Site index