Hi everyone,
I have a panel dataset with several countries and years. I am trying to calculate the standard deviation of one variable (growth) for each country over three-year windows (i.e. stdev in 1980 to 1983, 1984 to 1987 and so on). I successfully managed to do this with the following commands:
This all works fine. However, by the above command, Stata is calculating the sample standard deviation, while I want to have the population standard deviation. I had a look into Google and Stata manuals, but I cannot seem to find any command that would calculate what I need. Stata simply refers to "standard deviation", without really mentioning anything about the distinction between sample and population. I can see that I could achieve my goal with some manually input formula, but I struggle to believe that Stata doesn't have a command for doing this.
Do you have any suggestions?
EDIT: Actually, I would also like to hear your opinions on whether I am doing the right thing by looking for the population, rather than sample standard deviation. I am using the data on gdp growth for each 3-year period to calculate the standard deviation in those 3 years (i.e. not to infer the standard deviation of growth over a longer time-span). Do you agree that the population standard deviation is indeed the most correct statistic for this case?
Thanks in advance,
Giuseppe
I have a panel dataset with several countries and years. I am trying to calculate the standard deviation of one variable (growth) for each country over three-year windows (i.e. stdev in 1980 to 1983, 1984 to 1987 and so on). I successfully managed to do this with the following commands:
Code:
*Generating 3-year windows gen years = 1 + 3 * floor((year - 1)/3) *Calculating volatility bysort id years: egen sd=sd(growth)
Do you have any suggestions?
EDIT: Actually, I would also like to hear your opinions on whether I am doing the right thing by looking for the population, rather than sample standard deviation. I am using the data on gdp growth for each 3-year period to calculate the standard deviation in those 3 years (i.e. not to infer the standard deviation of growth over a longer time-span). Do you agree that the population standard deviation is indeed the most correct statistic for this case?
Thanks in advance,
Giuseppe
Comment