統計軟件SAS簡介及程序范例課件_第1頁
統計軟件SAS簡介及程序范例課件_第2頁
統計軟件SAS簡介及程序范例課件_第3頁
統計軟件SAS簡介及程序范例課件_第4頁
統計軟件SAS簡介及程序范例課件_第5頁
已閱讀5頁,還剩79頁未讀 繼續免費閱讀

下載本文檔

版權說明:本文檔由用戶提供并上傳,收益歸屬內容提供方,若內容存在侵權,請進行舉報或認領

文檔簡介

統計軟件SAS簡介及程序范例1SAS簡介《試驗統計方法》教材例題的SAS程序及運行結果1.

SAS簡介2SAS(StatisticalAnalysisSystem,統計分析系統)是當今國際上著名的數據分析軟件系統,其基本部分是SAS/BASE軟件。20世紀60年代末期,由美國北卡羅納州州立大學

(

North

Carolina

StateUniversity)的A.

J.

Barr和J.

H.

Goodnight兩位教授開始開發,

1975

年創建了美國

SAS

研Institute Inc.)。之后,推出的SAS系統,始終以領先的技術和可靠的支持著稱于世,通過不斷發展和完善,目前已成為大型集成應用軟件系統。SAS系統具有統計分析方法豐富、信息儲存簡單、語言編程能力強、能對數據連續處理、使用簡單等特點。SAS是一個出色的統計分析系統,它匯集了大量的統計分析方法,從簡單的描述統計到復雜的多變量分析,編制了大量的使用簡便的統計分析過程。3SAS系統運行的幾個重要前提條件4(一)SAS系統運行時要同時打開的文件較多,因此在微型計算機的系統配置文件CONFIG.SYS中應指定FILES=50或以上;(二)

SAS

系統軟件有時間租期限制,因此只有機器時間(DATE)在軟件有效期內才能運行。時間租期取決于SAS出售版本日期,即所謂的SAS誕生日(BIRTHDAY)。(三)SAS系統應全部安裝到硬盤的SAS子目錄下,硬盤應至少有10M空間。SAS

for

Windows的啟動與退出5(一)啟動SAS

for

Windows的啟動,按如下步驟進行。開機后,直接用鼠標雙擊桌面上SAS系統的快捷鍵圖標,自動顯示主畫

面,即可進入SAS系統。(二)退出 當用完SASforWindows,需要退出時,可以單擊【File】,選擇【Exit】,或者,單擊×(關閉)按鈕,立即顯示。如果確認需要退出SAS

for

Windows,單擊確定按鈕;如果需要繼續使用SAS

forWindows,單擊取消按鈕。62.

《試驗統計方法》教材例題的SAS程序及運行結果7t測驗方差分析直線回歸分析協方差分析t檢驗8樣本平均數與總體平均數的差異顯著性檢驗配對試驗資料的t檢驗非配對試驗資料的t檢驗樣本平均數與總體平均數的差異顯著性檢驗(例4.3)data

testt1;input

x@@;differ=x-27.5;cards;32.528.628.424.729.127.229.833.329.7;proc

means

n

meanstderr

t

prt;run;9運行結果The

MEANS

ProcedureVariable

N

Mean10StdErrort

ValuePr

>

|t|x

9

29.2555556

0.8623468

33.93

<.0001differ

9

1.7555556

0.8623468

2.04

0.0762配對試驗資料的t檢驗(例4.7)data

testt2;input

treat

x1

x2@@;differ=x1-x2;cards;12722.2 951.422866.71417.032675.91275.342169.22228.552253.92462.662415.12715.4;proc

means

mean

stderr

t

prt;var

differ;run;11運行結果The

MEANS

ProcedureAnalysis

Variable

:

differ12Mean Std

Error t

Value675.4666667

391.5253952

1.73Pr

>

|t|0.1451非配對試驗資料的t檢驗(例4.5)data

testt3;input

variety

x@@;cards;118.68120.67118.42118.00117.44115.95218.68223.22221.42219.00218.92;procttest;class

variety;var

x;run;13運行結果The

TTEST

ProcedureT-Tests14VariableMethodVariancesDFt

ValuePr

>

|t|xPooledEqual9-1.920.0868xSatterthwaiteUnequal7.51-1.870.1001Equality

