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: documentation on iteration for a non linear regression


From   tashi lama <[email protected]>
To   <[email protected]>
Subject   RE: st: documentation on iteration for a non linear regression
Date   Wed, 13 Jun 2012 17:02:55 +0000

I am a beginer in performing regressions although I took a single class in econometrics while in school . So, you would guess that I am quite new into this matter. However, having math background, it gives me a courage to run regression to get an approximated function. Looking at the scatter graph, I surmised exponential regression might just do it. As a mathematician, if the fitted function is very close or almost close to the data points, I would be happy. And nl exp2: y x would give me a close fit with  R-square ~ .9785. Now, since I have my fitted function, I could use it to find slopes although my eventual goal is to find the decay rate, which is yet another puzzle. 

By the way, I tried poisson which is also close and if anyone is interested, my dataset looks like following. I generate b to be run as x instead of day for simplification. As obvious from the dataset, it looks like a decreasing exponential decay. I need to get the decay rate if someone has any idea or thoughts...

 

             day   hits     b |
     |------------------------|
  1. | 03jan2011    211     1 |
  2. | 04jan2011     60     2 |
  3. | 05jan2011     28     3 |
  4. | 06jan2011     16     4 |
  5. | 07jan2011     20     5 |
     |------------------------|
  6. | 08jan2011      2     6 |
  7. | 09jan2011      8     7 |
  8. | 10jan2011     10     8 |
  9. | 11jan2011      7     9 |
 10. | 12jan2011     12    10 |
     |------------------------|
 11. | 13jan2011      7    11 |
 12. | 14jan2011      0    12 |
 13. | 15jan2011      3    13 |
 14. | 16jan2011      3    14 |
 15. | 17jan2011      5    15 |
     |------------------------|
 16. | 18jan2011      1    16 |
 17. | 19jan2011      0    17 |
 18. | 20jan2011      1    18 |
 19. | 21jan2011      1    19 |
 20. | 22jan2011      0    20 |
     |------------------------|
 21. | 23jan2011      0    21 |
 22. | 24jan2011      5    22 |
 23. | 25jan2011      4    23 |
 24. | 26jan2011      4    24 |
 25. | 27jan2011      0    25 |
     |------------------------|
 26. | 28jan2011      1    26 |
 27. | 29jan2011      0    27 |
 28. | 30jan2011      0    28 |
 29. | 31jan2011      2    29 |
 30. | 01feb2011      1    30 |
     |------------------------|
 31. | 02feb2011      2    31 |
 32. | 03feb2011      0    32 |
 33. | 04feb2011      2    33 |
 34. | 05feb2011      2    34 |


Thanx..

 

  
----------------------------------------
> Date: Wed, 13 Jun 2012 11:39:35 -0400
> Subject: Re: st: documentation on iteration for a non linear regression
> From: [email protected]
> To: [email protected]
>
> tashi lama <[email protected]>:
> You seem to be assuming additive Gaussian errors for a count outcome,
> which strikes me as a bad idea. Compare the plausibility of the
> various equivalent models below, and read the corresponding manual
> entries for those commands.
>
> clear
> input x y
> 1 211
> 2 60
> 3 28
> 4 16
> end
> nl exp2: y x, nolog
> di [b1]_b[_cons], [b2]_b[_cons]
> nl exp2 y x, nolog
> di _b[b1], _b[b2]
> glm y x, link(log) fam(gaussian) nolog
> di exp(_b[_cons]), exp(_b[x])
> glm y x, link(log) fam(poisson) nolog
> di exp(_b[_cons]), exp(_b[x])
> poisson y x, nolog
> di exp(_b[_cons]), exp(_b[x])
>
>
> On Wed, Jun 13, 2012 at 11:04 AM, tashi lama <[email protected]> wrote:
> > 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
> >
>
> *
> * 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