Dear Forum,
I have been trying to bootstrap some fund alphas derived from a Fama-French linear regression of the following form:
Ri = αi + siRmt + biSMBt + hiHMLt + εi
This is in order to determine whether the performance of fund managers given by alpha is due to luck or skills.
For simplicity, I have around 13 funds for which I'd like to bootstrap the alphas for (see attached .csv file) and I have already used the following code (obtained from this website) to generate the bootstrapped alpha values of only one out of the 13 funds (name of the fund: ie00b65ng183):
program bs_resid
version 13.1
syntax, RESidual(varname numeric) MATrix(name)
* get the varlist for -regress-
local xvars : colna `matrix'
local CONS _cons
local xvars : list xvars - CONS
* compute the linear prediction
tempvar xb idx y
matrix score double `xb' = `matrix'
* idx randomly selects the observations with replacement
gen long `idx' = ceil(_N*runiform())
* the new dependent variable using resample residuals
gen double `y' = `xb' + `residual'[`idx']
regress `y' `xvars', vce(robust)
end
regress ie00b65ng183 mktrf smb hml , vce(robust)
matrix b = e(b)
* zero intercept
local icons = colnumb(b, "_cons")
matrix b[1,`icons'] = 0
predict double resid, residuals
simulate _b _se, reps(1000) : bs_resid, res(resid) mat(b)
histogram _b_cons, frequency normal
summ _b_cons
However, I would ideally like to automate this process in order to bootstrap the alpha coefficient of all 13 funds in the .csv file but saving the bootstrapped values of all previous funds into a file... Is there a way to automate the program above to obtain bootsrapped data for all funds in the list? I'm new to Stata so your help would be greatly appreciated. Thanks
I have been trying to bootstrap some fund alphas derived from a Fama-French linear regression of the following form:
Ri = αi + siRmt + biSMBt + hiHMLt + εi
This is in order to determine whether the performance of fund managers given by alpha is due to luck or skills.
For simplicity, I have around 13 funds for which I'd like to bootstrap the alphas for (see attached .csv file) and I have already used the following code (obtained from this website) to generate the bootstrapped alpha values of only one out of the 13 funds (name of the fund: ie00b65ng183):
program bs_resid
version 13.1
syntax, RESidual(varname numeric) MATrix(name)
* get the varlist for -regress-
local xvars : colna `matrix'
local CONS _cons
local xvars : list xvars - CONS
* compute the linear prediction
tempvar xb idx y
matrix score double `xb' = `matrix'
* idx randomly selects the observations with replacement
gen long `idx' = ceil(_N*runiform())
* the new dependent variable using resample residuals
gen double `y' = `xb' + `residual'[`idx']
regress `y' `xvars', vce(robust)
end
regress ie00b65ng183 mktrf smb hml , vce(robust)
matrix b = e(b)
* zero intercept
local icons = colnumb(b, "_cons")
matrix b[1,`icons'] = 0
predict double resid, residuals
simulate _b _se, reps(1000) : bs_resid, res(resid) mat(b)
histogram _b_cons, frequency normal
summ _b_cons
However, I would ideally like to automate this process in order to bootstrap the alpha coefficient of all 13 funds in the .csv file but saving the bootstrapped values of all previous funds into a file... Is there a way to automate the program above to obtain bootsrapped data for all funds in the list? I'm new to Stata so your help would be greatly appreciated. Thanks
Comment