绘制 GAM 交互

R 中的广义可加模型(GAM)非线性建模

Noam Ross

Senior Research Scientist, EcoHealth Alliance

使用 mgcv 的 plot() 绘制交互

plot(mod_2d)

R 中的广义可加模型(GAM)非线性建模

使用 mgcv 的 plot() 绘制交互

plot(mod_2d, scheme = 1)

R 中的广义可加模型(GAM)非线性建模

使用 mgcv 的 plot() 绘制交互

plot(mod_2d, scheme = 2)

R 中的广义可加模型(GAM)非线性建模

用 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 中的广义可加模型(GAM)非线性建模

用 vis.gam() 自定义交互图

vis.gam(x = mod,                # GAM 对象
        view = c("x1", "x2"),   # 变量
        plot.type = "persp")    # 图类型 

R 中的广义可加模型(GAM)非线性建模

用 vis.gam() 自定义交互图 (2)

vis.gam(x = mod,                # GAM 对象
        view = c("x1", "x2"),   # 变量
        plot.type = "contour")  # 图类型 

R 中的广义可加模型(GAM)非线性建模

用 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 中的广义可加模型(GAM)非线性建模

透视图选项

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

R 中的广义可加模型(GAM)非线性建模

透视图选项

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 中的广义可加模型(GAM)非线性建模

等高线图选项

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 中的广义可加模型(GAM)非线性建模

现在来画些图!

R 中的广义可加模型(GAM)非线性建模

Preparing Video For Download...