Advertisement
Guest User

Untitled

a guest
Mar 26th, 2017
68
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.52 KB | None | 0 0
  1. costFunc=function(par,dat){
  2. state=sapply(mySamp,stateofMC,windDat=windDat)
  3. sum=0
  4. for(i in 1:3){
  5. state_loc=which(state==i)
  6. sum = sum + colSums(abs(as.matrix(dat[state_loc,,drop=F]) %*%
  7. rbind(-par,1)[,i,drop=F]))
  8. }
  9. return(sum)
  10. }
  11.  
  12. forecstCoef=optim(par=tranProb,costFunc,gr=NULL, dat=dat,
  13. method="Nelder-Mead")$par
  14.  
  15. Error in as.matrix(dat[state_loc, , drop = F]) %*% rbind(-par, 1)[, i,
  16. :non-conformable arguments
  17. Called from: is.data.frame(x)enter code here
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement