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
Margins after anovaI am requesting marginal means after running anova on StataSE 14, and am wondering why I am getting …
Heteroscedasticity test for large panel dataset using XSMLEDoes XSMLE package have any command to check the Heteroscedasticity for large panel data set? My mat…
Import file with .file file extensionHello, I am trying to import data with a .file file extension and can't seem to figure out how. If …
StandarizationHello everyone. I have this dataset that looks like this. I want to create a variable that standariz…
Extracting matrix rownames for svy mean with multiple groupsHi everyone! I’m trying to estimate the difference in blood pressure between hypertensive and non-h…
Subscribe to:
Post Comments (Atom)
0 Response to Drop before calculating a mean
Post a Comment