GAM 상호작용 시각화

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

Noam Ross

Senior Research Scientist, EcoHealth Alliance

상호작용에 mgcv의 plot() 명령 사용

plot(mod_2d)

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

상호작용에 mgcv의 plot() 사용

plot(mod_2d, scheme = 1)

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

상호작용에 mgcv의 plot() 사용

plot(mod_2d, scheme = 2)

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

vis.gam()으로 상호작용 플롯 사용자 정의

vis.gam(x,
        view = NULL,
        cond = list(),
        n.grid = 30,
        too.far = 0,
        col = NA,
        color = "heat",
        contour.col = NULL,
        se = -1,
        type = "link",
        plot.type = "persp",
        zlim = NULL,
        nCol = 50,
        ...)
R로 배우는 Generalized Additive Models (GAMs): 비선형 모델링

vis.gam()으로 상호작용 플롯 사용자 정의

vis.gam(x = mod,                # GAM 객체
        view = c("x1", "x2"),   # 변수
        plot.type = "persp")    # 플롯 유형 

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

vis.gam()으로 상호작용 플롯 사용자 정의 (2)

vis.gam(x = mod,                # GAM 객체
        view = c("x1", "x2"),   # 변수
        plot.type = "contour")  # 플롯 유형 

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

vis.gam()으로 상호작용 플롯 사용자 정의

vis.gam(mod, view = c("x1", "x2"), plot.type = "contour", too.far = 0.1)
vis.gam(mod, view = c("x1", "x2"), plot.type = "contour", too.far = 0.05)

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

투시 플롯 옵션

vis.gam(x = mod, view = c("x1", "x2"), 
        plot.type = "persp", se = 2)                  

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

투시 플롯 옵션

vis.gam(g, view = c("x1", "x2"), plot.type = "persp", 
                                 theta = 220)
vis.gam(g, view = c("x1", "x2"), plot.type = "persp", 
                                 phi = 55)
vis.gam(g, view = c("x1", "x2"), plot.type = "persp", 
                                 r = 0.1)

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

등고선 플롯 옵션

vis.gam(g, view = c("x1", "x2"), plot.type = "contour",
                                 color = "gray")
vis.gam(g, view = c("x1", "x2"), plot.type = "contour",
                                 contour.col = "blue")
vis.gam(g, view = c("x1", "x2"), plot.type = "contour",
                                 nlevels = 20)

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

이제 플롯을 만들어 봅시다!

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

Preparing Video For Download...