[R] error statement: missing value where TRUE/FALSE needed

Michael Curran mpc46 at cam.ac.uk
Mon Mar 23 15:38:49 CET 2009


Hi list,

I want to try Gibbs sampling as a method of estimating a markov-switching 
model of a mean-deviating, pth-order autoregressive process with time 
varying transition probabilities via R and am using a code originally 
written by another person; I attach the useful pdf document explaining the 
code. When I run the code, I get an error message:

Error in if (r < vQ[i]) { : missing value where TRUE/FALSE needed

I am using R.2.6.0 on Windows XP. Can anyone tell me what the error message 
means?

The specific line in the code is:

if (r<vQ[i]){ vS[i]=0 } else vS[i]=1 

The code is available at: 
http://www.michael-curran.com/gibbs.html
and the two data sets are available at:
http://www.geocities.jp/atsmatsumoto/ci.txt
and
http://www.geocities.jp/atsmatsumoto/callrate.txt

Note: I saved the first data set as ci.txt and the second as boj.txt and so 
these are the file names that the code loads. If anyone uses the code and 
the data and manages to get it to work, I would gratefully appreciate if 
they could tell me what adjustments they made to the code in order to do 
so.

Kind regards,

Michael
-- 
Michael Curran
Candidate for the MPhil in Economics
Cambridge University
http://www.michael-curran.com/



-------------- next part --------------
A non-text attachment was scrubbed...
Name: gibbsms-1.pdf
Type: application/pdf
Size: 175239 bytes
Desc: gibbsms-1.pdf
URL: <https://stat.ethz.ch/pipermail/r-help/attachments/20090323/5cc81676/attachment-0003.pdf>


More information about the R-help mailing list