Error in i[[2]] : subscript out of bounds
Calls: run.smc -> .perturb.particles
Execution halted
This is from the new code block:
# accept or reject the proposal
for (i in .) {
if (length(i) == 0) { #checking for any items that are a returned NULL ?
next
}
if (NaN %in% i) {
next
}
else {
i <- i[[1]]
mh.ratio <- i[[2]]
new.particle <- i[[3]]
new.trees <- i[[4]]
new.dists <- i[[5]]
if (runif(1) < mh.ratio) { # always accept if ratio > 1 # mh.ratio
ws$accept[i] <- TRUE
ws$particles[i,] <- new.particle
ws$dists[,i] <- new.dists
ws$sim.trees[[i]] <- new.trees
}
else {
ws$accept[i] <- FALSE
}
}
}
Currently working on the error below:
This is from the new code block: