Hello everyone, i am working on a mothly panel data of 36 banks from 2011-2019. My data look sth like this
1. I want to draw a line graph for some of my variables over time (e.g Loan_ratio) shown the average value of Loan_ratio for all the banks that have RD_ratio (retail deposits to assets) above the median and another line graph for banks with RD_ratio below the median. I assume i have to use the preserve and collapse commands but i dont know how to make this only for those specific bank subgroups.
2. I want to run a regression only on the subgroup of banks with RD_ratio > median and maybe on a subperiod from 2011-2017. Is the correct way to do that this:
? Where Loan_ratio_lagged is the lagged value of the variable and NIRP is a dummy with 0 for the period before 2015 and 1 afterwards. Thank you in advance.
Code:
* Example generated by -dataex-. To install: ssc install dataex clear input byte bankid float months long(month total_assets) float(NIRP assets_lagged Loan_ratio RD_ratio EL_ratio) 6 21762 201908 18967 1 18751 .7217748 .8713028 .002530711 6 21793 201909 19006 1 18967 .7266304 .8660949 .002420288 6 21823 201910 19241 1 19006 .7492897 .8650798 .0022348112 6 21854 201911 19404 1 19241 .7601995 .8693053 .0023191094 6 21884 201912 19254 1 19404 .7626263 .8672484 .003272047 7 18628 201101 12242 0 19254 .4247429 .9005882 0 7 18659 201102 12145 0 12242 .6738278 .9258131 0 7 18687 201103 12206 0 12145 .6738576 .9454367 0 7 18718 201104 12323 0 12206 .67262 .9424653 0 7 18748 201105 12341 0 12323 .6674511 .9431164 0 7 18779 201106 12409 0 12341 .6614537 .9466516 0 end format %d months
1. I want to draw a line graph for some of my variables over time (e.g Loan_ratio) shown the average value of Loan_ratio for all the banks that have RD_ratio (retail deposits to assets) above the median and another line graph for banks with RD_ratio below the median. I assume i have to use the preserve and collapse commands but i dont know how to make this only for those specific bank subgroups.
2. I want to run a regression only on the subgroup of banks with RD_ratio > median and maybe on a subperiod from 2011-2017. Is the correct way to do that this:
Code:
egen median = median(RD_ratio) xtreg Loan_ratio Loan_ratio_lagged c.EL_ratio_lagged#NIRP i.month if RD_ratio > median & month > (date), fe robust
Comment