统计模型检验

       今天阅读了一篇名为《Estimation of Statistical Models in SAS》的文档,文如其名,该文对不同的统计模型检验进行了概括,其中包括普通最小二乘回归(OLS)、分位数回归(QR)、稳固回归(RR)、嵌套对数模型(NLM)、泊松及负二项模型(PANBM)、非参和半参数估计(NASE)、偏最小二乘(PLS)、联立方程(SOSE)、似无关回归(SUR)、Tobit回归和截断正态模型(TMATNM)、Duration Models、有序概率模型(OPM)、时间序列、面板数据、多水平模型等(MLM)。各模型估计检验的语法如下:

 

/* OLS */
ods graphics on;
proc reg data=YG;
model Y = X1 X2 X3 /adjrsq aic dwprob white collin vif;
run;

/* QR */
proc quantreg data=YG plots=all ci=sparsity;
model Y = X1 X2 X3 / quantile=0.25 0.5 0.75 plot=quantplot ;
run;

/* RR */
proc robustreg data=YG fwls method=m;
model Y = X1 X2 X3;
run;

/* NLM */
proc mdc data=	YG;
model Y = X1 X2 X3 X4 X5/ type= nlogit
                          choice=(choice) covest=qml;
id id;
utility u(1,1 2) = X1 X2 X3,
        u(1,3 4) = X4 X5;
nest level(1) = (1 2 @ 1, 3 4 @ 2),
     level(2) = (1 2 @ 1);
run;

/* PANBM */
proc genmod data = YG;
model Y = X1 X2 X3 / d = nb;
run;
*Zero-inflated negative binomial ;
proc countreg data = YG;
model Y = X1 X2 X3 / d = zinb ;
zeromodel Y ~ X4 X5;
run;

/* NASE */
proc gam data = Y plots=components(clm commonaxes);
model injfreq = spline(laneadt) spline2(gradebr,curves) spline(minrad) param(
pcttruck curvmile) / dist = poisson;
output out=mlogp predicted=p;
run;

/* PLS */
proc pls data = mlog method=pls cv=block cvtest missing=em plots=all;
class route;
model injfreq = lnaadt curvmile accyr medwidth friction speed1 full slight
                lowpre/solution; 
run;

/* SOSE */
proc syslin data = table53 3sls;
endogenous var1 var2 var3;
instruments var4 var5 var6 winter spring ampeak pmpeak truck20R truck20C var7
var8 var9 var11 trucksR trucksC trucksL;
model var1 = var2 truck20R winter ampeak trucksR;
model var2 = var1 var3 pmpeak trucksC;
model var3 = var2 var6;
run;

/* SUR */
proc syslin data = class07 sur;
model mo70 = var27 late fast120;
model mo65 = male var27 late fast120;
model mo55 = late brisk fast120;
run;

/* TMATNM */
proc qlim data = tob337;
model var83 = var6 var12 var16 var18 ramp var39 rumblstr var47 var50;
endogenous var83 ~ censored(lb=0);
run;

/* Duration Models */
proc lifetest plots=(s,ls,lls) data = toby;
time var3;
run;

/* OPM */
proc qlim data=pavement;
model xx4 = var9 var17 var27 var28 / discrete(dist=normal);
run;

/*时间序列*/
proc arima data = travel ;
identify var = leg_length scan;
run;
quit;
*and;
proc arima data = travel plots=all;
identify var = leg_length;
estimate p = 2 q = 2 nostable;
run;
quit;
*and;
proc autoreg data=travel plots=all;
model leg_length = / noint dist=t garch=(q=(1),p=(1 2 3)) archtest;
hetero altitude;
run;

/*面板数据*/
proc panel plots data=Cbypass2;
id County tt;
model ltotempr = popsl m_llpld bnum bcbd z123 z4 z5 z6 z7
                / bp2 rantwo dasilva parks rho m=20 vcomp=nl hccme=1;
run;

/* MLM */
proc glimmix noitprint empirical or plots = pearsonpanel ic = q data=BYPASS2;
class ZCTA tt;
model lmfgestr = Marion Logansport Huntington
hlthestr religestr lconestr tpestr
z1 z7 z8/ s dist = n ddfm=betwithin;
random int / subject = ZCTA type = un;
random _residual_ / subject = ZCTA type=ante(1);
*random x y / subject = ZCTA type = rsmooth knotmethod=kdtree(knottype=center
knotinfo treeinfo);
ods graphics;
run


 

 

你可能感兴趣的:(统计模型检验)