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 at the end of May, and its replacement, statalist.org is already up and running.


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

RE: st: documentation on iteration for a non linear regression


From   tashi lama <ltashi32@hotmail.com>
To   <statalist@hsphsun2.harvard.edu>
Subject   RE: st: documentation on iteration for a non linear regression
Date   Wed, 13 Jun 2012 15:04:12 +0000

That would help. Thanx... but it doesn't hurt to learn more although I am planning to spend a day or two to go through the manual on matrix, sth I haven't looked at before. I had a dataset as follows



            day     hits   b          v |
     |---------------------------------|
  1. | 03jan2011    211   1   209.0752 |
  2. | 04jan2011     60   2   69.08601 |
  3. | 05jan2011     28   3   22.82851 |
  4. | 06jan2011     16   4   7.543365 |
----------------------------------------

 

v is my predicted value. day and hits are my original value and I generated b to use it as independant variable instead of day for simplification. Drawing a scatter plot helped me identify the nature of the curve which is exponential so i decided to use one of the built in exp models. So, I said 

 

nl exp2 :hits b 

 

which returned e(b) among many things. if you don't remember exp2 is exp2: y = b1*b2^x. I was having difficulty accesssing my e(b) if I wanted to use it in my dofile. The manual suggests _b[varname] and _se[varname]. 

Also says... use _b[_cons] and _se[_cons] for constant. I was confused. 

 

Thanx.. 

 

 


> From: n.j.cox@durham.ac.uk
> To: statalist@hsphsun2.harvard.edu
> Date: Wed, 13 Jun 2012 15:50:53 +0100
> Subject: RE: st: documentation on iteration for a non linear regression
>
> It all depends on what command you are using. You don't say what command you used previously (another piece of advice being ignored), but after -nl- (for example) common steps would be
>
> mat b = e(b)
>
> di b[1,1]
>
> di b[1,2]
>
> scalar b1 = b[1,1]
>
> scalar b2 = b[1,2]
>
> Nick
> n.j.cox@durham.ac.uk
>
> tashi lama
>
> Sorry, I read and reread the manual. I am confused. The manual says _b[varname] and _se[varname] to access the coeff and standard error of a var and _b[_cons] and _se[_cons] to access the coeff and standard error of a constant. I am fitting a exponential model y=b1*b2^x to my dataset and got e(b) as
>
> mat li e(b)
>
> e(b)[1,2]
> b1: b2:
> _cons _cons
> y1 632.7252 .33046311
>
> di _b[_cons] gave me the coeffiecient i.e. 632.73. In the same spirit, I would assume I do di _b[x] to get the coeff of x. There is an error which reads [x] not found. Any idea?
>
> *
> * 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