【问题标题】:How to set limits for the x and y axis using vis.gam() function from mgcv package in r?如何使用 r 中 mgcv 包中的 vis.gam() 函数设置 x 和 y 轴的限制?
【发布时间】:2013-02-11 04:31:52
【问题描述】:

我正在使用 vis.gam() 绘制以下模型的结果:

gam.5 <- gam(mortality.under.2~s(maternal_age)+ s(birth_year) + 
          te(birth_year,maternal_age) + wealth + sex + 
         residence+ maternal_educ 
          ,data=colombia1,family="binomial") 

制作情节的代码如下:

 vis.gam(gam.5,view=c("maternal_age","birth_year"),
         plot.type="contour",type="response",
         cond=list(wealth="Lowest quintile",sex="Female",
         residence="Rural",maternal_educ="Primary"))

不幸的是,它生成的预测值超出了变量“maternal_age”和“birth_year”的数据范围。关于如何限制view 中变量的预测值范围的建议?

非常感谢,

安东尼奥·佩德罗。

【问题讨论】:

  • 查看too.far 参数到vis.gam

标签: r gam mgcv


【解决方案1】:

查看代码,图形范例似乎是基本图形(特别是 persp 函数)并且有尾随点参数,所以为什么不添加:

..., `xlim=range(columbia1(maternal_age), ylim=range(columbia1$birth_year)`

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2017-11-15
    • 2012-04-22
    • 2013-07-09
    • 2014-05-13
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多