Dmitry J
Dmitry J

Reputation: 143

winbugs: expected a comma eroor

all!

I am using winbugs to do simple linear regression. However, the system always give the error message, expected a comma.

Here is my model statement:

model {
   for (i in 1:I)
    {
      Z[i] ~ dnorm(beta0 + beta1 * X[i], tau)
     }
   tau <- 1/(sigma*sigma)
   sigma ~ dunif(0, 100)
   beta0 ~ dnorm(0, 1E-6)
   beta1 ~ dnorm(0, 1E-6)
 }

what is wrong with it? Thank you.

Upvotes: 0

Views: 404

Answers (1)

Mayara
Mayara

Reputation: 11

WinBugs does not allow expressions for parameters' distribution like you did in dnorm(beta0 + beta1 * X[i], tau).

The solution of your problem is

model {
  for (i in 1:I)
  {
      Z[i] ~ dnorm(mu[i], tau)
      mu[i]<- beta0 + beta1 * X[i]
  }
  tau <- 1/(sigma*sigma)
  sigma ~ dunif(0, 100)
  beta0 ~ dnorm(0, 1.0E-6)
  beta1 ~ dnorm(0, 1.0E-6)
 }

Upvotes: 1

Related Questions