View
217
Download
1
Category
Preview:
Citation preview
19 zhushw@em.tsinghua.edu.cn
itPt
it-1t
, t-k+1t
k(compound returns)multyear returns(horizon):
=
k
(RETURN AGGREGATION)
Sheet1
(Percent returns)
(Continuously compound returns)
Sheet2
Sheet3
Taylor
It
it
()
PV($) D($) r n Par()PV
19.1 (FDATA.A1A0001)(FDATA.ZZCZ)
data a;set fdata.a1a0001;year=year(date);qtr=qtr(date);month=month(date);proc sort data=a;by year qtr month;run;data b;set a;last_y=last.year; /* */last_q=last.qtr; /* */last_m=last.month; /* */by year qtr month;run;
data r_year(keep=date r_pct r_log label="");set b;if last_y=1;r_pct=dif(clpr)/lag(clpr);r_log=log(clpr)-log(lag(clpr));/*log(x)elog2(x)log10(x)*/run;data r_qtr (keep=date r_pct r_log label="");set b;if last_q=1;r_pct=dif(clpr)/lag(clpr);r_log=log(clpr)-log(lag(clpr));run;data r_month (keep=date r_pct r_log label="");set b;if last_m=1;r_pct=dif(clpr)/lag(clpr);r_log=log(clpr)-log(lag(clpr));run;
data a;set fdata.a1a0001;wd=weekday(date);dif=dif(wd);dif2=dif(date);retain index;if (dif=7 thenindex=1;else index=0;data a(keep=date clpr index);set a;date=lag(date);clpr=lag(clpr);if index=1;data r_week(keep=date r_pct r_log);set a;r_pct=dif(clpr)/lag(clpr);r_log=log(clpr)-log(lag(clpr));if r_log=. then delete;run;
19.2 (FDATA.A1A0001)(FDATA.SZCZ)1995~2000
/**/data a1;set r_year;where 1995
/**/data a3(keep=am gm);set a2;c1=col1+1; c2=col2+1;c3=col3+1; c4=col4+1; c5=col5+1;c6=col6+1; gm=(c1*c2*c3*c4*c5*c6)**(1/6)-1;am=mean(of col1-col6);proc print;run;
/**/data a4(keep=am gm);set a2;t=6;array col(6) col1-col6;array c(6) c1-c6;do i=1 to 6;c(i)=col(i)+1;end;wealth=(c1*c2*c3*c4*c5);gm=(( c1*c2*c3*c4*c5*c6)**(1/t))-1; am=mean(of col1-col6); proc print;run;
/**/if _n_=1 then begin=clpr;if lastobs then do;end=clpr;output;end;
data a6(keep=gm);set a6;Gm=(end/begin)**(1/6)-1;proc print;run; /**/
19.3 (600601)1997---2000
data return(keep=date);set fdata.a1a0001;where 1997
if exdt=. then r_2=0;if exdt. Then r_1=0;r_1=r_1+r_2;if r_1=. Then r_1=0;else r_1=r_1;
data return(rename=(r_1=r600601));merge return a;by date;data return;set return;if r600601=. then r600601=0;else r600601= r600601;run;
,
,
,
19.4, P1=8.6data a;mu=0;p1=8.6;sigma=1;do time=-50 to 1000;e=rannor(32585);p=mu+p1+sigma*e;if time>0 then output;p1=p;end;run;/**/proc gplot data=a;symbol1 v=point i=join c=blue;symbol2 v=none i=r ;plot p*time=1 p*time=2/overlay;run;
19.5 , P1=-0.02data a;mu=0;p1=-0.02;sigma=0.5;do time=-50 to 1000;e=rannor(32585);p=mu+p1+sigma*e;if time>0 then output;p1=p;end;run;proc gplot data=a;symbol1 v=point i=join c=blue;symbol2 v=none i=r ;plot p*time=1 p*time=2/overlay;run;
ARIMA0.1.1 19.71000r1=-0.01data a;r1=0.01;e1=rannor(32585);Sigma=-0.8;do time=-50 to 1000;e=rannor(32585);r=r1+sigma*e1+e;if time>0 then output;r1=r;e1=e;end;run;proc gplot data=a;symbol1 v=star i=join c=green;symbol2 v=none i=r ;plot r*time=1 r*time=2/overlay;run;
19.8 Garch(1,1)
data a;v1=0.01;v2=0.01;e1=rannor(32585);h1=0.03;epxl1=h1**0.5*e1;mu1=-0.5;mu2=-0.03;c=0.08;mu3=0.3;mu4=0.3;do time=-50 to 1000;e=rannor(32585);h=c+mu3*epxl1**2+mu4*h1;epxl=h**0.5*e;v=epxl+mu1*v1+mu2*v2;r=v;if time>0 then output;e1=e;epxl1=epxl;v2=v1;v1=v;h1=h;end;run;
proc gplot data=a;symbol1 v=point i=join c=blue;symbol2 v=none i=r;plot r*time=1 r*time=2/overlay;run;
Recommended