- 阅读权限
- 255
- 威望
- 0 级
- 论坛币
- 2979 个
- 通用积分
- 6.6000
- 学术水平
- 0 点
- 热心指数
- 0 点
- 信用等级
- 0 点
- 经验
- 4270 点
- 帖子
- 128
- 精华
- 0
- 在线时间
- 591 小时
- 注册时间
- 2009-3-17
- 最后登录
- 2024-10-13
已卖:1份资源
讲师
还不是VIP/贵宾
- 威望
- 0 级
- 论坛币
 - 2979 个
- 通用积分
- 6.6000
- 学术水平
- 0 点
- 热心指数
- 0 点
- 信用等级
- 0 点
- 经验
- 4270 点
- 帖子
- 128
- 精华
- 0
- 在线时间
- 591 小时
- 注册时间
- 2009-3-17
- 最后登录
- 2024-10-13
 | 开心 2015-6-4 19:07:51 |
|---|
签到天数: 1 天 连续签到: 1 天 [LV.1]初来乍到
|
500论坛币
|
- %macro regby(dset=,byvar=,yvar=,xvars=,minobs=0,print_est=yes,print_r2=yes,indformat=);
- %if &indformat ne
- %then %let prntfmt = format &indformat indfmt.;
- %else %let prntfmt = ;
-
- proc sort data=&dset out=xdset;
- by &byvar;
- run;
- ods listing close;
- ods output ParameterEstimates = xpe(drop=DF Dependent Model);
- ods output FitStatistics = xr2;
- ods output ANOVA = xanova;
- proc reg data=xdset;
- by &byvar;
- model &yvar = &xvars;
- run;
- ods output close;
- ods listing;
- data xpeprint;
- set xpe;
- where substr(Variable,1,3) not in ('Int', 'dy_', 'di_');
- run;
- proc sort data=xpeprint;
- by Variable &byvar;
- run;
-
- %if &print_est = 'yes' %then %do;
- proc print data=xpeprint;
- &prntfmt;
- run;
- %end;
- data xanova;
- set xanova;
- where Source = 'Corrected Total';
- nobs = DF + 1;
- keep &byvar nobs;
- run;
- data xpe (drop = &byvar nobs);
- merge xanova xpe (drop = Probt StdErr);
- by &byvar;
- if nobs ge &minobs;
- z1temp = tValue / sqrt((nobs-1)/(nobs-3));
- run;
- proc sort data=xpe;
- by Variable;
- run;
- proc means data=xpe(keep = Variable z1temp) noprint;
- by Variable;
- output out=xmeans1(drop=_:) sum=;
- run;
- proc means data=xpe noprint;
- by Variable;
- var Estimate tValue;
- output out=xmeans2(drop=_type_ rename=(_freq_=n))
- mean =meanEst meant
- median =medianEst mediant
- stddev =stdEst stdt;
- run;
- data xpe;
- set xpe (rename = (Estimate = estPos tValue = tSigPos));
- tSigNeg = tSigPos;
- if estPos < 0.00 then estPos = .;
- if tSigPos < 1.65 then tSigPos = .;
- if tSigNeg > -1.65 then tSigNeg = .;
- drop z1temp;
- run;
- proc means data=xpe noprint;
- by Variable;
- output out=xmeans3 n=;
- run;
- data xr2;
- set xr2(rename=(nValue2=adjr2));
- where Label2 = 'Adj R-Sq';
- keep &byvar adjr2;
- run;
- data xother;
- merge xanova xr2;
- by &byvar;
- run;
- %if &print_r2 = 'yes' %then %do;
- proc print data=xother;
- &prntfmt;
- run;
- %end;
- proc means data=xother noprint;
- var nobs adjr2;
- output out=xmeans4(drop=_:) mean=;
- run;
- proc transpose data=xmeans4 out=xmeans4(rename=(_name_=Variable COL1=meanEst));
- run;
- data xout;
- merge xmeans1 xmeans2 xmeans3;
- by Variable;
- run;
- data xout;
- set xout xmeans4;
- fmt = meanEst * sqrt(n-1) / stdEst;
- z1 = z1temp / sqrt(n);
- z2 = meant * sqrt(n-1) / stdt;
- estNeg = n - estPos;
- run;
- proc print data=xout noobs round;
- var Variable n meanEst medianEst estPos estNeg meant mediant tSigPos tSigNeg fmt z1 z2;
- run;
- %mend;
复制代码
我在网上找了一个Fama-MacBeth回归的程序,请问Fama-MacBeth t值(fmt)的置信区间要怎么求? |
|