Re: [R] MH algorithm syntax help

2009-01-19 Thread ekwaters
Well spotted, the b is a muck up (what happens when you are basing stuff on someone else's code). The bit you though might be a dimension mismatch seems to work ok, but the bit that I was worried about from the start doesn't; the reason I have sqrt of var y/ var x is because my posterior is for a

Re: [R] MH algorithm syntax help

2009-01-18 Thread David Winsemius
The comma *before* acc=1 ? I also wondered whether (further up) this should work: s2y[i,]=s2y[i-1] # would think this to result in a dimension mismatch This looks sketchy as well: s2y[i,j] = s2y[b[i-1,j] + rnorm(1,mean=0, sd=s2yscale[j]) ^ ^ ^ # unmatched sqr-brackets It w

[R] MH algorithm syntax help

2009-01-18 Thread ekwaters
Hi all, I am trying to write a random walk metropolis hastings algorithm, I using the latest debian distribution of R. Can anyone tell me what I need to insert in the below code? I have tried putting various combinations of curly brackets and punctuation between the "acc=1" and "if" statements,