版權(quán)說明:本文檔由用戶提供并上傳,收益歸屬內(nèi)容提供方,若內(nèi)容存在侵權(quán),請(qǐng)進(jìn)行舉報(bào)或認(rèn)領(lǐng)
文檔簡(jiǎn)介
研究生SAS應(yīng)用講義肖枝洪2/4/20231
StatisticalAnalysisSystem
簡(jiǎn)稱為SAS,可用來分析數(shù)據(jù)和編寫報(bào)告.它是美國SAS研究所的產(chǎn)品,在國際上被譽(yù)為標(biāo)準(zhǔn)軟件,在我國深受醫(yī)學(xué)、農(nóng)林、財(cái)經(jīng)、社會(huì)科學(xué)、行政管理等眾多領(lǐng)域的專業(yè)工作者的好評(píng)。有關(guān)SAS的最新信息,可以查看http://。
SAS采用積木式模塊結(jié)構(gòu),其中的SAS/STAT模塊是目前功能最強(qiáng)的多元統(tǒng)計(jì)分析程序集,可以做回歸分析、聚類分析、判別分析、主成分分析、因子分析、典型相關(guān)分析(下學(xué)期介紹)以及各種試驗(yàn)設(shè)計(jì)的方差分析和協(xié)方差分析。本講義圍繞SAS的應(yīng)用,講述以下六部分內(nèi)容:
(1)SAS應(yīng)用基礎(chǔ);
(2)SAS常用語句;
(3)SAS服務(wù)過程;
(4)描述性統(tǒng)計(jì)程式;
(5)方差分析程式;
(6)回歸分析程式;2/4/20232SAS的顯示管理系統(tǒng)啟動(dòng)計(jì)算機(jī),點(diǎn)擊SAS圖標(biāo)后,即可進(jìn)入SAS的顯示管理系統(tǒng).在View中有四個(gè)主要的窗口(其他的先不考慮):
(1)編輯窗口(programeditor):編輯程式和數(shù)據(jù)文件;(2)日志窗口(log):記錄運(yùn)行情況,顯示error信息;(3)輸出窗口(output):輸出運(yùn)行的結(jié)果;(4)圖形窗口(graph):輸出圖形.點(diǎn)擊View菜單中的Programeditor、Log、Output、Graph命令可以進(jìn)入編輯、日志、輸出及圖形窗口.按功能鍵F5、F6、F7也可以進(jìn)入編輯、日志及輸出窗口.退出SAS有兩種方法:
(1)點(diǎn)擊File菜單中的Exit命令;
(2)點(diǎn)擊窗口右上角的×。2/4/20233概率統(tǒng)計(jì)及SAS應(yīng)用教材中的程序應(yīng)用SAS計(jì)算二項(xiàng)分布的概率,請(qǐng)注意SAS中
probbnml(p,n,k)=P(Xk)=因此,當(dāng)n=5,k=3,p=0.2時(shí),應(yīng)用SAS直接計(jì)算P{X=3}的程序?yàn)椋篸ataprobnml;p=probbnml(0.2,5,3)-probbnml(0.2,5,2);procprint;run;輸出的結(jié)果為:0.0512。2/4/20234當(dāng)n=5,k=4,p=0.8時(shí),應(yīng)用SAS直接計(jì)算P(X=4)+P(x=5)的程序?yàn)椋?/p>
dataex;p=1-probbnml(0.8,5,3);procprint;run;輸出的結(jié)果為:0.73728。應(yīng)用SAS直接計(jì)算例1.3.1中所求概率的P{8≤X≤12}的程序?yàn)椋?/p>
dataex;p=probbnml(0.5,20,12)-probbnml(0.5,20,7);procprint;run;輸出的結(jié)果為:0.7368240356。2/4/20235應(yīng)用SAS中的probnorm(x)近似計(jì)算二項(xiàng)分布的概率時(shí),請(qǐng)注意
probnorm(x)=
因此,應(yīng)用SAS近似計(jì)算P{8≤X≤12}的程序?yàn)椋?/p>
dataex;p=probnorm(1.12)-probnorm(-1.12);procprint;run;輸出的結(jié)果為:0.73729.其中
1.12=(12+0.5-10)/sqrt(5)-1.12=(8-0.5-10)/sqrt(5)2/4/202362.
在SAS中有probnorm(x)函數(shù),用此函數(shù)可以求
P{X≤x}.當(dāng)x=1.645,1.96,2.576時(shí),不查標(biāo)準(zhǔn)正態(tài)分布的分布函數(shù)的函數(shù)值表,應(yīng)用SAS直接計(jì)算P{X≤x}的程序?yàn)閐ataex;dox=1.645,1.96,2.576;(給x依次賦值,增加賦值后可全部列出的函數(shù)值表)p=probnorm(x);putxp;(計(jì)算并輸出x對(duì)應(yīng)的概率)end;run;輸出的結(jié)果如下(在Log窗口中顯示):
1.6450.95001509451.960.97500210492.5760.99500246772/4/20237
用下列程序更好:dataex;inputx@@;p=probnorm(x);list;cards;1.6451.962.576;procprint;run;輸出的結(jié)果如下(在Log窗口中顯示):
1.6450.95001509451.960.97500210492.5760.99500246772/4/20238以下是用SAS程序繪制的二維正態(tài)分布分布密度函數(shù)的示意圖。所用的SAS程序?yàn)椋篸ataex;dox=-3to3by0.25;doy=-3to3by0.25;p=exp(-((x*x+y*y)*5/4+x*y*3/2)/2)/2/3.1416;output;end;end;procg3d;ploty*x=p;run;2/4/202392/4/2023103.應(yīng)用SAS計(jì)算標(biāo)準(zhǔn)正態(tài)分布的分位數(shù)在SAS中有probit(p)函數(shù),用此函數(shù)可以求p分位數(shù).SAS程序?yàn)閐ataex;dop=0.025,0.05,0.1,0.9,0.95,0.975;u=probit(p);putup@;end;run;輸出的結(jié)果如下:
-1.9599639850.025-1.6448536270.05-1.2815515660.11.28155156550.91.6448536270.951.95996398450.9752/4/202311
用下列程序更好:dataex;inputp@@;u=probit(p);list;cards;0.0250.050.975;procprint;run;輸出的結(jié)果如下:
-1.9599639850.025-1.6448536270.05-1.2815515660.11.28155156550.91.6448536270.951.95996398450.9752/4/202312當(dāng)α=0.10,0.05,0.01時(shí),應(yīng)用SAS計(jì)算雙側(cè)分位數(shù)的程序?yàn)椋篸ataex;dox=0.1,0.05,0.01;p=1-x/2;u=probit(p);putxpu;end;run;輸出的結(jié)果如下:
0.10.951.6448536270.050.9751.95996398450.010.9952.57582930352/4/2023134.應(yīng)用SAS計(jì)算卡方分布的分位數(shù)在SAS中有cinv(p,df)函數(shù),用此函數(shù)可以求p分位數(shù).SAS程序?yàn)閐ataex;dodf=4;dop=0.025,0.05,0.1,0.9,0.95,0.975;c=cinv(p,df);putpdfc;end;end;run;輸出的結(jié)果如下:
0.02540.48441855710.0540.71072302140.141.06362321680.947.77944033970.9549.48772903680.975411.1432867822/4/202314用下列程序更好:dataex;inputpdf@@;c=cinv(p,df);list;cards;0.02540.0540.140.940.9540.9754;procprint;run;輸出的結(jié)果如下:
0.02540.48441855710.0540.71072302140.141.06362321680.947.77944033970.9549.48772903680.975411.1432867822/4/2023155.應(yīng)用SAS計(jì)算t分布的分位數(shù)在SAS中有tinv(p,df)函數(shù),用此函數(shù)可以求p分位數(shù).SAS程序?yàn)閐ataex;dodf=4;dop=0.025,0.05,0.1,0.9,0.95,0.975;t=tinv(p,df);putpdft;end;end;run;輸出的結(jié)果如下:
0.0254-2.7764451050.054-2.1318467860.14-1.5332062740.941.53320627410.954297542.77644510522/4/2023166.應(yīng)用SAS計(jì)算F分布的分位數(shù)在SAS中有finv(p,df1,df2)函數(shù),用此函數(shù)可以求p分位數(shù).SAS程序?yàn)閐ataex;dop=0.025,0.05,0.1,0.9,0.95,0.975;dodf1=3;df2=4;f=finv(p,df1,df2);putpdf1df2f;end;end;run;輸出的結(jié)果如下:
0.025340.06622087250.05340.10968301080.13409344.19086043890.95346.59138211640.975349.97919853222/4/202317還可以用下列程序更好:dataex;inputpdf1df2@@;
f=finv(p,df1,df2);list;cards;0.025340.05340.1340.9340.95340.97534;procprint;run;2/4/202318dataprobdist;inputabc@@;probbnml01=probbnml(a,b,c);probchi01=probchi(c,b);probf01=probf(a,b,c);probit01=probit(a);probnorm01=probnorm(a);probt01=probt(a,b);list;cards;0.1
4
3
0.3
5
4
0.4
6
5
0.6
6
4
0.9
8
3;procprint;run;2/4/202319一般計(jì)算data
xzh;a=12+13;b=13-12*2;c=sqrt(19**3);d=18**(1/3);e=log10(1000);g=sin(3);/*f=arcsin(1)lack*/x=12.4221/84.7599;cv=0.20077/2.55;proc
print;
2/4/202320矩陣計(jì)算dataxzhmatrix;prociml;x={12345,24789,37101520,48153020,59202040};
g=inv(x);x2=x*x;e=eigval(x);d=eigvec(x);f=trace(x);h=det(x);J=t(x);printxx2;printdgehf;printJ;run;2/4/202321應(yīng)用SAS畫頻率和累計(jì)頻率直方圖datahist01;inputx@@;cards;4546485151576264;proc
gchart;vbarx/type=pctspace=0;run;2/4/202322datahist01;inputx@@;cards;70729424685790959310964587940118847099132154100773468264887859512310510755457310958101134949462156618477123135401077913172663044141981009078445058607678921016215297815498751181309011513610080699884251799776567343826068160139;proc
gchart;vbar
x/type=cpctspace=0;run;2/4/2023232/4/202324應(yīng)用SAS做樣本觀測(cè)值的描述性統(tǒng)計(jì)分析dataex;inputx@@;cards;4546485151576264;procunivariate;run;輸出的結(jié)果如下:7.211103=sqrt(364/7)Variable=XMomentsN8SumWgts8Mean53Sum424StdDev7.211103Variance52Skewness0.572987Kurtosis-1.2721USS22836CSS364CV13.60585StdMean2.549512/4/202325Quantiles(Def=5)分位數(shù)100%Max6499%6475%Q359.595%6450%Med5190%6425%Q14710%450%Min455%45Q3-Q112.51%45Range19Mode512/4/202326
應(yīng)用SAS作例2.1.2中樣本觀測(cè)值經(jīng)過整理后的描述性統(tǒng)計(jì)的程序?yàn)椋篸ataex;inputxf@@;cards;25650207529100261251115061752;procunivariate;var
x;freq
f;run;2/4/202327應(yīng)用SAS作例2.1.3中樣本觀測(cè)值的描述性統(tǒng)計(jì)的程序:dataxzh;inputxy@@;cards;
1.581809.98289.4225
1.251170.31652.41175
11.01401.851606.041205.9280;proccorr
cov
vaardf=n;run;2/4/202328輸出的結(jié)果如下:CovarianceMatrixDF=10XYX14.685864-207.220000Y-207.2200003453.800000PearsonCorrelationCoefficients
/Prob>|R|underHo:Rho=0/N=10XYX1.00000-0.920100.00.0002Y-0.920101.000000.00020.02/4/2023292.3.8應(yīng)用SAS求置信區(qū)間(1)求一個(gè)正態(tài)總體均值的置信區(qū)間SAS程序?yàn)閐ataex;inputx@@;cards;5.85.5;procmeansmeanstdclm;procmeansmeanstdclmalpha=0.1;run;輸出的結(jié)果如下:MeanStdDevLower95.0%CLMUpper95.0%CLM5.58000.72249574.68290316.4770969MeanStdDevLower90.0%CLMUpper90.0%CLM5.58000.72249574.89117926.26882082/4/202330(2)求兩個(gè)正態(tài)總體均值差的置信區(qū)間SAS程序?yàn)椋篸ataex;doa=1to2;inputn@@;doi=1ton;inputx@@;output;end;end;cards;62.12.352.392.412.442.5642.032.282.582.71;procanova;class
a;modelx=a;meansa/lsd
cldiff;meansa/lsd
cldiffalpha=0.1;run;2/4/202331輸出的結(jié)果如下:Alpha=0.05Confidence=0.95df=8MSE=0.049494CriticalValueofT=2.30600LowerDifferenceUpperConfidenceBetweenConfidenceLimitMeansLimit-0.35615-0.025000.30615Alpha=0.1Confidence=0.9df=8MSE=0.049494CriticalValueofT=1.85955LowerDifferenceUpperConfidenceBetweenConfidenceLimitMeansLimit-0.29204-0.025000.242042/4/202332
應(yīng)用SAS作總體分布參數(shù)的假設(shè)檢驗(yàn)
(1)一個(gè)正態(tài)總體均值作假設(shè)檢驗(yàn)的SAS程序
dataex;inputx@@;y=x-1277;cards;12501265124512601275;procmeansmeanstdtprt;var
y;run;程序運(yùn)行的結(jié)果為:AnalysisVariable:Y
MeanStdDevTProb>|T|-18.200000011.9373364-3.37170890.0280結(jié)果中的Prob>|T|為服從t分布的隨機(jī)變量X的絕對(duì)值>|T|的概率,即P{|X|>|T|}.2/4/202333
(2)兩個(gè)正態(tài)總體均值作假設(shè)檢驗(yàn)的SAS程序
dataxzh;doa=1to2;doi=1to5;inputx@@;output;end;end;cards;800840870920850900880890890840;procttest
cochran;class
a;varx;procprint;run;程序運(yùn)行的結(jié)果為:TTESTPROCEDUREVariable:XANMeanStdDevStdError15856.00000043.9317652719.6468827025880.00000023.4520788010.488088482/4/202334
VariancesTMethod
DFProb>|T|Unequal-1.0770Satterthwaite
6.10.3220
Cochran4.00.3419Equal-1.07768.00.3126ForH0:Variancesareequal,F'=3.51DF=(4,4)Prob>F'=0.2515結(jié)果中的Variances對(duì)應(yīng)兩個(gè)選項(xiàng):如果認(rèn)為方差相等,則DF=8,Prob>|T|為0.3126;如果認(rèn)為方差不相等,則根據(jù)Satterthwaite檢驗(yàn)法或Cochran和Cox檢驗(yàn)法作近似的t檢驗(yàn).兩種檢驗(yàn)法的統(tǒng)計(jì)量都是2/4/202335Satterthwaite檢驗(yàn)法的結(jié)果是DF=6.1,
Prob>|T|為0.3220;其中DF的公式:Cochran和Cox檢驗(yàn)法DF=4.0,Prob>|T|為0.3419;其臨界值2/4/202336(3)配對(duì)樣本均值作假設(shè)檢驗(yàn)的SAS程序dataxzh;inputx1x2@@;d=x1-x2;cards;114941171141551251149811912110295140104919513510611492;procmeanstprt;var
d;proc
print;run;程序運(yùn)行的結(jié)果為:AnalysisVariable:DTProb>|T|3.52032100.00652/4/202337
應(yīng)用SAS作正態(tài)性檢驗(yàn)SAS程序?yàn)閐ataex;inputx@@;cards;711666795106310;procunivariate
normal;run;程序運(yùn)行的結(jié)果為Skewness0.157068Kurtosis-0.58894W:Normal0.932615Pr<W0.3827W檢驗(yàn)的臨界值w0.05=0.859,
P{W<w0.05=0.859}=0.05
SAS結(jié)果表明P{W<0.932615}=0.3827>0.05,因此接受H。.2/4/202338
應(yīng)用SAS作單因素試驗(yàn)方差分析
(1)不等重復(fù)的情形:
dataex;doa=1to3;inputn@@;doi=1ton;inputx@@;Output;end;end;cards;8
212924222530272610202525232931242620216242228252126;procanova;class
a;modelx=a;run;2/4/202339DependentVariable:xSumofSourceDFSquaresMeanSquareFValuePr>FModel26.76666673.38333330.320.7314Error21223.733333310.6539683CorrectedTotal23230.5000000如果要作多重比較并求均值差的置信區(qū)間,則增加meansa/lsd
cldiff;run;2/4/202340(2)等重復(fù)的情形:
dataex;doa=1to3;doi=1to4;inputx@@;output;end;end;cards;212427202018191522252722;procanova;class
a;modelx=a;run;2/4/202341
DependentVariable:xSumofSourceDFSquaresMeanSquareFValuePr>FModel282.666666741.33333336.000.0221Error962.00000006.8888889CorrectedTotal11144.6666667如果要作多重比較并求均值差的置信區(qū)間,則增加meansa/lsd
cldiff;run;2/4/202342應(yīng)用SAS作Levene
的F檢驗(yàn)SAS程序?yàn)椋篸ataex;doa=1to4;doi=1to4;inputx@@;output;end;end;cards;19232113212427202018191522252722;procanova;class
a;modelx=a;meansa/hovtest;run;2/4/202343輸出的結(jié)果為:Levene'sTestforEqualityofXVarianceANOVAofSquaredDeviationsfromGroupMeansSumofMeanSourceDFSquaresSquareFValuePr>FA3268.889.58331.08040.3944Error12995.082.91672/4/202344無重復(fù)試驗(yàn)的雙因素方差分析dataanova01;doa=1to4;dob=1to5;inputx@@;output;end;end;cards;5356455249475047475357635457584552424148;procanova;classab;modelx=ab;meansab/duncanalpha=0.01;run;2/4/202345重復(fù)試驗(yàn)的雙因素方差分析dataex;doa=1to4;dob=1to3;doi=1to2;inputx@@;output;end;end;end;cards;58.252.656.241.265.360.849.142.854.150.551.648.460.158.370.975.871.558.25148.741.4;procanova;classab;modelx=aba*b;meansab/duncan;run;2/4/202346二級(jí)系統(tǒng)分組試驗(yàn)方差分析的SAS程序:dataex;doa=1to3;dob=1to3;doi=1to5;inputx@@;
output;end;end;end;cards;
0.91.01.21.00.91.0
;
procanova;classab;modelx=ab(a);
meansab(a)/duncan;run;2/4/202347
應(yīng)用SAS作一元線性回歸分析dataex;inputxy@@;cards;5.72.4738.33.510.93.912.44.413.14.813.6515.32.;procgplot;ploty*x;/*以y為縱坐標(biāo),以x為橫坐標(biāo)*/symboli=rlv=dot;/*i=rl表示畫回歸直線*//*v=dot表示觀測(cè)值對(duì)應(yīng)的點(diǎn)標(biāo)記為小圓點(diǎn)*/procreg;modely=x/cli;run;/*y=x表示以y為因變量,以x為自變量,*//*cli表示要求預(yù)測(cè)值的95%置信區(qū)間*/2/4/2023482/4/202349輸出的結(jié)果如下:DependentVariable:YAnalysisofVarianceSumofMeanSourceDFSquaresSquare
FValueProb>FModel1112.48368
112.48368
387.5160.0001Error72.031880.29027CTotal8114.51562/4/202350ParameterEstimatesParameterStandardTforH0:VariableDFEstimateErrorParameter=0Prob>|T|INTERCEP10.2569470.532352630.4830.6441X12.9302800.1488552419.6850.0001Dep
VarPredictStdErrLower95%Upper95%ObsYValuePredictPredict
PredictResidual14.80004.65240.3313.15746.14740.147625.70005.53150.2944.07976.98320.168537.00007.28960.2305.90438.6749-0.289648.30009.04780.1887.698710.3969-0.7478510.900010.51290.1819.169211.85660.3871612.400011.68500.19610.329113.04100.7150713.100013.15020.23611.758914.5415-0.0502813.600014.32230.27912.887815.7568-0.7223915.300014.90830.30213.447616.36910.391710.6.11750.2714.69117.5440.2/4/202351
應(yīng)用SAS作一元非線性回歸
(1)線性化后作線性回歸的SAS程序?yàn)?/p>
dataxzh;inputxy@@;x1=1/x;lx=log(x);ly=log(y);Cards;11.8521.3731.0240.7540.5660.4160.3180.2380.17;Procreg;modely=x1;Procreg;modelly=lx;Procreg;modelly=x;Run;2/4/202352(2)計(jì)算剩余平方和的SAS程序?yàn)?/p>
dataxzh01;inputxy@@;x1=1/x;lx=log(x);ly=log(y);
y1=0.1159+1.9291*x1;q1+(y-y1)**2;
y2=exp(0.9638-1.1292*lx);q2+(y-y2)**2;y3=exp(0.9230-0.3221*x);q3+(y-y3)**2;Cards;11.8521.3731.0240.7540.5660.4160.3180.2380.17;procprint;sum;varq1-q3;run;
2/4/202353
TheREGProcedureModel:MODEL1DependentVariable:y
AnalysisofVariance
SumofMeanSourceDFSquaresSquareFValuePr>FModel12.33605
2.3360557.860.0001Error70.282640.04038CTotal82.61869
2/4/202354
ParameterEstimates
ParameterStandardVariableDFEstimateErrortValuePr>|t|
Intercept10.115930.106031.090.3104x111.929150.253627.610.00012/4/202355應(yīng)用SAS作協(xié)方差分析(一)SAS程序?yàn)椋篸ataex;doa=1to3;doi=1to8;inputxy@@;output;end;end;cards;475458665363465149565666546144505254535364675862596261636364666944524858465450615970576458695366;procanova;class
a;modelx=a;procanova;class
a;modely=a;procglm;class
a;modely=xa/solution;lsmeans
a;run;2/4/202356輸出的結(jié)果為:DependentVariable:XSourceDFSumofSquaresMeanSquareFValuePr>FModel2356.08333333178.041666676.340.0070Error21589.7500000028.08333333CTotal23945.83333333DependentVariable:YSourceDF
SumofMean
SquaresSquareFValuePr>FModel260.7500030.375000.770.4767Error21830.875039.5655CTotal23891.62502/4/202357DependentVariable:YSourceDF
SumofMean
SquaresSquareFValuePr>FModel3842.79280.93115.060.0001X1782.045782.045320.310.0001A2222.84111.4245.640.0001Error2048.832.44CTotal23891.625
AYLSMEAN162.0695475255.5124523364.29300022/4/202358應(yīng)用SAS作協(xié)方差分析(二)⑴雙因素試驗(yàn)不考慮交互作用的情形:SAS程序?yàn)閐ataex;doa=1to3;dob=1to5;inputxy@@;output;end;end;cards;82.85104.24123114.94102.88103.14124.572.75125.84104.06123.88103.8692.82104.9492.89;procglm;classab;modely=xab/solution;lsmeansab;run;2/4/202359
SourceDFTypeIIISSMeanSquareFValuePr>Fx10.7810.7816.430.0389a20.6050.3022.490.1526b47.121.78114.660.0016
Error70.8500.1215StandardParameterEstimateErrortValuePr>|t|Intercept1.5250.6952.190.0643x0.1740.06852.540.03892/4/202360⑵雙因素試驗(yàn)考慮交互作用的情形
SAS程序?yàn)?/p>
dataex;doa=1to4;dob=1to2;doi=1to2;inputxy@@;output;end;end;end;cards;14.697.8113.218.8110.113.6100.312.998.518.5119.418.2114.712.899.210.789.618.2112.216.9105.312102.112.4103.816.4117.217.2117.9;procglm;classab;modely=xaba*b/solution;lsmeansab;run;2/4/202361SourceDFTypeIIISSMean
SquareFValuePr>Fx168.7268.7217.950.0039a3241.5880.52821.030.0007b10.2330.2330.060.8124a*b317.0925.6971.490.2986
StandardParameterEstimateErrortValuePr>|t|Intercept65.31912.4065.270.0012x3.1090.7344.240.00392/4/202362⑹協(xié)方差分析的結(jié)論:因素A的效應(yīng)及套在A中的B(A)
矯正后有極顯著的差異.二級(jí)系統(tǒng)分組試驗(yàn)的情形:SAS程序?yàn)閐ataex;doa=1to7;dob=1to3;doi=1to3;inputxy@@;output;end;end;end;cards;15.610516.410415.696…輸入例中的數(shù)據(jù)…14.41431413012.8118;procglm;classab;modely=xab(a)/solution;lsmeansab(a);run;2/4/202363dataex;doa=1to7;dob=1to3;doi=1to3;inputxy@@;output;end;end;end;cards;15.610516.410415.69613.610915.610414.810712.06912.08512.85716.015216.014915.611615.613915.610716.813514.414915.615614.814314.89315.610614.89117.610618.88718.08814.411715.210215.612018.411820.014017.611117.615715.210516.411918.815718.016417.213522.013720.013819.214417.212715.66015.610817.613217.615016.010914.416913.214314.815814.414514.815313.613613.615413.615414.013116.412017.212115.210714.411812.87314.08714.414314.013012.8118;procanova;classab;modely=ab(a);meansab(a)/lsd;procglm;classab;modely=xab(a)/solution;lsmeansab(a);run;2/4/202364SourceDFTypeIIISSMean
SquareFValuePr>Fx12858.7072858.70715.440.0003a624066.384011.06421.67<.0001
b(a)149831.408702.2433.790.0004Error417590.63185.137
StandardParameterEstimateErrortValuePr>|t|Intercept-7.51635.949-0.210.8354x10.0376
2.5543.930.00032/4/202365
應(yīng)用SAS作擬合優(yōu)度檢驗(yàn)SAS程序?yàn)?/p>
dataxzh;inputnnp@@;k+(n-np)**2/np;c=cinv(0.99,5);cards;32.9261411.232229.85250.085952.863134.841514.3444.34
;proc
print;varkc;
run;dataxzh1;x=(3-2.926)**2/2.926+(14-11.23)**2/11.23+(22-29.8)**2/29.8+
(52-50.08)**2/50.08+(59-52.86)**2/52.86
+(31-34.84)**2/34.84
+(15-14.34)**2/14.34
+(4-4.34)**2/4.34;proc
print;run;2/4/202366程序運(yùn)行的結(jié)果為:
Obskc10.0018715.086320.6851215.086332.7267315.086342.8003415.086353.5135415.086363.9367815.086373.9671515.086383.9937915.0863Obs
x13.993792/4/202367應(yīng)用SAS作列聯(lián)表分類標(biāo)志的獨(dú)立性檢驗(yàn)
SAS程序?yàn)?/p>
dataxzh01;doa=1to2;dob=1to2;inputf@@;output;end;end;cards;1585477;procfreq;weightf;tablea*b/chisq;run;2/4/202368
StatisticsforTableofabybStatisticDFValueProbChi-Square14.82210.0281
SampleSize=1812/4/202369應(yīng)用SAS作列聯(lián)表分類標(biāo)志的獨(dú)立性檢驗(yàn)
SAS程序?yàn)?/p>
dataxzh01;doa=1to2;dob=1to3;inputf@@;output;end;end;cards;1263123647739;procfreq;weightf;tablea*b/chisq;run;2/4/202370
StatisticsforTableofabybStatisticDFValueProbChi-Square243.9532<.0001
SampleSize=3602/4/202371
3.用SAS求總體率的置信區(qū)間SAS程序?yàn)镈ataxzh01;k=60;m=40;n=k+m;dop=0.01to0.499by0.0001until(p1>0.025);P1=1-probbnml(p,n,k-1);end;putkmp5.3@14p18.6@;dop=0.5to0.999by0.0001until(p2<0.025);P2=probbnml(p,n,k);end;
put@28kmp5.3@41p28.6;run;輸出的結(jié)果如下:kn-kp1prob60400.4970.025
kn-kp2prob60400.6970.0248762/4/202372根據(jù)二項(xiàng)分布進(jìn)行檢驗(yàn)的SAS程序?yàn)?/p>
dataxzh01;inputkmp0;n=k+m;p1=1-probbnml(p0,n,k-1);p2=probbnml(p0,n,k);list;cards;681320.3;procprint;run;運(yùn)行結(jié)果:Obskmp0np1p21681320.32000.124210.90405P1,p2都大于0.025,故接受H0:p=0.3.2/4/202373
應(yīng)用SAS作符號(hào)檢驗(yàn)方法1:計(jì)算與α進(jìn)行比較.SAS程序?yàn)閐ataex;p=probbnml(0.5,11,1)+1-probbnml(0.5,11,10-1);procprint;run;程序運(yùn)行的結(jié)果為:OBSP10.0117192/4/202374方法2:用UNIVARIATE過程;SAS程序?yàn)?/p>
dataex;inputx1x2@@;y=x1-x2;cards;2829192424222122222525
25262819232425232526292526;procunivariate;var
y;run;程序運(yùn)行的結(jié)果為:Variable=YMomentsM(Sign)-4.5Pr>=|M|0.01172/4/202375應(yīng)用SAS作中位數(shù)檢驗(yàn)SAS程序?yàn)閐ataex;inputx@@;y=x-25;cards;281924212225261924232625;procunivariate;var
y;run;程序運(yùn)行的結(jié)果為:Variable=YMomentsM(Sign)-2Pr>=|M|0.34382/4/202376應(yīng)用SAS作秩和檢驗(yàn)SAS程序?yàn)閐ataex;doa=1to2;inputn@@;doi=1ton;inputx@@;output;end;end;cards;212.612.4612.412.112.512.712.613.1;procnpar1waywilcoxon;class
a;var
x;run;程序運(yùn)行的結(jié)果為:Wilcoxon2-SampleTest(NormalApproximation)(withContinuityCorrectionof.5)S=8.00000Z=-.168687Prob>|Z|=0.8660T-TestApp
溫馨提示
- 1. 本站所有資源如無特殊說明,都需要本地電腦安裝OFFICE2007和PDF閱讀器。圖紙軟件為CAD,CAXA,PROE,UG,SolidWorks等.壓縮文件請(qǐng)下載最新的WinRAR軟件解壓。
- 2. 本站的文檔不包含任何第三方提供的附件圖紙等,如果需要附件,請(qǐng)聯(lián)系上傳者。文件的所有權(quán)益歸上傳用戶所有。
- 3. 本站RAR壓縮包中若帶圖紙,網(wǎng)頁內(nèi)容里面會(huì)有圖紙預(yù)覽,若沒有圖紙預(yù)覽就沒有圖紙。
- 4. 未經(jīng)權(quán)益所有人同意不得將文件中的內(nèi)容挪作商業(yè)或盈利用途。
- 5. 人人文庫網(wǎng)僅提供信息存儲(chǔ)空間,僅對(duì)用戶上傳內(nèi)容的表現(xiàn)方式做保護(hù)處理,對(duì)用戶上傳分享的文檔內(nèi)容本身不做任何修改或編輯,并不能對(duì)任何下載內(nèi)容負(fù)責(zé)。
- 6. 下載文件中如有侵權(quán)或不適當(dāng)內(nèi)容,請(qǐng)與我們聯(lián)系,我們立即糾正。
- 7. 本站不保證下載資源的準(zhǔn)確性、安全性和完整性, 同時(shí)也不承擔(dān)用戶因使用這些下載資源對(duì)自己和他人造成任何形式的傷害或損失。
最新文檔
- 通風(fēng)工程包工合同范例
- 湛江勞務(wù)派遣合同范例
- 裝飾小型合同范例
- 店鋪空房轉(zhuǎn)讓合同范例
- 加氫柴油采購合同范例
- 村里攤位出租合同范例
- 《汽車潤滑油》課件
- 棋牌桌椅定制合同范例
- 杉木購銷合同范例
- 工程貨物采購合同范例
- NB-T35009-2013抽水蓄能電站選點(diǎn)規(guī)劃編制規(guī)范
- 結(jié)構(gòu)設(shè)計(jì)原理練習(xí)題及答案
- 國家開放大學(xué)《心理學(xué)》形考任務(wù)1-4參考答案
- 國標(biāo)《電化學(xué)儲(chǔ)能電站檢修試驗(yàn)規(guī)程》
- 天津市長(zhǎng)期護(hù)理保險(xiǎn)護(hù)理服務(wù)項(xiàng)目和標(biāo)準(zhǔn)
- 2011年1月自考03706思想道德修養(yǎng)與法律基礎(chǔ)試題及答案含解析
- 2024年內(nèi)蒙古巴彥淖爾市交通投資集團(tuán)有限公司招聘筆試參考題庫含答案解析
- 汽車租賃服務(wù)投標(biāo)方案(技術(shù)方案2)
- 委托無人機(jī)服務(wù)協(xié)議
- 2024年中考語文名著閱讀《儒林外史》內(nèi)容簡(jiǎn)介、主要人物形象及相關(guān)練習(xí)
- 借助力學(xué)原理設(shè)計(jì)簡(jiǎn)易杠桿裝置
評(píng)論
0/150
提交評(píng)論