Hi all,
I'm having issues coding a random walk on a fully connected, undirected 
graph G with probability transition matrix P = (p_ij). Here is what I have 
so far ...

for(i in 1:n){
        for(m in 1:M){
                x <- as.vector(matrix(rep(0,N+1),nc=N+1))
                x[1] <- i

                for(k in 2:N+1){
                        y <- as.vector(matrix(rep(0,n),nc=n))
                        r <- runif(1)
                        c <- c(0,cumsum(P[x[k-1],]))

                        for(j in 1:n){
                                y[j] <- (r >= c[j] & r < c[j+1])
                        }
                        x[k] <- which(y == 1)
                }
                L[i,m] <- x[N+1]
        }
}

its giving me the error:

Error in "[<-"(`*tmp*`, k, value = integer(0)) :
        nothing to replace with

no matter what I do I cant fix it ... any suggestions ?
Thanks

Eric Blabac
PhD Student - ASU Dept of Mathematics/Statistics

______________________________________________
[email protected] mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html

Reply via email to