ofVariancesVariablexMethodFolded

FNum

DF Den

DF F

Value4

5

1.66Pr

>

F0.5880方差分析15單因素完全隨機化試驗重復數相等資料單因素完全隨機化試驗重復數不等資料兩因素交叉分組試驗單獨觀測值資料兩因素交叉分組試驗有重復觀測值資料次級樣本含量相等的二因素系統分組資料單因素隨機區組設計試驗資料拉丁方設計試驗結果兩因素隨機區組設計試驗資料兩因素裂區設計試驗資料單因素完全隨機化試驗重復數相等資料的方差分析(教材【例5.3】)data

anova1;input

variety

x@@;cards;1121101141161121182 8210212214212216314316313316310315416418420416414416;procanova;class

variety;model

x=variety;means

variety/duncan;run;16運行結果17The

ANOVA

ProcedureClass

Level

InformationClass

Levels

Valuesvariety 4

1234Number

ofobservations

24The

ANOVA

ProcedureDependent

Variable:

xSourceDFSum

ofSquaresMean

SquareF

ValuePr

>

FModel367.166666722.38888893.430.0369Error20130.66666676.5333333Corrected

Total23197.8333333R-SquareCoeff

VarRoot

MSExMean0.33951118.149392.55603914.08333SourcevarietyDF Anova

SS3

67.16666667Mean

Square F

Value Pr

>

F22.38888889

3.43

0.036918The

ANOVA

ProcedureDuncan's

Multiple

Range

Test

for

xNOTE:

This

test

controls

the

Type

Icomparisonwiseerror

rate,

not

the

experimentwise

errorrate.Alpha

0.05Error

Degrees

of

Freedom

20Error

MeanSquare

6.53333319Number

ofMeans234Critical

Range3.0783.2313.328Means

with

the

same

letter

are

not

significantly

different.20Duncan

Grouping

Mean

N

varietyAA16.66764BA14.00063BABA13.66761BB12.00062單因素完全隨機化試驗重復數不等資料的方差分析(教材【例5.4】)data

anova2;input

variety

x@@;cards;121.5119.5120.0122.0118.0120.0216.0218.5217.0215.5220.0216.0319.0317.5320.0318.0317.0421.0418.5419.0420.0515.5518.0517.0516.0;proc

glm;class

variety;model

x=variety;means

variety/duncan;run;21運行結果22The

GLMProcedureClass

Level

InformationClass

Levels

Valuesvariety 5

12345Number

ofobservations

25The

GLMProcedureDependent

Variable:

xSource

DFSum

ofSquaresMean

SquareF

ValuePr

>

FModel

446.4983333311.624583335.990.0025Error

2038.841666671.94208333Corrected

Total

2485.34000000R-SquareCoeff

VarRoot

MSExMean0.5448607.5656161.39358718.42000SourceDFType

ISSMean

SquareF

ValuePr

>

Fvariety446.4983333311.624583335.990.0025SourceDFType

IIISSMean

SquareF

ValuePr

>

Fvariety446.4983333311.624583335.990.002523The

GLMProcedureDuncan's

Multiple

Range

Test

for

xNOTE:

This

test

controls

the

Type

I

comparisonwise

error

rate,

notthe

experimentwise

error

rate.Alpha

0.0524Error

Degrees

of

Freedom20Error

MeanSquare

1.942083Harmonic

Mean

of

Cell

Sizes

4.83871NOTE:

Cell

sizes

are

not

equal.Number

ofMeans2345Critical

Range1.8691.9622.0212.062Means

with

the

same

letter

are

not

significantly

different.Duncan

Grouping

Mean

N

variety25AA20.166761A19.625044ABA18.300053BB17.166762BB16.625045兩因素交叉分組試驗單獨觀測值資料的方差分析(教材【例5.5】)data

anova3;input

field

method

x@@;cards;117112731377219022902392315932703380417542804382516552605367618262866385;procanova;class

field

method;model

x=field

method;means

fieldmethod/duncan;run;26運行結果The

ANOVA

ProcedureClass

Level

InformationClass

Levels

Valuesfield

6 123456method

3 123Number

ofobservations

1827The

ANOVA

ProcedureDependent

Variable:

x28SourceSum

ofDF

Squares Mean

Square F

ValuePr

>

