[R] bugs() ignores my inits

Ben Bolker bolker at ufl.edu
Sat Oct 27 23:16:50 CEST 2007




toby909 wrote:
> 
> Hi All
> 
> I can specify whatever inits, it has no effect on the estimation. I am 
> replicating a textbook example. The result is completely trash, having
> estimates 
> of -58.7 (sd=59.3), where it should be closer to an ml estimate of 0.585
> (SE=0.063).
> 
> The two chains within one run are different, but with different inits for 
> different runs, I get exactly the same chains, and I mean exactly.
> 
> If I set strong (high-precision) priors using the ML estimates, I get the
> result 
> I want. I dont want to set strong priors, but I want to set reasonable
> inits; 
> ones that are not taken by sampling from the prior, but ones that I!
> specify.
> 
> Thanks Toby
> 
> 
> 
> data <- list("n", "n3", "y", "person", "occ")
> 
> model <- function() {
> ...
> }
> write.model(model, "example.txt")
> 
> inits <- list(list(m1=0.585, m2=0.718, m3=0.672, m4=0.639),list(m1=0.585, 
> m2=0.718, m3=0.672, m4=0.639))
> parameters <- c("m1", "m2", "m3", "m4", "sig21", "sig22")
> 
> bugs1 <- bugs(data, inits, parameters, "example.txt", n.chains=2,
> n.iter=15000, 
> clearWD=TRUE, debug=1, DIC=0)
> 
> 
> 
> 
> 
> 
> display(log)
> check(J:/project/ps/code/example.txt)
> model is syntactically correct
> data(J:/project/ps/code/data.txt)
> data loaded
> compile(2)
> model compiled
> inits(1,J:/project/ps/code/inits1.txt)
> this chain contains uninitialized variables
> inits(2,J:/project/ps/code/inits2.txt)
> this chain contains uninitialized variables
> gen.inits()
> initial values generated, model initialized
> thin.updater(15)
> update(500)
> set(m1)
> set(m2)
> set(m3)
> set(m4)
> set(sig21)
> set(sig22)
> update(500)
> coda(*,J:/project/ps/code/coda)
> stats(*)
> [snip]
> 

    I don't see anything obviously wrong, but I have never had this
problem.  Can you (1) post the results of sessionInfo()  [version
of R2WinBUGS, etc]?  and (2) post or send a REPRODUCIBLE example
(full model and data if necessary, preferably a smaller example
that displays the same problem ...)

  cheers
    Ben Bolker

-- 
View this message in context: http://www.nabble.com/bugs%28%29-ignores-my-inits-tf4699977.html#a13447464
Sent from the R help mailing list archive at Nabble.com.



More information about the R-help mailing list