The forum software ate your subscripts. Here is your model with correct
formatting.
for(j in1:n){for(a in1:t[j]){for(b in1:t[j]){
sigma[j,a,c]<-pow(rho,t[a]-t[c])}}
sigmainverse[j,,]<-inverse(sigma[j,,])# this is where jags got error}
You don't say what the error message is, but I'm guessing it has something to
do with the compiler not being able to work out the dimensions of sigma or
sigmainverse.
Thank you very much for your reply. That is the error. I tried your code, it
still doesn't work. I am new to JAGS. I guess maybe the JAGS doesn't solve the
inverse for a matrix in a 3-way array? As my sigma is 3-way array. Any ideas?
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
Even I tried determinant_<-logdet(sigma[i, 1:t_,1:t_]), JAGS gives me "Non-
conforming parameters in function logdet". I feel like JAGS can not do 3-way
array calculation?___
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
No, you have the opposite problem. The inverse function does not accept
scalars.
You really haven't given enough information to solve the problem, but I'm
guessing that you have t=1 for some j (presumably j=1 and t is an increasing
sequence). In this case "sigma[j, 1:t, 1:t]" is a scalar quantity, not a
matrix (JAGS follows S in dropping redundant dimensions when you take subsets
of arrays). Currently the inverse and logdet functions do not work on scalars.
I have fixed this for the next release, but in the meantime you are going to
have to special case t = 1 by taking it outside the loop, e.g.
Oh, I think you are right. But sometimes t_=1 (i is not 1, it could be
random). how can I specify that? I don't think the "if else" can work here.
Thank you again._
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
Hi, anybody can help me with this? can JAGS solve the inverse of a matrix in
the 3-way array? Thank you!
for(i in 1:n){
for(a in 1:t_){
for(b in 1:t_){
sigma<-pow(rho,t-t**)
}
}
sigmainverse<-inverse(sigma) # this is where jags got error
}**__
The forum software ate your subscripts. Here is your model with correct
formatting.
You don't say what the error message is, but I'm guessing it has something to
do with the compiler not being able to work out the dimensions of sigma or
sigmainverse.
You could try this
and take care not to reference any elements of sigma or sigmainverse that you
have not defined.
Thank you very much for your reply. That is the error. I tried your code, it
still doesn't work. I am new to JAGS. I guess maybe the JAGS doesn't solve the
inverse for a matrix in a 3-way array? As my sigma is 3-way array. Any ideas?
Even I tried determinant_<-logdet(sigma[i, 1:t_,1:t_]), JAGS gives me "Non-
conforming parameters in function logdet". I feel like JAGS can not do 3-way
array calculation?___
No, you have the opposite problem. The inverse function does not accept
scalars.
You really haven't given enough information to solve the problem, but I'm
guessing that you have t=1 for some j (presumably j=1 and t is an increasing
sequence). In this case "sigma[j, 1:t, 1:t]" is a scalar quantity, not a
matrix (JAGS follows S in dropping redundant dimensions when you take subsets
of arrays). Currently the inverse and logdet functions do not work on scalars.
I have fixed this for the next release, but in the meantime you are going to
have to special case t = 1 by taking it outside the loop, e.g.
Note also that in order to get a symmetric matrix (required by inverse) you
need to use abs(t - t) .
Oh, I think you are right. But sometimes t_=1 (i is not 1, it could be
random). how can I specify that? I don't think the "if else" can work here.
Thank you again._
If t is random then you cannot use 1:t as an index on the left hand side of a
relation. All quantities in JAGS have to have fixed dimension.