R中的mgcv
包可让您估算多个变量的平滑回归。这是一个例子:
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))
当我运行时,这两个图看起来完全一样。为什么xlim = c(0, 0.5)
不限制水平轴的范围?我怎样才能做到这一点?
更新:
> 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