[R] Problem on estimating fish species

Ivone Figueiredo ivonemfigueiredo at gmail.com
Mon May 25 09:02:52 CEST 2015


Hi
I am trying to estimate the proportion of species landed by species. But I
always get error messages.

Can you please help me? Thanks Ivone

 I am trying to use R2Winbugs to

skate.4 <- bugs (skateA.data, inits=skatesA.inits, skateA.parameters,
model1.file,   n.chains=1, n.iter=50,          bugs.directory="C:/Program
Files (x86)/OpenBUGS/OpenBUGS323/", program=c("OpenBUGS"), debug=TRUE)

skateA.data <- list(n=length(y_A), y_A =y_A, Species_A= Species_A,
n.species_A=n.species_A)

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

skatesA.inits <- function (){
  list (mu=rnorm(0.5),  b.species=rnorm(0.2), sigma.species=runif(1),
        sigma.epsilon=runif(1))}


The model is

model {
  for (i in 1:n){
    y[i] ~ dpois (lambda[i])
    lambda[i] <- exp(mu+b.species[Species_A[i]] + epsilon[i])
    epsilon[i]  ~ dnorm (0, tau.epsilon)
  }
  mu ~ dnorm (0, .0001)
  mu.adj <- mu +  mean(b.species[])
  tau.epsilon <- pow(sigma.epsilon, -2)
  sigma.epsilon ~ dunif (0, 100)
  b.species[1] <-0

  for (j in 2:n.species_A){
    b.species[j] ~ dnorm (0, tau.species)
  }
  tau.species <- pow(sigma.species, -2)
  sigma.species ~ dunif (0, 100)
}

 the data are:

n  <-  54

n.species_A <- 3





y <- c(6.80,10.20 124.20, 6.350, 0.00,63.20, 0.00, 0.00,86.850, 3.60,
2.550,60.950,0.00, 0.00,87.20, 2.60, 0.00,58.10, 3.360,34.990,62.140, 0.00,
0.00,63.90,0.00, 0.00 112.660, 0.00, 0.00 121.630, 0.00, 3.580 101.770,
0.00, 0.00 158.00,0.00, 0.00 123.279, 0.00, 0.00 124.255, 3.170,
0.00,27.840, 5.930, 0.00 174.435,0.00, 0.00,53.525, 0.00, 4.858,68.945)



Species <- c("RJC”, “RJE”, “RJH”, “RJC”, “RJE”, “RJH”, “RJC”, “RJE”, “RJH”,
“RJC”, “RJE”, “RJH”, “RJC”, “RJE”, “RJH”, “RJC", "RJE”, “RJH”, “RJC”,
“RJE”, “RJH”, “RJC”, “RJE”, “RJH”, “RJC”, “RJE”, “RJH”, “RJC”, “RJE”,
“RJH”, “RJC”, “RJE", "RJH”, “RJC”, “RJE”, “RJH”, “RJC”, “RJE”, “RJH”,
“RJC”, “RJE”, “RJH”, “RJC”, “RJE”, “RJH”, “RJC”, “RJE”, “RJH", "RJC”,
“RJE”, “RJH”, “RJC”, “RJE”, “RJH")

	[[alternative HTML version deleted]]



More information about the R-help mailing list