[분산분석] 반복측정 분산분석 (Repeated Measures ANOVA, RMANOVA) SAS Syntax


✅ SAS 반복측정 ANOVA (Repeated Measures ANOVA) 예제

✅ 3. 반복측정 ANOVA (Repeated Measures ANOVA)

반복측정 ANOVA는 동일한 피험자에게 여러 조건(시간, 처리 등)을 적용했을 때, 조건 간 평균 차이가 유의한지를 검정하는 통계 기법입니다.


🔹 기본 구문

proc glm data=your_data;
    class subject time;
    model y1 y2 y3 = / nouni;
    repeated time 3;   /* 반복측정 변수(time) 이름과 반복 횟수 */
run;
quit;

또는 더 유연한 방법:

proc mixed data=your_data;
    class subject time;
    model y = time;
    repeated time / subject=subject type=cs;
run;


📊 예제: 운동 프로그램 전·중·후 체중 변화

같은 참가자(subject)들이 3단계 시간(time) 동안 체중 변화를 측정한 데이터입니다.


방법 1: PROC GLM 사용

proc glm data=weight;
    model weight1 weight2 weight3 = / nouni;
    repeated time 3;
run;
quit;

방법 2: PROC MIXED 사용 (Long format 필요)

먼저 데이터를 Long 형태로 변환:

data weight_long;
    set weight;
    time = 1; weight = weight1; output;
    time = 2; weight = weight2; output;
    time = 3; weight = weight3; output;
    keep subject time weight;
run;

분석

proc mixed data=weight_long;
    class subject time;
    model weight = time;
    repeated time / subject=subject type=cs;
run;

📝 결과 해석

  • 시간(time)에 따른 평균 차이가 유의한지 확인
  • PROC GLM은 간단하지만 유연성이 낮음
  • PROC MIXED는 다양한 반복 측정 구조와 결측치 허용 가능

0 댓글