Hi,
I am new in using rjags and trying to generate a leslie matrix in the model. When i use the diag() function I get the error: Unknown function: diag. Is there any solution to this rather than generating the matrix in a loop? I tried the loop but it requires couple of more lines when I am trying to fill the off-diagonal cells with zeros. Additionally, I wonder if using a loop would make the model run slower?
I'd much appreciate any help either using the diag() function or alternatives- generating the leslie matirx within a loop.
lesM[2:A,1:(A-1)] <- diag(s[2:A,i])
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
No there is no diag() function in the BUGS language (either in OpenBUGS or JAGS). There is no speed penalty for doing it in a loop, although it is quite verbose.
Hi,
I am new in using rjags and trying to generate a leslie matrix in the model. When i use the diag() function I get the error: Unknown function: diag. Is there any solution to this rather than generating the matrix in a loop? I tried the loop but it requires couple of more lines when I am trying to fill the off-diagonal cells with zeros. Additionally, I wonder if using a loop would make the model run slower?
I'd much appreciate any help either using the diag() function or alternatives- generating the leslie matirx within a loop.
lesM[2:A,1:(A-1)] <- diag(s[2:A,i])
No there is no
diag()
function in the BUGS language (either in OpenBUGS or JAGS). There is no speed penalty for doing it in a loop, although it is quite verbose.Thanks Martyn