search for: pastlist

Displaying 1 result from an estimated 1 matches for "pastlist".

Did you mean: passlist
2013 Apr 18
1
parSapply can't find function
...#39;modeest') library('snow') cl = makeCluster(rep('localhost', 8), 'SOCK') x = vector(length=50) x = sapply(x, function(i) i=sample(c(1,0), 1)) pastK = function(n, x, k) { if (n>k) { return(x[(n-k):(n-1)]) } else {return(NA)} } predR = function(x, k) { pastList = lapply(1:length(x), function(n) pastK(n, x, k)) pred = sapply(pastList, function(v) mfv(v)[1]) ratio = sum(pred==x, na.rm=T)/(length(pred) - sum(is.na(pred))) } testK = function() { k = seq(3, 25, 2) r = parSapply(cl, k, function(i) predR(x, i)) # r = sapply(k, function(i) pre...