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: RE: Variable Estimation


From   Léon Bueckins <[email protected]>
To   [email protected]
Subject   Re: st: RE: Variable Estimation
Date   Sun, 7 Nov 2010 19:03:32 +0100

Yes you are right, the variable I want to create tries to measure the mean absolute deviation in time point t.

There is no problem with missing values but N should be adjusted in each t. For example, in t I got 45 observations, in t+1 I have 44 and so on. So the denominator Should get the number of non-empty observations which can be obtained by - sum return if return !=. -
And yes I don't need the overall mean but the mean in t, that's the problem


Am 07.11.2010 um 18:13 schrieb Nick Cox:

> This is difficult to follow. 
> 
> For example, where does the r(n) you refer to come from? 
> 
> You seem to be trying to put the mean into a variable, but what you will have in -r_m- is itself a variable, the mean so far, not in general the overall mean.  Also, your calculation assumes no missing values. 
> 
> I suggest you read the documentation for -summarize- and -egen-. 
> 
> Nick 
> [email protected] 
> 
> Léon Bueckins
> 
> I try to estimate the following variable, basing upon this equation: http://cl.ly/34Px
> But somehow I can't get it to work properly, so I may need some help. The problem is that N is different for each t.
> 
> 
> *get number of groups per t
> bysort igroup : g trun =_n 
> local nGroups =r(n) 
> 
> *get mean return per t = r_m,t
> g r_m = (sum(return))/_n
> 
> *get csad
> g csad = (abs(return - r_m))/`nGroups'
> 
> 
> 
> *
> *   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