Hi, I’m really new to Stata so I don’t know anything. Forgive me beforehand for giving unclear information or asking stupid questions.
I finally was able to create a good dataset (I think). For 194 months I have the Monthly return, the Size and other variables of 557 equity funds. Now I want to do a regression for every month so that I will get 194 coefficients for every variable and want to get to mean of every variable.
I posted a photo of my data. (I used a reshape long command for my excel files to get it like this, normally it was in a wide form) Fonds mean Fund, R stands for Return of a fund, logS is the logarithm of the Size of the fund, logF is the logarithm of the Size of the Family fund, A is the age of the fund, E is the monthly expense ratio and H is the number of holdings the fund has in a certain month.
A friend of mine who is a bit familiar with stata said I should make a do-file with this code :
tempfile Regression1
local j=1
while `j' <=194 {
quietly {
preserve
noisily di in green "Jan" _continue
reg R logS logF A E H
matrix M = e(M)
svmat M, name(Coeff_)
collapse (mean) Coeff*
if `j' > 1 {
append using `Regression1'
}
save `Regression1', replace
restore
local j = `j'+1
}
}
But if i do this i get all identical regressions. Can anyone help here?
I finally was able to create a good dataset (I think). For 194 months I have the Monthly return, the Size and other variables of 557 equity funds. Now I want to do a regression for every month so that I will get 194 coefficients for every variable and want to get to mean of every variable.
I posted a photo of my data. (I used a reshape long command for my excel files to get it like this, normally it was in a wide form) Fonds mean Fund, R stands for Return of a fund, logS is the logarithm of the Size of the fund, logF is the logarithm of the Size of the Family fund, A is the age of the fund, E is the monthly expense ratio and H is the number of holdings the fund has in a certain month.
A friend of mine who is a bit familiar with stata said I should make a do-file with this code :
tempfile Regression1
local j=1
while `j' <=194 {
quietly {
preserve
noisily di in green "Jan" _continue
reg R logS logF A E H
matrix M = e(M)
svmat M, name(Coeff_)
collapse (mean) Coeff*
if `j' > 1 {
append using `Regression1'
}
save `Regression1', replace
restore
local j = `j'+1
}
}
But if i do this i get all identical regressions. Can anyone help here?
Comment