Hey guys ! If I have a dummy with 1 and zero wether a trade is a buy or sell and want to find out what the average return per fund of the buys is (so one value over all funds), do have to drop the sells before or after I calculate then mean of every individual fund? (It is a buy if the dummy buy has a value of 1)
So is it:
drop if buy!=1
bysort FundID: egen average_per_fund = mean(fund_mothly_return)
egen tagvar = tag(FundID)
egen mean_fund_return_alldates = mean(average_per_fund) if tagvar
or
bysort FundID: egen average_per_fund = mean(fund_mothly_return)
drop if buy !=1
egen tagvar = tag(FundID)
egen mean_fund_return_alldates = mean(average_per_fund) if tagvar
Thanks.
Related Posts with Drop before calculating a mean
Test for trend using mi postestimationHi all, I'm attempting to test for a trend in age category and other ordinal variables on my depend…
reghdfeHello, I have Stata 15.1 installed and today reghdfe stopped working and gives me the following erro…
Storing Cumulative Risk ValuesCode Code: use https://data.princeton.edu/pop509/justices2.dta, clear stset tenure, fail(event == 1…
How to address two idenpendent random intercepts into melogit?I formulate a equation as y=a0+aX+vi+ut The latter two term are random intercepts. How to code it in…
Lags for Newey West Standard Errors in fmbHi, I am using the command fmb in order to estimate Fama-Macbeth regressions for my unbalanced pane…
Subscribe to:
Post Comments (Atom)
0 Response to Drop before calculating a mean
Post a Comment