重复测量 - GLM

重复测量是多水平模型的一种。

Repeated measures refer to multiple measurements taken from the same experimental unit, such as serial evaluations over time on the same patient。

对一个试验单元进行多次测量,就是重复测量。例如在不同时间对同一个病人进行测量,这种情况下收集的数据叫做‘longitudinal’ data纵向数据。

或者说某个反应变量测量了多次。这个多次就是重复。例如res在VISIT 1 3 5各测一次,或者在Period A测一次,Period  B测一次。

说白了就是within-subject factors在所有个体中都是相同的。个体是最基本的研究对象,是在个体基础上搜集数据,展开研究。

 

Mix: can accommodate missing data and a rich palette of assumptions regarding the covariance structure

1.  为啥不用多因素方差分析?

因为多因素方差分析要求obervation independent. 也就是观测独立。

2. Notice that the response might vary among groups, among patients within groups, and among the different measurement times. Therefore, you include a Group effect, a Patient (within Group) effect, and a Time effect as sources of variation in the ANOVA. In addition, the repeated measures analysis using a univariate approach includes the Group-by-Time interaction。

不同影响因素的response不同,所以需要考虑这些因素。

However, because of the correlation of measurements over time from the same patient, a Patient effect must be included as a source of variation in the ANOVA table。

因为同一patient,不同时间测量之间具有相关性,所以需要patient effect.

3. In addition, the univariate ANOVA requires that each pair of repeated measures has the same correlation, a feature known as ‘compound symmetry’.

假设each pair of repeated measures中相关性相同。

4. A significant interaction between the Group and Time effects means that changes in response over time differ among groups.

GROUP-BY-TIME的意思: 随时间推移,response在不同group之间变化量/改变量/增量不同(图3和图4),也就是变化不一致。

 

 

 这张图说白了:Time和Drug都对Response有影响,但不能用多因素方差分析,因为观测间不独立,是对同一个人不同时间点的测量,所以需要把Time 和 patient(group)的方差给分解出来。

5. 方差分解

 

FG的意思: 不同group之间是否显著不同,相当于所有VISIT被取了均值。

FT的意思:合并group后,不同VISIT之间是否不同。

FGT意思:随时间推移,response在不同group之间不同。

 

 6. 计算公式:

Patient(group): 用每个patient的均值减去group均值,*所在cell的观测数(也就是重复测量次数),的平方和。这就是组内误差

Group: 每个group的均值减去总均值,*所在cell的观测数,的平方和,

Time:每个timepoint均值减去总均值,*所在cell的观测数,的平方和,

group-by-time: 每个group每个timepoint的均值减去总均值,*所在cell的观测数,的平方和 ,减去 group 减去 time,说明group 单位效应随着时间发生了变化。

总:每个测量值减去总均值的平方和

 

上述公式是组间误差除以组内误差,此时组内误差是MS patient(gruop)。

Time 和 GROUP-by-Time是对应的MS除以残差。

 

data arthr;
 input vacgrp $ pat mo1 mo2 mo3 ;
 datalines;
ACT 101 6 3 0
ACT 103 7 3 1
ACT 104 4 1 2
ACT 107 8 4 3
PBO 102 6 5 5
PBO 105 9 4 6
PBO 106 5 3 4
PBO 108 6 2 3
; 

data discom; set arthr;
 keep vacgrp pat visit score;
 score = mo1; visit = 1; output;
 score = mo2; visit = 2; output;
 score = mo3; visit = 3; output;
run;
ods html;

proc print data = discom; 
 var vacgrp pat visit score;
 title1 'Repeated-Measures ANOVA';
 title2 'Example 8.1: Arthritic Discomfort Following Vaccine';
run;
 
proc glm data = discom;
*类别变量必须写在CLASS语句中;
 class vacgrp pat visit; 
 model score = vacgrp pat(vacgrp) visit vacgrp*visit/ss3;
 *虽然指定成了随机效应,但仍然是按照固定效应算的,参照计算公式;
 random pat(vacgrp);
 *指定假设和误差, 否则SAS自动把Error当作分母;
 test h=vacgrp e=pat(vacgrp); 
 quit;
run;

  

 

 

第一部分是变量和值水平

第二部分是模型整体有没有意义,和残差

第三部分:

vacgrp在此处无意义,因为是重复测量,需要考虑visit,但这没考虑。

pat(vacgrp)也不需要看,虽说是随机效应,但这处理成了固定效应。

后两行正常分析。

最后一行是说:difference between treatments is time-related。不同treatment之间的差异和时间相关。

 

 

 

是说:null hypothesis of no Vaccine Group effect。也就是组间变异/随机误差,差异不显著。

 

posted @ 2021-11-11 15:21  Iving  阅读(1261)  评论(0编辑  收藏  举报