Is there a "best" way to form loops with respect to the storage of arrays and matrices? I assume that since matrices and arrays are both "column-major," that a R x C matrix, for example, should be looped: for (C in 1:ncol){ for (R in 1:nrow){ ...something done to matrix[R,C]... } } What about, for example, a 3-dimensional array ? Would it be safe to assume: for (T in 1:nt){ for (C in 1:ncol){ for (R in 1:nrow){ ...something done to array [R,C,T]... } } } is optimal? Thanks, and best regards, Mat...
Aplogies--I see my error is in the "log(lambda[t])" line, where I call delta0, but I have mistakenly defined it as a vector in the preceding loop.
Dear Community, I'm puzzled by the "invalid vector argument to exp" runtime error I receive in this case: model{ for (j in 1:ncells){ for (t in 1:ntime){ known[j,t]~dbern(p.known[j,t]*z[j,t]) ##known[] is matrix of detected (1 or 0) p.known[j,t]<-1-negp.known[j,t] negp.known[j,t]<-exp(-n.rep[j,t]*lambda[t]) ##nrep[] is a matrix of integer search #efforts, but has NAs n.rep[j,t]~dpois(mu.rep[j,t]) mu.rep[j,t]~dlnorm(mu.mu.rep[zone[j],t],prec.mu.rep[zone[j]]) z[j,t]~dbern(Ez[j,t]) #################...
Hi Forum, Can a saved runjags object be extended after the original R session has ended, and the runjags object loaded from a saved location? I have tried to do this, but I receive the "invalid parent values" error, which I thought would not be an issue extending a model that has already run to completion. Best regards, and thanks, Matt
Thanks, Mr. Denwood. I just misunderstood the way the function works. I thought it would sample 10000, thinning by 2 along the way, to keep a remaining 5000. Matt
Hi. My version of run.jags seems to run 20000 iterations regardsless of what I specify in the "samples" statement. > cjagsout<-run.jags(model="my model", + monitor=parms2,data=forjags,n.chains=2,inits=j.inits,burnin=10000,adapt=1000, + sample=10000,thin=2,jags.refresh=60,method="rjags",modules = "glm on",summarise = TRUE) Compiling rjags model... Calling the simulation using the rjags method... Adapting the model for 1000 iterations... |++++++++++++++++++++++++++++++++++++++++++++++++++| 100% Burning...
Problem solved Dear Dr. Plummer, I must begin with an apology for wasting your time,...
Dear community, I have pasted an excerpt from a state-space model of binary observations...