[S] MCMC error message:2

Xu Fan (fan@stat.cmu.edu)
Sun, 10 May 1998 16:18:05 -0400 (EDT)


Several people pointed that it is due to smallness of lik thus
S thinks 0/0 is NA.

A continuation: when I ran the MCMC loop again. It stops exactly at the
same step number. Any explanation?

On Sat, 9 May 1998, Xu Fan wrote:

> The MCMC (an iterational simulation) breaks with error message (see below).
> Can anyone tell me the reason?
>
> #1 error message
> #2 codes
>
> #1 error message
> 31962
> 31963
> 31964
> 31965
> Error: Missing value where logical needed: if(r > u) {
> Beta[, i + 1] <- candidate
> . . .
>
>
> #2 codes
> date()
>
> # MCMC for Beta
> date()
>
> N <- 100000
> options(object.size=1e8)
> Beta <- matrix(0, 10, N)
> sigma <- 0.5
> accept <- rep(0, N)
>
>
> for (i in 1:(N-1)){
> candidate <- rnorm(10, Beta[,i], sigma)
> r <- lik(choice.1, candidate) / lik(choice.1, Beta[,i])
>
> u <- runif(1)
>
> if (r > u){
> Beta[,i+1] <- candidate
> accept[i] <- 1
> }
> else
> Beta[,i+1] <- Beta[,i]
>
> cat(i, "\n")
> }
>
> date()
>
> -----------------------------------------------------------------------
> This message was distributed by s-news@wubios.wustl.edu. To unsubscribe
> send e-mail to s-news-request@wubios.wustl.edu with the BODY of the
> message: unsubscribe s-news
>

-----------------------------------------------------------------------
This message was distributed by s-news@wubios.wustl.edu. To unsubscribe
send e-mail to s-news-request@wubios.wustl.edu with the BODY of the
message: unsubscribe s-news