Skip to content

Error in { : task 1 failed - "There is no "kernel_model" function." #14

Description

@kuaileyuandi

require(foreach)
results <-foreach(REP = 1:rep, .combine = "rbind")%:%
foreach(MODEL = 1:length(model), .combine = "rbind")%dopar% {

yNA      <- Y
tr       <- TS[[REP]]
yNA$value[-tr] <- NA

Z_E = model.matrix(~0+env,data=yNA) # fixed environmental effects

fit <- kernel_model(data = yNA,y = y,env = env,gid = gid,
                    random = Models[[MODEL]],fixed = Z_E,
                    iterations = iter,burnin = burn,thining = thin)


df<-data.frame(Model = model[MODEL],rep=REP,
               rTr=cor(Y$value[tr ], fit$fitted$yHat[tr ],use = 'complete.obs'),
               rTs=cor(Y$value[-tr], fit$fitted$yHat[-tr],use = 'complete.obs'))

write.table(x = df,file = 'PA_models.txt',sep=',',append = T,row.names=T)
return(df)

}

saveRDS(object = results, file = 'PA_cv1_2' )
require(plyr)

predictive ability

ddply(results,.(Model),summarise, pa = round(mean(rTs),3),sd = round(sd(rTs),4))
Error in { : task 1 failed - "There is no "kernel_model" function."

However, it works fine when only the following code is run
REP=1
yNA <- Y
tr <- TS[[REP]]
yNA$value[-tr] <- NA

Z_E = model.matrix(~0+env,data=yNA) # fixed environmental effects

fit <- kernel_model(data = yNA,y = y,env = env,gid = gid,
                    random = Models[[MODEL]],fixed = Z_E,
                    iterations = iter,burnin = burn,thining = thin)

What is the cause and how can I fix it?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions