Sas 简明教程

SAS - Repeated Measure Analysis

当一个随机样本的所有成员都在许多不同条件下进行测量时,就要使用重复测量分析。由于样本依次受到每个条件,对因变量的测量会重复进行。在这种情况下,使用标准方差分析不合适,因为它无法对重复测量之间的相关性进行建模。

Repeated measure analysis is used when all members of a random sample are measured under a number of different conditions. As the sample is exposed to each condition in turn, the measurement of the dependent variable is repeated. Using a standard ANOVA in this case is not appropriate because it fails to model the correlation between the repeated measures.

你应该明确 repeated measures designsimple multivariate design. 之间的区别。对于这两种,都会多次对样本成员测量(或试验),但在重复测量设计中,每次试验都代表对相同特征在不同条件下的测量。

One should be clear about the difference between a repeated measures design and a simple multivariate design. For both, sample members are measured on several occasions, or trials, but in the repeated measures design, each trial represents the measurement of the same characteristic under a different condition.

PROC GLM 在 SAS 中用来执行重复测量分析。

In SAS PROC GLM is used to carry out repeated measure analysis.

Syntax

PROC GLM 在 SAS 中的基本语法为 −

The basic syntax for PROC GLM in SAS is −

PROC GLM DATA = dataset;
   CLASS variable;
   MODEL variables = group / NOUNI;
   REPEATED TRIAL n;

以下是所用参数的描述 -

Following is the description of the parameters used −

  1. dataset is the name of the dataset.

  2. CLASS gives the variables the variable used as classification variable.

  3. MODEL defines the model to be fit using certain variables form the dataset.

  4. REPEATED defines the number of repeated measures of each group to test the hypothesis.

Example

看下面的例子,其中有两组人经受针对一种药物效果的测试。每次对每个人的反应时间都会记录下来,针对四种经过测试的药物类型。在这里,对每组每个人进行 5 次试验来查看四种药物类型的影响之间的相关性。

Consider the example below in which we have two groups of people subjected to test of effect of a drug. The reaction time of each person is recorded for each of the four drug types tested. Here 5 trials are done for each group of people to see the strength of correlation between the effect of the four drug types.

DATA temp;
   INPUT person group $ r1 r2 r3 r4;
CARDS;
1 A  2  1  6  5
2 A  5  4 11  9
3 A  6 14 12 10
4 A  2  4  5  8
5 A  0  5 10  9
6 B  9 11 16 13
7 B  12 4 13 14
8 B  15 9 13  8
9 B  6  8 12  5
10 B 5  7 11  9
;
RUN;

PROC PRINT DATA = temp ;
RUN;

   PROC GLM DATA = temp;
   CLASS group;
   MODEL r1-r4 = group / NOUNI ;
   REPEATED trial 5;
RUN;

在执行以上代码后,我们将得到以下结果:

When the above code is executed, we get the following result −

repeated measure analysis