Sas 简明教程
SAS - One Way Anova
ANOVA 表示方差分析。在 SAS 中,它通过使用 PROC ANOVA 完成。它分析来自各种实验设计的的数据。在此过程中,会测量在通过分类变量(也即自变量)识别的实验条件下的连续响应变量(也即因变量)。响应中的变异被认为归因于分类中的效应,随机误差解释了剩余的变异。
ANOVA stands for Analysis of Variance. In SAS it is done using PROC ANOVA. It performs analysis of data from a wide variety of experimental designs. In this process, a continuous response variable, known as a dependent variable, is measured under experimental conditions identified by classification variables, known as independent variables. The variation in the response is assumed to be due to effects in the classification, with random error accounting for the remaining variation.
Syntax
在 SAS 中,用于 PROC ANOVA 的基本语法如下:
The basic syntax for applying PROC ANOVA in SAS is −
PROC ANOVA dataset ;
CLASS Variable;
MODEL Variable1 = variable2 ;
MEANS ;
以下是所用参数的描述 -
Following is the description of the parameters used −
-
dataset is the name of the dataset.
-
CLASS gives the variables the variable used as classification variable.
-
MODEL defines the model to be fit using certain variables from the dataset.
-
Variable_1 and Variable_2 are the variable names of the dataset used in analysis.
-
MEANS defines the type of computation and comparison of means.
Applying ANOVA
现在我们了解一下在 SAS 中应用 ANOVA 的概念。
Let us now understand the concept of applying ANOVA in SAS.
Example
我们考虑数据集 SASHELP.CARS。在这里,我们研究汽车类型和它们马力之间的关系。由于汽车类型是具有分类值的变量,我们将其作为分类变量并使用这两个变量进行建模。
Lets consider the dataset SASHELP.CARS. Here we study the dependence between the variables car type and their horsepower. As the car type is a variable with categorical values, we take it as class variable and use both these variables in the MODEL.
PROC ANOVA DATA = SASHELPS.CARS;
CLASS type;
MODEL horsepower = type;
RUN;
在执行以上代码后,我们将得到以下结果:
When the above code is executed, we get the following result −
Applying ANOVA with MEANS
现在我们了解一下在 SAS 中用 MEANS 应用 ANOVA 的概念。
Let us now understand the concept of applying ANOVA with MEANS in SAS.
Example
我们还可以通过应用 MEANS 语句来扩展模型,在该语句中我们使用 Turkey 的学生化方法来比较不同汽车类型的均值。汽车类型的分类与每种分类中马力的均值以及某些其他值(如均方误差等)一起列出。
We can also extend the model by applying the MEANS statement in which we use Turkey’s Studentized method to compare the mean values of various car types.The category of car types are listed with the mean value of horsepower in each category along with some additional values like error mean square etc.
PROC ANOVA DATA = SASHELPS.CARS;
CLASS type;
MODEL horsepower = type;
MEANS type / tukey lines;
RUN;
在执行以上代码后,我们将得到以下结果:
When the above code is executed, we get the following result −