xlim not working in plot.gam in mgcv

南笙酒味 提交于 2019-12-13 04:42:09

问题


The mgcv package in R lets you estimate smooth regressions on multiple variables. Here is an example:

library(mgcv)
set.seed(2) ## simulate some data... 
dat = gamSim(1,n=400,dist="normal",scale=2)
mod = gam(y~te(x0, x1),data=dat)
par(mfrow = c(2,1))
plot(mod)
plot(mod, xlim = c(0, 0.5))

When I run this, the two plots look exactly the same. Why doesn't xlim = c(0, 0.5) restrict the range of the horizontal axis? How can I achieve this?

Update on my session info:

> sessionInfo()
R version 3.0.1 (2013-05-16)
Platform: x86_64-w64-mingw32/x64 (64-bit)

locale:
[1] LC_COLLATE=English_United States.1252  LC_CTYPE=English_United States.1252    LC_MONETARY=English_United States.1252
[4] LC_NUMERIC=C                           LC_TIME=English_United States.1252    

attached base packages:
[1] stats     graphics  grDevices utils     datasets  methods   base     

other attached packages:
[1] mgcv_1.7-22

loaded via a namespace (and not attached):
[1] grid_3.0.1      lattice_0.20-15 Matrix_1.0-12   nlme_3.1-109    tools_3.0.1 

来源:https://stackoverflow.com/questions/25268430/xlim-not-working-in-plot-gam-in-mgcv

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!