All commands
# |
content
|
3 [+]
|
use
crspsubset
, clear
All properties
key |
content |
command |
use |
indent |
0 |
options |
clear |
parameters |
crspsubset |
|
4 [+]
|
label
def ind 1 Kappa 2 Lambda 3 Nu 4 Xi 5 Tau 6 Upsilon 7 Phi 8 Chi 9 Psi
|
5 [+]
|
g
hiord=real(substr(string(permno),1,1))
|
6 [+]
|
bys cdate hiord:
egen
retport = mean(ret)
|
7 [+]
|
separate
retport
, by(hiord)
All properties
key |
content |
command |
separate |
indent |
0 |
options |
by(hiord) |
parameters |
retport |
|
8 [+]
|
forv
i=1/9 {
All properties
key |
content |
command |
forv |
indent |
0 |
parameters |
i=1/9 { |
|
9 [+]
|
bys cdate:
egen
index`i' = mean(retport`i')
|
10 [+]
|
}
All properties
key |
content |
command |
} |
indent |
0 |
parameters |
|
|
11 [+]
|
drop
retport*
All properties
key |
content |
command |
drop |
indent |
0 |
parameters |
retport* |
|
12 [+]
|
save
ch14.3
, replace
All properties
key |
content |
command |
save |
indent |
0 |
options |
replace |
parameters |
ch14.3 |
|
14 [+]
|
type
maxindcorr.ado
All properties
key |
content |
command |
type |
indent |
0 |
parameters |
maxindcorr.ado |
|
51 [+]
|
do
indcorr.mata
All properties
key |
content |
command |
do |
indent |
0 |
parameters |
indcorr.mata |
|
53 [+]
|
type
indcorr.mata
All properties
key |
content |
command |
type |
indent |
0 |
parameters |
indcorr.mata |
|
|
|
58 [+]
|
mata
-
mata:
void function indcorr(string scalar ind,
string scalar vn,
string scalar newvar)
{
st_view(ind, ., ind)
st_view(eye, ., tokens(vn))
info = panelsetup(ind, 1)
nf = rows(info)
nv = cols(eye)
nv1 = nv-1
maxc = newvar + "max"
st_view(highcorr, 1::nf, maxc)
mu = newvar + "mu"
st_view(muret, 1::nf, mu)
enn = newvar + "n"
st_view(enn, 1::nf, enn)
// compute correlations between index columns and last column (ret)
for(i = 1; i <= nf; i++) {
sigma = correlation(panelsubmatrix(eye, i, info))
ret = sigma[nv, 1::nv1]
maxindex(ret, 1, imax, w)
highcorr[i] = imax
// calculate mean return and number of quotes for this panel
z = panelsubmatrix(eye[.,nv], i, info)
muret[i] = mean(z)
enn[i] = rows(z)
}
}
end
All properties
key |
content |
command |
mata |
comment |
block (30 lines) |
|
91 [+]
|
use
ch14.3
, clear
All properties
key |
content |
command |
use |
indent |
0 |
options |
clear |
parameters |
ch14.3 |
|
92 [+]
|
maxindcorr
index1-index9
, ret(ret) firm(permno) gen(set1)
|
93 [+]
|
summarize
set1*
All properties
key |
content |
command |
summarize |
indent |
0 |
parameters |
set1* |
|
94 [+]
|
gsort
-set1mu
All properties
key |
content |
command |
gsort |
indent |
0 |
parameters |
-set1mu |
|
95 [+]
|
label
def ind 1 Kappa 2 Lambda 3 Nu 4 Xi 5 Tau 6 Upsilon 7 Phi 8 Chi 9 Psi
|
96 [+]
|
label
values set1max ind
|
97 [+]
|
list
set1permno set1mu set1n set1max
in 1/50
, noobs sep(0)
|