程序及结果

整理文档很辛苦,赏杯茶钱您下走!

免费阅读已结束,点击下载阅读编辑剩下 ...

阅读已结束,您可以下载文档离线阅读编辑

资源描述

11.两独立样本inputcx@@;procunivariatenormal;varx;classc;时间资料、百分率资料不服从正态分布T检验(正态)procttest;varx;classc;run;TheTTESTProcedure均数、标准差、标准误T-Tests:Pooled(方差齐,t)Satterthwaite(方差不齐,近似t)EqualityofVariances方差齐性检验非参(非正态)procnpar1waywilcoxon;varx;classc;run;WilcoxonTwo-SampleTestKruskal-WallisTest2.配对样本t检验inputx1x2@@;d=x1-x2;cards;procunivariatedata=ex3_6;vard;run;非参(非正态)单样本中位数与总体中位数inputx1@@;median=45.30;d=x1-median;cards;procunivariatenormal;vard;run;procmeansp50;varx1;run;MomentsBasicStatisticalMeasuresStdDeviation标准偏差TestsforLocation:Mu0=0Student'stt检验SignSignedRank非参(非正态时)Quantiles(Definition5)ExtremeObservations3.方差分析1)完全随机procanova;classc;modelx=c;meansc/lsdsnkdunnett;meansc/hovtestwelch;run;方差齐性检验:Levene'sTestforHomogeneityofxVarianceANOVAofSquaredDeviationsfromGroupMeans若p0.05,齐用F检验若0.05,不齐用Welch'sANOVAforx非参:Kruskal-WallishH检验H0:总体分布位置相同procnpar1waywilcoxon;varx;classc;run;2)随机区组设计H0:μ1=μ2=μ3inputxab@@;cards;procanova;classab;modelx=ab;meansa/snk;run;注意:SS组间=SS处理间+SS区组间非参:FriedmanM检验procfreq;tablesb*a*x/scores=rankcmh2;run;注:区组*处理*指标3)两阶段交叉H0:μ1=μ2inputrtimetreat$x@@;cards;procanova;classrtimetreat;modelx=rtimetreat;meansrtimetreat/snk;2run;4)析因设计方差分析2×2析因dataf22;inputabx@@;cards;000.80000.90000.70101.30101.20101.10010.90011.10011.00112.10112.20112.00;procprint;procanova;classab;modelx=aba*b;meansaba*b;run;H0:A因素效应=0,B因素效应=0A*B因素效应=0a:F=168.75p.001拒绝Hb:F=90.75p0.001拒绝Ha*b:F=36p=0.0003拒绝Ho:.甲有效,乙有效,甲乙有交互作用,甲乙都用时血红细胞增加数最多。3×3析因设计dataex11_2;inputxab@@;cards;procanova;classab;modelx=aba*b;meansaba*b/snk;run;5*2*2析因设计procanova;classabcx@@;modelx=abca*ba*cb*ca*b*c;run;snk中只有5和4只对一个字母说明5.4差异大,1.2.3介于之问5)正交实验设计有空白列,无重复dataex11_4;inputababcn1n2dx@@;cards;111111186111222295122112291122221194212121291212212196221122183221211288;procprint;procanova;classabcd;modelx=abca*bd;meansabcda*b;run;结果误差是由空白列造成的,一级分解中p0.05不用看只有Ca*b的p0.05,看F值,F越大作用越大,c为主ab为次因x越大越好,看x的mean值选择较大者,所以a2b1c2d2最优无空白列,有重复dataex1_2;inputabcdx@@;cards;111112221333212322312312313232133321;procanova;classabcd;modelx=abcd;meansabcd;run;有空白列,有重复dataex1_2;3inputababcacbcnx@@;cards;……procprint;procanova;classabc;modelx=abca*ba*cb*c;meansabca*ba*cb*c;run;4.卡方检验inputrcf@@;cards;procfreq;weightf;tablesr*c/chisqexpected;run;H0:π1=π2H1:π1π2,P右侧H1:π1π2,P左侧Frequency频数Expected期望值Percent百分比RowPct行百分比ColPct列百分比Chi-Square卡方LikelihoodRatioChi-Square似然比卡方ContinuityAdj.Chi-Square连续校正卡方Mantel-HaenszelChi-SquarePhiCoefficientContingencyCoefficient列联系数Cramer'sVn≥40,且所有T≥5,用Chi-Square1≤T5,用ContinuityAdj.Chi-Squaren40,或T1用Fisher'sExactTestχ2、χc2计算的P值与α很接近,改用Fisher's2)配对四格表H0:b=cH1:b≠cprocfreq;weightf;tablesr*c/agree;run;McNemar'sTestStatistic(S)PrS一致性检验kappa值为0-0.4差0.4-0.75一般0.75-1好b+c≥40,用Chi-Squareb+c40,用ContinuityAdj.Chi-SquareH1:π1π2,P左侧R*C列表资料procfreq;tablesr*c/chisqcmhexactnopercentnocolnorowexpected;weightf;run;结果:Cochran-Mantel-HaenszelStatisticsNonzeroCorrelation双向有序RowMeanScoresDiffer列有序GeneralAssociation双向无序分层χ2inputhospitaltrteffectf;cards;procfreqorder=data;tableshospital*trt*effect/cmhnopercentnocol;weightf;run;非参数检验回归与相关相关:procunivariatenormal;varxy;x、y正态:proccorr;varxy;非正态:proccorrspearman;varxy;run;回归:procplot;ploty*x;procreg;modely=x;ploty*x;run;多元线性回归procreg;modely=x1-x4/stb;/*标准化处理*/run;procreg;modely=x1x2x3x4/selection=stepwisesle=0.10sls=0.15;run;/*逐步回归*/4proccorrnosimple;varx1x2x3x4y;run;proccorrnosimple;varx1y;/*除去x2x3x4,x1与y的偏相关*/partialx2x3x4;run;线性回归模型的诊断多重共线性:procregdata=p122;modely=x1-x5/tolvifcollin;run;tolerance,varianceinflationEigenvalue特征根Proporationofvariztion异方差性:H0:ρ=0P≤0.05存在异方差性procregdata=p144;modely=x/pr;plotr.*p.;/*studentresidual2或cook’SD0.05为极端点*/ploty*x;outputout=ap=ypr=yr;dataa;seta;abse=abs(yr);/*取绝对值*/proccorrspearman;varxabse;/*P0.05存在异方差性*/procprintdata=a;datap144;setp144;logy=log10(y);procregdata=p144;modellogy=x;plotlogy*x;procprintdata=p144;run;序列自相关procregdata=p158;modely=x/dw;plotr.*obs.;run;Durbin-WatsonD小结:1如果有共线性删除与y偏相关系数最小的删vif,vp值最大的2异方差性删极端点studentresidual2或cook’SD0.05为极端点对y做变换3序列自相关:做差商4残差非正态:对y做变换曲线拟合procnlin;parmsa=4b=0.03;modely=exp(a+b*x);run;变换yinputxy;y2=log(y);procreg;modely2=x;ploty2*x;run;--------------------procnlin;parmsa=0b=0;modely=a+b*log10(x);run;变换xinputxy;x2=log10(x);cards;procgplot;ploty*x;procreg;modely=x2;ploty*x2;run;-----------------procnlin;parmsa=0b=0c=0;modely=a*x*x+b*x+c;run;变换xinputxy;x2=x*x;cards;procreg;modely=xx2;run;逻辑回归inputyxwt@@;procprint;5proclogisticdescending;freqwt;modely=x/rsqcl;outputout=ap=yp;procprintdata=a;run;H0:β=0P(y=1)=αβαβOR值:OddsRatioEstimatesX每增加一个单位OR值得变化多元逻辑回归inputx1-x8y@@;proclogisticdecending;modely=x1-x8/stbselection=stepwisesle=0.1sls=0.15;run;P(y=1)=αββαββ去掉其他x后xi的OR值。多分类无序inputyblackwhiteotherwt@@;cards;procprint;proclogisticdescending;freqwt;modely=blackother/rsqcl;proclogisticdescending;freqwt;modely=blackwhite/rsqcl;proclogisticdescending;freqwt;modely=blackwhiteother/noint;run;聚类分析样品聚类dataclus2q;inputc$n0x1-x7;cards;procclustermethod=wardnosquarestandard;varx1-x7;idc;proctree;run;离差平方和法average类平均法median中间距离法centroid重心法指标聚类procvarclusdata=ex19_3

1 / 6
下载文档,编辑使用

©2015-2020 m.777doc.com 三七文档.

备案号:鲁ICP备2024069028号-1 客服联系 QQ:2149211541

×
保存成功