简体   繁体   English

使用R 3.2.2从mgcv软件包运行GAM功能

[英]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.

相关问题 如何使用R中mgcv包中的vis.gam()函数设置x和y轴的限制? - How to set limits for the x and y axis using vis.gam() function from mgcv package in r? R gam和mgcv之间的包冲突? - R Package conflict between gam and mgcv? 拟合随机效果Z20F35E630DAF44DBFA4C3F68F53999999999999999999999999999999999999999DAFAM()而不是GAM()ZC1C425268E68E6855174C174F174140278E608ENENENENENENENENENENENENENENED时,错误 - error when fitting random effects model using bam() rather than gam() function in mgcv package, R R 中 persp plot 中轴标题和刻度标签之间的空间(使用 mgcv 包中的 vis.gam) - Space between axis title and tick labels in persp plot in R (using vis.gam from mgcv package) 在新的mgcv软件包中将update()函数与gam()结合使用 - Using update() function in conjunction with gam() in new mgcv package 使用比例数据在 mgcv 中运行二项式 GAM 时出错 - Error running binomial GAM in mgcv with proportional data 两条不同行中的 GAM 残差 - R &quot;mgcv&quot; - GAM residuals in two distinct lines - R "mgcv" 如何在R中的mgcv中声明gam()中的指数分布 - How to declare the exponential distribution in gam() in mgcv in R mgcv访问estimate.gam函数 - mgcv access to estimate.gam function 自定义链接功能适用于GLM,但不适用于mgcv GAM - Custom Link function works for GLM but not mgcv GAM
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM