suyusung / R2jags

R2jags: Using R to Run 'JAGS'
8 stars 3 forks source link

Clarifying the "error/missing in parameter" warning #20

Open paulserafini opened 3 months ago

paulserafini commented 3 months ago

Hi,

First, thank you for this package!

I believe this warning was added to as.bugs.array2.R recently:

if (length(long.short[[j]]) != length.short[j]){
  warning(paste("error/missing in parameter", root.short[[j]],"in parameters.to.save, \n   Be aware of the output results.\n"), noBreaks.=TRUE)
}

If I understand the function correctly, it occurs when the number of saved parameters NAME[i,j] does not equal length(unique(i)) * length(unique(j)), i.e. when the entire implied rectangular matrix isn't saved. In network meta-analysis work, many established models only save the upper triangle of certain matrices, e.g. a model from this publication contains (after simplifying the code a bit to make it shorter):

for (c in 1:(nt-1)) {
 for (k in (c+1):nt) {
   or[c,k] <- exp(d[k] - d[c])
 }
}

Because of this, I was given a fright when this warning came up and I had to spend some time understanding the as.bugs.array2.R function to make sure nothing was wrong. Maybe the message could stipulate that not all combinations are present? Then it might be clearer that it doesn't apply in such cases.

Thank you!

suyusung commented 2 months ago

Hi I cannot find a good way to do this. I want to overskill it so people who use sims.list (not recommended) should be aware of potential issues. But you were right, I can just do it mildly which might cause people to overlook it. I am still in doe the first stance. Maybe you can suggest better solution to this?

YS