0
$\begingroup$

I am estimating a stochastic frontier with a mixed model. So far the half normal distribution worked good but I need a truncated normal distribution. It does not work, and I receive the error „Expected collection operator c“. I am using R2WinBUGS and as you can see in the model I have tried OpenBUGS and WinBUGS. Any suggestion? My model looks like:

for (i in 1:N)
 {

    mu[i] <- alpha + x[i,1]*beta[1] + x[i,2]*beta[2] + x[i,3]*beta[3] + 
         x[i,4]*beta[4] + x[i,5]*beta[5] + u0[county[i]] + u1[county[i]]*x[i,1] + 
         u2[county[i]]*x[i,2] + u3[county[i]]*x[i,3] + u4[county[i]]*x[i,4] + 
         u5[county[i]]*x[i,5] - z[ID[i]]

    y[i] ~ dnorm(mu[i], tau)

}


for (i in 1:220) {
    z[i] ~ djl.dnorm.trunc(rho,lambda,0,1000)

    z[i] ~ dnorm(rho,lambda)T(0,100)  #For openbugs

    eff[i] <- exp(-z[i])
}

prior for rho~dnorm(0,0.027)

I would appreciate your help! Regards, Daniel

$\endgroup$
3
  • 2
    $\begingroup$ Is this question only about how to get something done in R / WinBUGS? If so, it would be off-topic for CV (see our FAQ), but on topic for Stack Overflow. If you have a substantive statistical question, please edit to clarify it, if not, you can flag your Q for migration (please don't cross-post, though). $\endgroup$ Commented Feb 3, 2013 at 19:38
  • $\begingroup$ The function djl.dnorm.trunc looks suspicious to me. Why don't you use the dnorm(..)I(..) here also? $\endgroup$
    – Tomas
    Commented Feb 3, 2013 at 19:53
  • $\begingroup$ Thanks Thomas, I tried that one too and it doesn't work $\endgroup$
    – Daniel C
    Commented Feb 4, 2013 at 8:38

1 Answer 1

2
$\begingroup$

For truncating, I use the operator I i.e.:

x ~ dnorm(mean, tau)I(low, high)
$\endgroup$
1
  • 1
    $\begingroup$ @DanielC Your error will be probably caused by different line of code than this one... $\endgroup$
    – Tomas
    Commented Feb 3, 2013 at 19:54

Not the answer you're looking for? Browse other questions tagged or ask your own question.