gam.check()를 이용한 모델 검진

R로 배우는 Generalized Additive Models (GAMs): 비선형 모델링

Noam Ross

Senior Research Scientist, EcoHealth Alliance

함정 하나: 기저 수의 부족

mod <- gam(y ~ s(x1, k = 4) + s(x2, k = 4),
           data = check_data, method = "REML")

R로 배우는 Generalized Additive Models (GAMs): 비선형 모델링
gam.check(mod)
Method: REML   Optimizer: outer newton
full convergence after 9 iterations.
Gradient range [-0.0001467222,0.00171085]
(score 784.6012 & scale 2.868607).
Hessian positive definite, eigenvalue range [0.00014,198.5]
Model rank =  7 / 7 

Basis dimension (k) checking results. Low p-value
(k-index<1) may indicate that k is too low, especially
if edf is close to k'.

        k'  edf k-index p-value    
s(x1) 3.00 1.00    0.35  <2e-16 ***
s(x2) 3.00 2.88    1.00    0.52    
 ---
Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1
R로 배우는 Generalized Additive Models (GAMs): 비선형 모델링

gam.check 실행 (2)

mod <- gam(y ~ s(x1, k = 12) + s(x2, k = 4),
                data = dat, method = "REML")
gam.check(mod)
...

         k'   edf k-index p-value  
s(x1) 11.00 10.85    1.05   0.830  
s(x2)  3.00  2.98    0.89   0.015 *

...
R로 배우는 Generalized Additive Models (GAMs): 비선형 모델링

gam.check 실행 (3)

mod <- gam(y ~ s(x1, k = 12) + s(x2, k = 12),
            data = dat, method = "REML")
gam.check(mod)
...
         k'   edf k-index p-value
s(x1) 11.00 10.86    1.08    0.94
s(x2) 11.00  7.78    0.94    0.12
...
R로 배우는 Generalized Additive Models (GAMs): 비선형 모델링

R로 배우는 Generalized Additive Models (GAMs): 비선형 모델링

R로 배우는 Generalized Additive Models (GAMs): 비선형 모델링

모델을 직접 확인해 봅시다

R로 배우는 Generalized Additive Models (GAMs): 비선형 모델링

Preparing Video For Download...