![](/img/trans.png)
[英]Why does using “mgcv::s” in “gam(y ~ mgcv::s…)” result in an error?
[英]Why does using cluster= argument in mgcv::bam() result in an error?
我想重現這里給出的例子:
https://stat.ethz.ch/R-manual/R-devel/library/mgcv/html/mgcv-parallel.html
具體來說,在mgcv :: bam()中使用cluster =參數。
可重復的例子:
require(mgcv)
require(parallel)
k <- 13;bs <- "cr"; set.seed(9)
dat <- gamSim(1,n=6000,dist="poisson",scale=.1)
nc <- 2 ## cluster size, set for example portability
if (detectCores()>1) { ## no point otherwise
cl <- makeCluster(nc)
} else cl <- NULL
system.time(b3 <- bam(y ~ s(x0,bs=bs,k=7)+s(x1,bs=bs,k=7)+s(x2,bs=bs,k=k)
,data=dat,family=poisson(),chunk.size=5000,cluster=cl))
這會導致我的機器出現以下錯誤:
checkForRemoteErrors(val)出錯:2個節點產生錯誤; 第一個錯誤:沒有適用於“預測”的方法應用於類“gam”的對象時間停在:0.31 0 0.37
其他可能有用的信息:
R version 3.4.4 (2018-03-15)
Platform: x86_64-w64-mingw32/x64 (64-bit)
Running under: Windows 7 x64 (build 7601) Service Pack 1
我的機器有4個內核和16 GB RAM。
謝謝。
我無法重現錯誤並獲得此輸出。
> b3
Family: poisson
Link function: log
Formula:
y ~ s(x0, bs = bs, k = 7) + s(x1, bs = bs, k = 7) + s(x2, bs = bs,
k = k)
Estimated degrees of freedom:
3.64 4.05 9.95 total = 18.64
fREML score: 8563.705
嘗試更新軟件包,看看是否有幫助。 否則,更多的洞察力將是有用的。
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.