Notice: On April 23, 2014, Statalist moved from an email list to a forum, based at statalist.org.
From | "Max Zamanian" <Max.Zamanian@his.se> |
To | <statalist@hsphsun2.harvard.edu> |
Subject | st: generating varables |
Date | Mon, 25 Oct 2010 11:40:18 +0200 |
Hi friends, For teaching purposes I would like to create variables following different order of difference equations such as 1. Yt=bYt-1 2. Yt=a+bYt-1 3. Yt=a+bYt-1+cYt-2 etc This is an example of data series I generate in MS Excel. 1 Sigle nubmer, 1 0,5 Formula: =+E1*0,5 -0,55 =+(E2*0,5)-(E1*0,8) -0,675 0,1025 0,59125 0,213625 -0,36619 -0,35399 0,115953 0,341172 0,077823 -0,23403 -0,17927 0,097585 0,19221 0,018037 -0,14475 -0,0868 0,072397 0,105642 -0,0051 -0,08706 -0,03945 0,049923 0,056524 -0,01168 For the first one I have got the way doing it, through STATA support, which is the following: clear set obs 10 generate x = 1 * (0.5)^(_n - 1) list * end example Here b=0.5 and the initial value of Y=1. I can of course replace these values to get different series. Otherwise I do not understand what is going on, therefore I cannot generate diff eq 2 and 3 above. I need a general description about how to generate variables like these and preferably also references to the appropriate menu(s) to get these variables. Thanks, Max * * 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/