[英]Running GAM function from mgcv package with R 3.2.2
I have recently run into a problem running a GAM model from a previously working code. 最近,我在使用以前的代码运行GAM模型时遇到问题。 I believe it is related to an updated R-Version and an updated Version of the mgcv package.
我相信它与更新的R版本和mgcv软件包的更新版本有关。 So it would be great to know if anyone has the same problem or has a solution to it.
因此,很高兴知道是否有人遇到相同的问题或有解决方案。
I am currently running: R version 3.2.2 (2015-08-14) -- "Fire Safety" on Windows. 我当前正在运行:R版本3.2.2(2015-08-14)-Windows上的“消防安全”。 And I am using the mgcv Package 1.8-7.
我正在使用mgcv软件包1.8-7。
Below is an example code that re-produces the error message, when run on my computer. 下面是在我的计算机上运行时重现该错误消息的示例代码。
###Load package
library(mgcv)
This is mgcv 1.8-7. 这是mgcv 1.8-7。
###Simulate some example data
set.seed(2) ## simulate some data...
dat <- gamSim(1,n=400,dist="normal",scale=2)
###Run normal model
b <- gam(y~s(x0)+s(x1)+s(x2)+s(x3),data=dat, family=gaussian())
This works. 这可行。
###change the smoothness selection method to REML
b0 <- gam(y~s(x0)+s(x1)+s(x2)+s(x3),data=dat,method="REML")
Gives the following error message: 给出以下错误信息:
Error in .C(C_gdi1, X = as.double(x[good, ]), E = as.double(Sr), Eb = as.double(Eb), : Incorrect number of arguments (48), expecting 47 for 'gdi1' .C(C_gdi1,X = as.double(x [good,]),E = as.double(Sr),Eb = as.double(Eb),中的错误:参数数目不正确(48),期望47 'gdi1'
Thanks for your help! 谢谢你的帮助!
我已经重新安装了R和mgcv软件包,看来这已经解决了问题。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.