[R] package R2WinBUGS question; was: Multilevel

Ben Bolker bbolker at gmail.com
Sat Jan 29 19:27:57 CET 2011


Uwe Ligges <ligges <at> statistik.tu-dortmund.de> writes:

> On 29.01.2011 15:06, martanair wrote:

  [snip]

> > 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")

[snip]

> >   # with 500 iterations
> > radon.bugs.1<- bugs (radon.data, radon.inits, radon.parameters,
> > "radon.1.bug",
> >      n.chains=3, n.iter=500)
> 
> We still do not have radon1.bug.
> 
> > 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

  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.]



More information about the R-help mailing list