Statalist


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

AW: st: AW: How to solve this problem when running separate regression using stasby or looping


From   "Martin Weiss" <martin.weiss1@gmx.de>
To   <statalist@hsphsun2.harvard.edu>
Subject   AW: st: AW: How to solve this problem when running separate regression using stasby or looping
Date   Fri, 8 May 2009 00:05:45 +0200

<> 

Here is an example of what a solution with -postfile- could look like:


*************
sysuse auto, clear  

tempname hdle
tempfile info
postfile `hdle' i alpha r using `info'

qui forv i=1/5{
		capt nl
(weight=price^{alpha=1}*{beta=0.6}*exp(-{r=0.1}*tru)) if runiform()<0.7
		post `hdle' (`i') (_b[/alpha]) (_b[/r])
 }

postclose `hdle'


preserve
use `info', clear
l, abbrev(12) noobs sep(0)
restore
*************



HTH
Martin


-----Ursprüngliche Nachricht-----
Von: owner-statalist@hsphsun2.harvard.edu
[mailto:owner-statalist@hsphsun2.harvard.edu] Im Auftrag von Martin Weiss
Gesendet: Donnerstag, 7. Mai 2009 23:47
An: statalist@hsphsun2.harvard.edu
Betreff: AW: st: AW: How to solve this problem when running separate
regression using stasby or looping


<> 

I would suggest - postfile- if all you want are just the three columns...

See http://www.stata-journal.com/article.html?article=pr0036



HTH
Martin

-----Ursprüngliche Nachricht-----
Von: owner-statalist@hsphsun2.harvard.edu
[mailto:owner-statalist@hsphsun2.harvard.edu] Im Auftrag von Quang Nguyen
Gesendet: Donnerstag, 7. Mai 2009 23:23
An: statalist@hsphsun2.harvard.edu
Betreff: Re: st: AW: How to solve this problem when running separate
regression using stasby or looping

Excellent, Martin. Thanks so much indeed. Using estout,  can anyone
suggest a quick solution to generate an output file that is similar to
using _stasby_. In particular, I would like to have an output file as
follows:

id    alpha          r
1    1.2             0.04
2    1.5             0.06
..............................

I use  _esttab, however, the output look a bit messy.

Many thanks!


On Thu, May 7, 2009 at 5:36 AM, Martin Weiss <martin.weiss1@gmx.de> wrote:
>
> <>
>
> I would install -ssc d estout- and combine it with -capture-
>
>
> *************
> forval i = 1/184
> {
>        capt eststo: nl (reward=y^{alpha=1}*{beta=0.6}*exp(-{r=0.1}*t)) if
> id==`i'
> }
> *************
>
>
>
> HTH
> Martin
>
>
> -----Ursprüngliche Nachricht-----
> Von: owner-statalist@hsphsun2.harvard.edu
> [mailto:owner-statalist@hsphsun2.harvard.edu] Im Auftrag von Quang Nguyen
> Gesendet: Donnerstag, 7. Mai 2009 17:27
> An: statalist@hsphsun2.harvard.edu
> Betreff: st: How to solve this problem when running separate regression
> using stasby or looping
>
>  Dear All,
>
> I would like to run separate estimation equations for each individual.
> Using the _stasby_ command such as:
>
> statsby, by(id): nl (reward=y^{alpha=1}*{beta=0.6}*exp(-{r=0.1}*t))
>
> Stata doesn't work since there missing value or inconvergence for some
> individuals. Using the loop such as:
>
> forval i = 1(1)184
> {
> nl (reward=y^{alpha=1}*{beta=0.6}*exp(-{r=0.1}*t)) if id==`i'
> }
>
> The same thing happens.
>
> Can you suggest me a solution so that Stata can go on with the
> estimation for all "estimable" individuals and assign missing value to
> the case with inconergence or missing value?
>
> Many thanks!
> --
> "My father gave me the greatest gift anyone could give another person,
> he believed in me." - Jim Valvano
>
> *
> *   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/
>



-- 
"My father gave me the greatest gift anyone could give another person,
he believed in me." - Jim Valvano

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