FModel71576.555556225.22222213.970.0002Error10161.22222216.122222Corrected

Total171737.777778R-SquareCoeff

VarRoot

MSExMean0.9072255.2221444.01524976.88889SourceDFAnovaSSMean

SquareF

ValuePr

>

Ffield51435.111111287.02222217.800.0001method2141.44444470.7222224.390.0429The

ANOVA

ProcedureDuncan's

Multiple

Range

Test

for

xNOTE:

This

test

controls

the

Type

I

comparisonwise

errorrate,not

the

experimentwise

errorrate.Alpha

0.05Error

Degrees

of

Freedom

10Error

MeanSquare

16.1222229Number

ofMeansCritical

Range2

3

4

5

67.305

7.633

7.827

7.951

8.033Means

with

the

same

letter

are

not

significantly

different.30Duncan

Grouping

Mean

N

fieldAA90.66732BA84.33336BBC79.00034CDC73.66731DDE69.66733EE64.00035The

ANOVA

ProcedureDuncan's

Multiple

Range

Test

for

xNOTE:

This

test

controls

the

Type

I

comparisonwise

errorrate,

not

the

experimentwise

errorrate.Alpha

0.05Error

Degrees

of

Freedom

10Error

MeanSquare

16.1222231Number

ofMeansCritical

Range2

35.165

5.398Means

with

the

same

letter

are

not

significantly

different.32Duncan

Grouping

Mean

N

methodAA80.50063BA76.50062BB73.66761兩因素交叉分組試驗有重復觀測值資料的方差分析(教材【例5.6】)data

anova4;input

density

fert

x@@;cards;112712261331143015251129122513301430152511261224133014311526112612291331143015242130222823312432252821302227233124342529212822262330243325282129222523322432252731333233333534353530313332343333343435293134323433373433353131323235333534353530;procanova;class

density

fert;model

x=density

fert

density*fert;means

densityfert/duncan;means

density*fert/lsd;run;33運行結果34The

ANOVA

ProcedureClass

Level

InformationClass

Levels

Valuesdensity 3

123fert 5

12345Number

of

observations

60The

ANOVA

Procedure35Dependent

Variable:

xSourceDFSum

ofSquaresMean

SquareF

ValuePr

>

FModel14573.333333340.952381033.51<.0001Error4555.00000001.2222222Corrected

Total59628.3333333R-SquareCoeff

VarRoot

MSExMean0.9124673.6647791.10554230.16667SourceDFAnovaSSMean

SquareF

ValuePr

>

Fdensity2315.8333333157.9166667129.20<.0001fert4207.166666751.791666742.38<.0001density*fert850.33333336.29166675.150.0001The

ANOVA

ProcedureDuncan's

Multiple

Range

Test

for

xNOTE:

This

test

controls

the

Type

Icomparisonwiseerror

rate,

not

the

experimentwise

errorrate.Alpha

0.05Error

Degrees

of

Freedom

45Error

MeanSquare

1.22222236Number

ofMeans23Critical

Range.7041.7405Means

with

the

same

letter

are

not

significantly

different.37Duncan

GroupingMeanNdensityA33.2500203B29.5000202C27.7500201The

ANOVA

ProcedureDuncan's

Multiple

Range

Test

for

xNOTE:

This

test

controls

the

Type

Icomparisonwiseerror

rate,

not

the

experimentwise

errorrate.Alpha

0.05Error

Degrees

of

Freedom

45Error

MeanSquare

1.22222238Number

ofMeans2345Critical

Range0.9090.9560.9871.009Means

with

the

same

letter

are

not

significantly

different.39Duncan

GroupingMeanNfertA32.4167124AA32.1667123B29.7500121C28.8333122The

ANOVA

ProcedureLevel

of Level

of--------------x--------------densityfertNMeanStd

Dev11427.00000001.4142135612426.00000002.1602469013430.50000000.5773502714430.25000000.5000000015425.00000000.8164965821429.25000000.9574271122426.50000001.2909944523431.00000000.8164965824432.75000000.9574271125428.00000000.8164965831433.00000000.8164965832434.00000000.8164965833435.00000001.6329931634434.25000000.9574271135430.00000000.8164965480次級樣本含量相等的二因素系統分組資料的方差分析【例5.7】data

anova5;input

plant

leaf

