Quantcast
Channel: Statalist
Viewing all articles
Browse latest Browse all 65055

Calculation of Standard Deviation

$
0
0
Good evening,

I am working on my thesis regarding the capital structure of firms and I am having troubles to create the standard deviation of a variable that i need. I have to calculate the standard deviation for each year and for each firm. Afterwards I have to take an average of 3 years for each firm (e.g Firm 1, I need to obtain the Average Std for year 2005-2008,2006-2009 and so on).

so far i have tried the following command:
sort firm year
egen SD=sd (business risk), by (firm year)

but i received missing variables. Then I tried the following:

sort firm year
egen SD=sd(business risk) if firm[ _n]=firm[ _n-1], by(year)

In this case, I end up having missing variables for the first year in each firm and I also doubt about the results that i receive.

Thank you in advance for your help and for your time.

With kind regards,

Fotis Psipsilis

Viewing all articles
Browse latest Browse all 65055

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>