Skip to content

Multilevel

6 messages · martanair, Ben Bolker, Uwe Ligges

#
Why this?


I write:
radon.data <- list ("n", "J", "x", "y", "county")
radon.inits <- function (){
  list (a=rnorm(J), b=rnorm(1), mu.a=rnorm(1),
        sigma.y=runif(1), sigma.a=runif(1))
}
radon.parameters <- c ("a", "b", "mu.a", "sigma.y", "sigma.a")

 # with 10 iterations
radon.1 <- bugs (radon.data, radon.inits, radon.parameters, "radon.1.bug",
n.chains=3, n.iter=10)

plot (radon.bugs.1)    # to get a plot similar to Figure 16.1
print (radon.bugs.1)   # to display the results in the R console

 # with 500 iterations
radon.bugs.1 <- bugs (radon.data, radon.inits, radon.parameters,
"radon.1.bug",
    n.chains=3, n.iter=500)

plot (radon.bugs.1)    # to get Figure 16.1
print (radon.bugs.1)   # to display the results in the R console

But after this
 # with 10 iterations
radon.1 <- bugs (radon.data, radon.inits, radon.parameters, "radon.1.bug",
n.chains=3, n.iter=10)

R programe give me an error:
Errore in FUN(X[[1L]], ...) : oggetto "n" non trovato


Anybody can help me?
Thanks
Marta
#
On 29.01.2011 15:06, martanair wrote:
1. Let me assume your are talking about R2WinBUGS, right? Please say so 
and indicate in your subject line.

2. We do not have radon1.bug. Hence we cannot reproduce anything. Please 
read the posting guide.
3. What is Figure 16.1?
We still do not have radon1.bug.
This is rather unlikely unless you have changed some of your objects in 
the meantime. In any case, we can only help if you send reproducible code.

Best,
Uwe Ligges
#
I have R2WinBUGS
and this is my radon1.bug 

# Bugs code for multilevel model for radon
# with bsmt as an individual predictor

# varying-intercept model

model {
  for (i in 1:n){
    y[i] ~ dnorm (y.hat[i], tau.y)
    y.hat[i] <- a[county[i]] + b*x[i]
  }
  b ~ dnorm (0, .0001)
  tau.y <- pow(sigma.y, -2)
  sigma.y ~ dunif (0, 100)

  for (j in 1:J){
    a[j] ~ dnorm (mu.a, tau.a)
  }
  mu.a ~ dnorm (0, .0001)
  tau.a <- pow(sigma.a, -2)
  sigma.a ~ dunif (0, 100)
}
#
Can you please

1. reply to me personally, not only to the list (which I won't read all 
the time) and

2. cite what you wrote before. I tend to delete messages that are not of 
importance for me and rely on the fact that old information is cited. 
Now I do not have the data nor the code anymore and I really do not 
start to search in the web or in the list archives.

Best,
Uwe Ligges
On 29.01.2011 18:20, martanair wrote:
#
Uwe Ligges <ligges <at> statistik.tu-dortmund.de> writes:
[snip]
[snip]
As Uwe said, this seems very unlikely.  If you can show us
a clean, reproducible example we may be able to help.  There's
no obvious reason why the variable n should have existed at the
time of your first run (radon.bugs.1) and then disappeared in
the process of running plot(radon.bugs.1); print(radon.bugs.1).

  I suspect you are working through material from Andrew Gelman's
book (since he has some radon examples)?

 [Uwe: one reason to chop out previous code/data is that if
one posts via gmane, it complains if you don't have enough 'new
stuff'.  Sigh.]
#
On 29.01.2011 19:27, Ben Bolker wrote:
Well, then the answer seems to be "don't use gmane" if it does restrict 
its users in such a way. Looks like I am too old fashioned ....

Best,
Uwe