[R] ERROR Message

Ivone Figueiredo ifigueiredo at ipma.pt
Fri May 22 18:57:08 CEST 2015


Hi 

Could you please help me 

I am trying to fit a Multilevel Poisson regression with the following code 

## BUGS CODE

## Multilevel Poisson regression 

model {

  for (i in 1:n){

    y[i] ~ dpois (lambda[i])

    log(lambda[i]) <- mu + 

      b.species[Species[i]] + b.quarter[Quarter[i]] + epsilon[i]

    epsilon[i] ~ dnorm (0, tau.epsilon)

  }

  mu ~ dnorm (0, .0001)

  mu.adj <- mu +  mean(b.species[]) + mean(b.quarter[])

  tau.epsilon <- pow(sigma.epsilon, -2)

  sigma.epsilon ~ dunif (0, 100)

  

  for (j in 1:n.species){

    b.species[j] ~ dnorm (0, tau.species)

    b.species.adj[j] <-  b.species[j] - mean( b.species[])

  }

  tau.species <- pow(sigma.species, -2)

  sigma.species ~ dunif (0, 100)

  

  for (j in 1:n.quarters){

    b.quarter[j] ~ dnorm (0, tau.quarter)

    b.quarter.adj[j] <- b.quarter[j] - mean(b.quarter[])

  }

  tau.quarter <- pow(sigma.quarter, -2)

  sigma.quarter ~ dunif (0, 100)

}

 

##

 

skate.data <- list ("Species", "n.species", "Quarter", "n.quarters", "y")

                    

#radon.inits <- function (){

#  list (a=rnorm(J), b=rnorm(1), g.0=rnorm(1), g.1=rnorm(1),

#        sigma.y=runif(1), sigma.a=runif(1))

#}

 

skate.parameters <- c ("mu", "b.quarter", "b.species", "sigma.species",
"sigma.quarter", "sigma.epsilon")

 

skate.3 <- bugs (skate.data, inits=NULL, skate.parameters, "skates.bug",

                 n.chains=3, n.iter=500, 

            bugs.directory="c:/ProgramFiles(x86)/OpenBUGS/OpenBUGS323",

            program=c("OpenBUGS"))

 

 

But I always receive this message error 

 

Loading required package: BRugs

Welcome to BRugs connected to OpenBUGS version 3.2.3

model is syntactically correct

Error in aperm.default(datalist[[i]]) : 

  invalid first argument, must be an array

In addition: Warning messages:

1: package 'BRugs' was built under R version 3.0.3 

2: In FUN(X[[5L]], ...) : class of 'x' was discarded

 

 

 


	[[alternative HTML version deleted]]



More information about the R-help mailing list