On Wed, Nov 28, 2012 at 11:37 AM, alexB <alexandre.bud...@helsinki.fi>wrote:

The error was generated by jags not R or R2Jags (wrong list). Regardless,
your problem is the prior loop is only 1:6


> <snip>
>


>     for (i in 1:6) { b[i] ~ dnorm(0.0, 0.01)
>                   #  b[i] ~ dunif(-20, +20)
>


So the error is literally b[7] is out of range

Cheers



> }
>
> }
> ",fill = TRUE)
> sink()
>
> inits1 <- function () {
>   list(b = rnorm(7, 0, 0.01))}
>
> out1 <- jags(data = win.data1,
>              inits = inits1,
>              parameters = params1,
>              model.file = "GLM.txt",
>              n.thin = nt,
>              n.chains = nc,
>              n.burnin = nb,
>              n.iter = ni)
>
>
>
>
> That's when R returns this error message:
>
> #
> #Compiling model graph
> #   Resolving undeclared variables
> #   Allocating nodes
> #Deleting model
> #
> #Error in jags.model(model.file, data = data, inits = init.values, n.chains
> = n.chains,  :
> #  RUNTIME ERROR:
> #Compilation error on line 13.
> #Subset out of range: b[7]
> #
>
> So I guess there's a problem with line 13 of the code (i.e. b[7] * I3[i])
> causing the problem, but why... I really don't see the problem :(
>
> Any guess?
>
> Thanks in advance,
>
> aB
>
>
>
>
>
>
> --
> View this message in context:
> http://r.789695.n4.nabble.com/Error-message-R2Jags-tp4651178.html
> Sent from the R help mailing list archive at Nabble.com.
>
> ______________________________________________
> R-help@r-project.org mailing list
> https://stat.ethz.ch/mailman/listinfo/r-help
> PLEASE do read the posting guide
> http://www.R-project.org/posting-guide.html
> and provide commented, minimal, self-contained, reproducible code.
>

        [[alternative HTML version deleted]]

______________________________________________
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.

Reply via email to