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

Estimate mean in panel data, how many clusters

$
0
0
Dear all,

I have a panel-dataset from 2000-2010 with round about 10000 firms. Each firm has an Identifier (ID).
I want to measure the average SD for a variable (Profit) within industries. Each industry is defined by the first number of the SIC-Code (SIC1).
The data is xtset, Cluster-variable=ID, t=1 year and the data is in long-format.
The problem is not really to measure the average SD and the number of nonmissing observations, but to get the number of clusters (firms).
I did my calculation in two steps:
First: SD for Profit by firm:
.egen SD_Profit=sd(Profit) if Profit!=., by(ID)
In the second step, I calculate the weighted mean (automatically by the number of Profit observations). I tried several strategies. For example:
.tempfile indSD
.statsby obs=e(N) meanSD=_b[SD_Profit], by(SIC1): mean
.save indSD,replace
The pdf-documenation tells me, the the mean-command stores the number of cluster in a scalar, but I guess it belongs to the standardization of the mean….
I want to know how many firms are involved in the calculation…

Thanks for your help!!

Viewing all articles
Browse latest Browse all 72772

Trending Articles



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