선형회귀모형 - Linear Regression
Linear Regression 은 연속형인 Y(=response)와 다른 변수 X와의 Linear relationship을 분석하는 방법입니다.
regression 식은 간단하게 SLR(Simple Linear Regression)을 이용해서 그 개념을 이해해 보겠습니다.
< Check Assumption of Regression >
I. 잔차(residuals)의 정규성 가정
regressor 인 X 를 X축으로 잔차인 e 를 Y축으로 scatter plot을 그려봐서 '0'을 기준으로 잘 퍼져 있으면 됩니다. 아래 그림 중 첫번째 plot 모양이 나오면 violation은 없는 것입니다.
위와 같은 방법은 계산해서 해야하는 불편함이 있어, 간단하게 proc reg 을 통해 잔차를 output으로 받아 plot을 그려 볼 수 있습니다.
<SAS Code>
proc reg data=test.test_data;
model bmi= sys/r;
output out=res_out r=resid;
run;
proc univariate data=res_out normal;
qqplot resid /Normal(mu=est sigma=est color=red l=1);
run;
<SAS Output>
Kolmogorov-Smirnov p-value <0.01 로 정규성 가정을 위배하고, Q-Q plot 을 확인해도 마찬가지로 정규성을 위배합니다. 이런 경우 어떻게 해야 하는지 방법을 알아보겠습니다.
▶ 정규성 가정 violation 시 가능한 방법
- Y(=response) 변수를 transformation 한다.
- Polynomial regression 또는 nonlinear regression을 고려해 본다.
II. 잔차(residuals)의 독립성 가정
잔차는 서로 상관관계가 없으며 독립이어야 합니다.
DW(더빈-왓슨 통계량) 을 사용하며, DW값이 2에 가까우면 오차항간 상관관계가 없다는 의미이며, 4에 가까우면 (-) 상관관계, 0에 가까우면 (+) 상관관계가 있음을 의미합니다.
proc reg data=test.test_data;
model bmi= sys/dw;
run;
DW 값 = 1.985 로 2에 가까우므로 잔차는 서로 독립으로 보입니다.
III. 등분산 가정
잔차들이 어떤 패턴없이 고르게 퍼져 있는지 확인합니다.
만약 plot 이 아래와 같다면 등분산 가정을 위배하게 됩니다. 즉, regressor 가 커질수록 잔차가 퍼지고, 작을수록 '0' 값에 모여있는 패턴을 보이기 때문입니다.
< Linear Regression 예제 >
Y(=response variable) : wtgain, X(=regressor, predict variable) : food
data reg_data;
input wtgain food;
lines;
14.7 0.09
17.8 0.14
19.6 0.18
18.4 0.15
20.5 0.16
21.1 0.23
17.2 0.11
18.7 0.19
20.2 0.23
16.0 0.13
17.8 0.17
19.4 0.21
;
run;
proc reg data=reg_data;
model wtgain = food / clb;
plot wtgain*food residual.*food/conf pred;
run;
* clb : Confidence limit of beta (beta0 : intercept, beta1 에대한 Confidence limit을 보여줍니다.)
* residual. * food : residual plot을 함께 그려줍니다.(등분산 가정을 함께 check 가능합니다.)
residual. 은 SAS keyword 로 그대로 써주면 됩니다.
Output을 해석하면, food estimate(=coefficient)는 35.8로 positive 이고, p-value=0.0004 이므로, food 섭취량이 1 unit 증가할때 average weight gain은 35.8 만큼 유의하게 증가한다고 할 수 있습니다.
( If your food intake increases by 1 unit, the average weight gains by 35.8 )
'의학통계 > 통계분석' 카테고리의 다른 글
공분산분석 - ANCOVA (Analysis of Covariance) (0) | 2022.06.23 |
---|---|
다중회귀모형 - Multiple Linear Regression (0) | 2022.06.22 |
Categorical Data - Chi-sq test & McNemar test (0) | 2022.06.21 |
연관된 두 집단의 비교 - Paired t-test 와 Wilcoxon Signed Rank sum Test (0) | 2022.06.21 |
독립된 3개이상의 집단 비교 - ANOVA 와 Kruskal Wallis Test (0) | 2022.06.21 |
댓글