Bookmark and Share

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]

Re: st: saving estimated parameters with -parmby-


From   "Roger B. Newson" <r.newson@imperial.ac.uk>
To   statalist@hsphsun2.harvard.edu
Subject   Re: st: saving estimated parameters with -parmby-
Date   Thu, 02 Feb 2012 16:55:59 +0000

I think the way forward here is to use -reshape- after -parmby-. You should probably drop all results variables you don't want to keep from the -parmby- resultsset and then use -reshape wide-. As in:

reshape wide estimate p, i(group_id) j(parmseq)

Another possibility is to use -statsby- instead of -parmby-.

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 02/02/2012 16:37, Schöler, Lisa wrote:
Dear Statalist,

I have a dataset with many firms and many observations of a firm. Now I need to run a nonlinear least-squares estimation.

After running the nonlinear least-squares estimation, I would like to save the estimated parameters. So I found suggestions for parmest, in my case parmby because I have different group_ids.

But what I need is that Stata saves each estimate (i.e., b0-b3) in a row, for example

group_id	adopters 	var2 	 ...		t	b0	b1	b2	b3
1		500		.	.		1	0.3	5	88	1	
1		501					2	0.3	5	88	1	
1		502					3	0.3	5	88	1	
1		503					4	0.3	5	88	1	
1		504					5	0.3	5	88	1	
1		505					6	0.3	5	88	1	
2		100					1	5	4	0.2	0.8	
2		106					2	5	4	0.2	0.8	
2		108					3	5	4	0.2	0.8	
3		250					1	1	0.5	0.8	5	
3		297					2	1	0.5	0.8	5	
3		300					3	1	0.5	0.8	5


This is the command I use (Stata 11)

. parmby "nl (adopters= {b0}/(1+exp({-b1}-{b2}*t))+{b3}*t^2)",by(group_id) saving(nl_coefficients,replace)

This works but the estimated parameters are saved like this

group_id	parmseq	estimate
1		b0		238421.79
1		-b1		730.78458
1		b2		21.785424
1		b3		3.0373359
2		b0		8437.5189
2		-b1		41.075473
2		b2		6.0825979
2		b3		-.24629756

Is there an option that I am missing?

Thank you
Lisa

Lisa Schöler
Professur für BWL, insb. Electronic Commerce
Goethe-Universität Frankfurt
Grüneburgplatz 1
60629 Frankfurt a.M.

Phone: ++49 69 798 34632
Fax:   ++49 69 798 35001
Email: lschoeler@wiwi.uni-frankfurt.de
URL:   www.ecommerce.wiwi.uni-frankfurt.de

_________________________________
Get serious about better marketing decisions - apply now!
http://www.goethe-master.de



Lisa Schöler
Professur für BWL, insb. Electronic Commerce
Goethe-Universität Frankfurt
Grüneburgplatz 1
60629 Frankfurt a.M.

Phone: ++49 69 798 34632
Fax:   ++49 69 798 35001
Email: lschoeler@wiwi.uni-frankfurt.de
URL:   www.ecommerce.wiwi.uni-frankfurt.de

_________________________________
Get serious about better marketing decisions - apply now!
http://www.goethe-master.de



*
*   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–2014 StataCorp LP   |   Terms of use   |   Privacy   |   Contact us   |   Site index