x@@;cards;1112.11112.11212.81212.82114.42114.42214.72214.53123.13123.43228.13228.8;procanova;class

plant

leaf;model

x=plant

leaf(plant);means

plant/duncan;run;41運行結果42The

ANOVA

ProcedureClass

Level

InformationClass

Levels

Valuesplant

3 123leaf

2 12Number

ofobservations

12The

ANOVA

ProcedureDependent

Variable:

x43SourceDFSum

ofSquaresMean

SquareF

ValuePr

>

FModel5444.350000088.87000001720.06<.0001Error60.31000000.0516667Corrected

Total11444.6600000R-SquareCoeff

VarRoot

MSExMean0.9993031.2914940.22730317.60000SourceDFAnovaSSMean

SquareF

ValuePr

>

Fplant2416.7800000208.39000004033.35<.0001leaf(plant)327.57000009.1900000177.87<.0001The

ANOVA

ProcedureDuncan's

Multiple

Range

Test

for

xNOTE:

This

test

controls

the

Type

I

comparisonwise

error

rate,

notthe

experimentwise

error

rate.Alpha

0.05Error

Degrees

of

Freedom

6Error

MeanSquare

0.05166744Number

ofMeansCritical

Range2

3.3933

.4076Means

with

the

same

letter

are

not

significantly

different.45Duncan

GroupingMeanNplantA25.850043B14.500042C12.450041單因素隨機區組設計試驗資料的分析(教材【例10.1】)data

anova6;input

variety$

block

x@@;cards;A

115.3B

118.0C

116.6D

116.4E

113.7F

117.0D

217.3F

217.6E

213.6C

217.8A

214.9B

217.6C

317.6A

316.2F

318.2B

318.6D

317.3E

313.9B

418.3D

417.8A

416.2E

414.0F

417.5C

417.8;proc

glm;class

variety

block;model

x=variety

block;means

variety/duncan;run;46運行結果The

GLMProcedureClass

Level

InformationClass

Levels

Valuesvariety

6 A

B

C

D

E

Fblock

4 1234Number

ofobservations

2447The

GLMProcedureDependent

Variable:

xSum

ofSource

DFSquaresMean

SquareF

ValuePr

>

FModel

855.058333336.8822916751.75<.0001Error

151.995000000.13300000Corrected

Total

2357.05333333R-SquareCoeff

VarRoot

MSExMean0.9650332.1925350.36469216.63333SourceDFType

ISSMean

SquareF

ValuePr

>

Fvariety552.3783333310.4756666778.76<.0001block32.680000000.893333336.720.004483The

GLMProcedureDuncan's

Multiple

Range

Test

for

xNOTE:

This

test

controls

the

Type

I

comparisonwise

errorrate,not

the

experimentwise

errorrate.Alpha

0.05Error

Degrees

of

Freedom

15Error

MeanSquare

0.13349Number

ofMeans

2Critical

range

.54963

4

5

6.5762

.5927

.6039

.6120Means

with

the

same

letter

are

not

significantly

different.50Duncan

GroupingMeanNvarietyA18.12504BB17.57504FBB17.45004CBB17.20004DC15.65004AD13.80004E拉丁方設計試驗結果的分析(教材【例10.3】)data

anova7;input

nd$row

col

x@@;cards;C

1110.1A

12 7.9B

13 9.8

E

14 7.1

D

15

9.6A

21 7.0D

2210.0E

23 7.0

C

24 9.7

B

25

9.1E

31 7.6C

32 9.7D

3310.0B

34 9.3

A

35

6.8D

4110.5B

42 9.6C

43 9.8

A

44 6.6

E

45

7.9B

51 8.9

E

52 8.9

A

53 8.6D

5410.6C

5510.1;proc

glm;class

nd

row

col;model

x=nd

row

col;means

nd/duncan;run;51運行結果The

GLMProcedureClass

Level

InformationClass

Levels

Valuesnd 5

A

B

C

D

Erow

5 12345col

5 12345Number

ofobservations

2552The

GLMProcedureDependent

Variable:

xSum

ofSource

DF

Squares Mean

Square F

Value Pr

>

FModel1235.503200002.9586000010.88

0.0001Error123.263200000.27193333Corrected

Total2438.76640000R-SquareCoeff

VarRoot

MSExMean0.9158245.8671500.5214728.888000Source

