This variable is at daily frequency for each firm. Thus, the firm identifier makes the panel variable and the date makes the time variable. Since these categories only look at the right tail of the distribution, most of the values in the data are "0".
I want to transform this variable into a continuous variable using the conditional means of the truncated normal distribution. How is this supposed to be done in Stata? I am using Stata 12.1. The variable in Stata looks like as follows. The firm identifier is "permno", "date" is the time variable while "inst_atten" is the ordinal variable that I want to transform.
Code:
* Example generated by -dataex-. To install: ssc install dataex clear input double permno int date float inst_atten 10026 18263 0 10026 18266 0 10026 18267 1 10026 18268 0 10026 18269 0 10026 18270 0 10026 18273 0 10026 18274 2 10026 18275 0 10026 18276 0 10026 18277 3 10026 18280 4 10026 18281 0 10026 18282 0 10026 18283 0 10026 18284 0 10026 18287 0 10026 18288 0 10026 18289 1 10026 18290 1 10026 18291 0 10026 18294 0 10026 18295 0 10026 18296 0 10026 18297 0 10026 18298 0 10026 18301 0 10026 18302 0 10026 18303 0 end format %tdnn/dd/CCYY date
0 Response to Transforming Ordinal Variable to Continuous Variable
Post a Comment