Hello all: Please help me with this "can't find object" issue. I'm trying to get leave-one-out predicted values for Beta-binomial regression. It may be the gamlss issue because the code seems to work when %do% is used. I have searched for similar issues, but haven't managed to figure it out. This is on Windows 10 platform.
Thanks in advance, Nik # -------------------------------------------------------------- library('gamlss') library('foreach') library('doParallel') registerDoParallel(cores = 4) # Generate data set.seed(314) sample.size <- 30 input.processed.cut <- data.frame(TP = round(runif(sample.size) * 100), FP = round(runif(sample.size) * 100), x = runif(sample.size)) # Fit Beta-binomial model3 <- gamlss(formula = cbind(TP, FP) ~ x, family = BB, data = input.processed.cut) # Get the leave-one-out values loo_predict.mu <- function(model.obj, input.data) { yhat <- foreach(i = 1 : nrow(input.data), .packages="gamlss", .combine = rbind) %dopar% { updated.model.obj <- update(model.obj, data = input.data[-i, ]) predict(updated.model.obj, what = "mu", newdata = input.data[i,], type = "response") } return(data.frame(result = yhat[, 1], row.names = NULL)) } par.run <- loo_predict.mu(model3, input.processed.cut) # Error in { : task 1 failed - "object 'input.data' not found" # ------------------------------------------------------------------------ > version _ platform x86_64-w64-mingw32 arch x86_64 os mingw32 system x86_64, mingw32 status major 3 minor 4.3 year 2017 month 11 day 30 svn rev 73796 language R version.string R version 3.4.3 (2017-11-30) nickname Kite-Eating Tree ______________________________________________ R-help@r-project.org mailing list -- To UNSUBSCRIBE and more, see https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.