DF Type

ISS Mean

Square F

Value Pr

>

Fnd432.206400008.0516000029.61<.0001row42.170400000.542600002.000.1594col41.126400000.281600001.040.4286

53The

GLMProcedureDuncan's

Multiple

Range

Test

for

xNOTE:

This

test

controls

the

Type

I

comparisonwise

error

rate,

notthe

experimentwise

error

rate.Alpha

0.05Error

Degrees

of

Freedom

12Error

MeanSquare

0.27193354Number

ofMeans2345Critical

Range.7186.7522.7725.7860Means

with

the

same

letter

are

not

significantly

different.55Duncan

GroupingMeanNndA10.14005DAB

A9.88005CBB9.34005BC7.70005ECC7.38005A兩因素隨機區組設計試驗資料的方差分析(【例10.5】)data

anova7;input

a

b

blockx@@;cards;32110.012111.021119.041117.022120.011112.031119.042111.022219.011213.041216.012210.0322 8.021216.0422 9.031218.041315.0323 7.021312.031316.011313.012313.022317.0423

8.0;proc

glm;class

a

b

block;model

x=a

b

block

a*b;means

a

b

a*b/duncan;run;56運行結果The

GLMProcedureClass

Level

InformationClass

Levels

Valuesa41234b212block3123Number

ofobservations

2457The

GLMProcedureDependent

Variable:

xSource

DFSum

ofSquaresMean

SquareF

ValuePr

>

FModel

9332.625000036.958333317.06<.0001Error

1430.33333332.1666667Corrected

Total

23362.9583333R-SquareCoeff

VarRoot

MSExMean0.91642810.737701.47196013.70833SourceDFType

ISSMean

SquareF

ValuePr

>

Fa398.791666732.930555615.200.0001b177.041666777.041666735.56<.0001block220.333333310.16666674.690.0276a*b3

136.4583333

45.4861111

20.99

<.0508

01The

GLMProcedureDuncan's

Multiple

Range

Test

for

xNOTE:

This

test

controls

the

Type

Icomparisonwiseerror

rate,

not

the

experimentwise

errorrate.Alpha

0.05Error

Degrees

of

Freedom

14Error

MeanSquare

2.166667Number

ofMeans234Critical

Range1.8231.9101.96459Means

with

the

same

letter

are

not

significantly

different.60Duncan

GroupingMeanNaA17.166762B13.000063BB12.666764BB12.000061The

GLMProcedureDuncan's

Multiple

Range

Test

for

xNOTE:

This

test

controls

the

Type

Icomparisonwiseerror

rate,

not

the

experimentwise

errorrate.Alpha

0.05Error

Degrees

of

Freedom

14Error

MeanSquare

2.166667Number

ofMeans

2Critical

Range

1.28961Means

with

the

same

letter

are

not

significantly

different.62Duncan

GroupingMeanNbA15.5000121B11.9167122The

GLMProcedure63Level

ofabLevel

ofN--------------x--------------Mean Std

Dev11312.66666670.5773502712311.33333331.5275252321315.66666673.5118845822318.66666671.5275252331317.66666671.527525233238.33333331.5275252341316.00000001.000000004239.33333331.52752523兩因素裂區設計試驗資料方差分析(教材【例10.6】)data

anova8;input

a

b

blockx@@;cards;11139.811238.511339.112143.312243.512346.513155.913269.713363.814152.614257.514357.721127.521227.121326.822144.822248.822347.623148.723244.523348.624141.724237.224336.531126.531225.831326.332135.432234.532336.333142.033244.333343.634139.134239.634344.3;proc

glm;class

a

b

block;model

x=block

a

a*block

b

a*b;means

a

b

a*b/duncan;64run;運行結果The

GLMProcedureClass

Level

InformationClass

Levels

Valuesa3123b41234block3123Number

ofobservations

3665The

GLMProcedureDependent

Variable:

xSum

ofSource

DFSquaresMean

SquareF

ValuePr

>

FModel

173765.737222221.51395433.39<.0001Error

18119.4150006.634167Corrected

Total

353885.152222R-SquareCoeff

VarRoot

MSExMean0.9692646.0787172.57568842.37222SourceDFType

ISSMean

SquareF

ValuePr

>

Fblock217.1372228.5686111.290.2991a21309.723889654.86194498.71<.0001a*block440.50111110.1252781.530.2368b31975.956667658.65222299.28<.0001a*b6422.41833370.40305610.61<66.0001The

GLMProcedureDuncan's

Multiple

Range

Test

for

xNOTE:

This

test

controls

the

Type

Icomparisonwiseerror

rate,

not

the

experimentwise

errorrate.Alpha

0.05Error

Degrees

of

Freedom

18Error

MeanSquare

6.63416767Number

ofMeans23Critical

Range2.2092.318Means

with

the

same

letter

are

not

significantly

different.68Duncan

GroupingMeanNaA50.658121B39.983122C36.475123The

GLMProcedureDuncan's

Multiple

Range

Test

for

xNOTE:

This

test

controls

the

Type

Icomparisonwiseerror

rate,

not

the

experimentwise

errorrate.Alpha

0.05Error

Degrees

of

Freedom

18Error

MeanSquare

6.63416769Number

ofMeans234Critical

Range2.5512.6762.756Means

with

the

same

letter

are

not

significantly

different.70Duncan

GroupingMeanNbA51.23393B45.13394C42.30092D30.82291The

GLMProcedure71Level

ofaLevel

ofbN--------------x--------------Mean Std

Dev11339.13333330.6506407112344.43333331.7925772913363.13333336.9241124614355.93333332.8884828821327.13333330.3511884622347.06666672.0526405823347.26666672.3965252624338.46666672.8219378731326.20000000.3605551332335.40000000.9000000033343.30000001.1789826134341.00000002.86879766直線回歸分析(教材【例7.1】)data

reg1;input

xy@@;cards;35.51234.11631.7940.3236.8740.2331.71339.2944.2-1;proc

reg

corr;model

y=x;run;72運行結果73The

REGProcedureCorrelationVariablexyx1.0000-0.8371y-0.83711.0000The

REGProcedure74Model:

MODEL1Dependent

Variable:

yAnalysis

ofVarianceSourceDFSum

ofSquaresMeanSquareF

ValuePr

>

FModel1174.88878174.8887816.400.0049Error774.6667810.66668Corrected

Total8249.55556Root

MSE3.26599R-Square0.7008Dependent

Mean7.77778AdjR-Sq0.6581Coeff

Var41.99128Parameter

Estimates75VariableParameter

StandardDF

Estimate

Error t

Value Pr

>

|t|Interceptx1

48.54932

10.12779

4.791 -1.09962

0.27157 -4.050.00200.0049協方差分析(教材【例9.3】)data

anaocov1;input

treat

x

y@@;cards;13689 1308012674123801268513068 12073119681208011658228642278122773224672257722367220642186521759220573285533362326583225832366320553226032371318553174843252423584276442362427544285442055424444195141751;proc

glm;class

treat;model

y=x

treat/solution;means

treat/duncan;lsmeans

treat/stderr

pdiff

tdiff;run;76運行結果77The

GLMProcedureClass

Level

InformationClass

Levels

Valuestreat 4

1234Number

ofobserv

溫馨提示

  • 1. 本站所有資源如無特殊說明,都需要本地電腦安裝OFFICE2007和PDF閱讀器。圖紙軟件為CAD,CAXA,PROE,UG,SolidWorks等.壓縮文件請下載最新的WinRAR軟件解壓。
  • 2. 本站的文檔不包含任何第三方提供的附件圖紙等,如果需要附件,請聯系上傳者。文件的所有權益歸上傳用戶所有。
  • 3. 本站RAR壓縮包中若帶圖紙,網頁內容里面會有圖紙預覽,若沒有圖紙預覽就沒有圖紙。
  • 4. 未經權益所有人同意不得將文件中的內容挪作商業或盈利用途。
  • 5. 人人文庫網僅提供信息存儲空間,僅對用戶上傳內容的表現方式做保護處理,對用戶上傳分享的文檔內容本身不做任何修改或編輯,并不能對任何下載內容負責。
  • 6. 下載文件中如有侵權或不適當內容,請與我們聯系,我們立即糾正。
  • 7. 本站不保證下載資源的準確性、安全性和完整性, 同時也不承擔用戶因使用這些下載資源對自己和他人造成任何形式的傷害或損失。

評論

0/150

提交評論