Hi All
I am a beginner with Stata and am working with analyst data downloaded from IBES. I am using Stata to compute the dispersion of forecasts made by analysts over a certain period. The formula that I need to calculate is as follows:
Std Dev of earnings forecasts issued by individual analysts in year t/ Stock price of year t-1
I have used the following Stata code to do the above computation:
gen fyear=year(fpedats)
gen fmonth=month(fpedats)
gen year_actual=year(anndats_act)
gen month_actual=month(anndats_act)
sort ticker fyear analys fpedats
gen date=anndats_act-anndats
sort ticker fyear analys fpedats date
by ticker fyear analys fpedats: gen n=_n
keep if n==1 (deleting multiple forecasts from one analyst in a year)
sort ticker fyear (fpedats)
by ticker fyear: gen analyst_num=_N
sort ticker fyear (fpedats)
by ticker fyear: egen std_forecast_full=sd(value)
With the above code, I hope to compute the 1st part of my formula, that is std dev of forecasts issued by individual analysts. However, the mean of this final column (std_forecast_full) is very high like 1234.56 etc. I think this is not right.
Can someone please point what is wrong with above code? Can someone also tell what would be the code to divide this column with stock price from last year?
Thank you so much for the help! Please let me know shall further information be required.
Related Posts with Analyst Forecast Dispersion
Moderation Analysis, omitted variables due to collinearityHello, I am trying to do a moderation analysis for a regression analysis which worked out perfectly …
how to combine two graphs into one?Hello, I would like to combine the below two graphs into one. The first one shows observed data, and…
Error using -xtdpdml- package: T value is too smallI am creating a cross-lagged panel data model using the user-contributed package -xtdpdml-. My model…
MergeI try to merge a file in cross-sectional format containing a certain variable with a master file whi…
Esttab / Estout / Outreg Drop All CoefficientsIs there a way to drop all coefficients from a regression and just report R-Squared and number of ob…
Subscribe to:
Post Comments (Atom)
0 Response to Analyst Forecast Dispersion
Post a Comment