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
--
View this message in context:
http://r.789695.n4.nabble.com/Multilevel-tp3246190p3246190.html
Sent from the R help mailing list archive at Nabble.com.
On 29.01.2011 15:06, martanair wrote:> > 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)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.> plot (radon.bugs.1) # to get a plot similar to Figure 16.13. What is 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)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 trovatoThis 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> > Anybody can help me? > Thanks > Marta
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)
}
--
View this message in context:
http://r.789695.n4.nabble.com/Multilevel-tp3246190p3246361.html
Sent from the R help mailing list archive at Nabble.com.