Hi
r-help-bounces at r-project.org napsal dne 23.03.2009 15:38:49:
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 error message means that there is missing value instead of logical
when you are calling if
a<-NA
b<-1
a<b
[1] NA
if(a<b) print("No.way")
Error in if (a < b) print("No.way") :
missing value where TRUE/FALSE needed
a<-0
if(a<b) print("No.way")
[1] "No.way"
So test r and vQ if they contain missing values or change your code
Besides, it looks like code written in Basic not in R
Few other comments
* read.table() already produce data frame
* This is really strange, I did not see such construction yet
[,1] [,2] [,3] [,4]
[1,] 100 0 0 0
[2,] 0 100 0 0
[3,] 0 0 100 0
[4,] 0 0 0 100
* Better upgrade to 2.8.1, or maybe wait about a month for 2.9.0
* I do not think that somebody will go through whole your code, it is
terribly complicated.
Regards
Petr
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/
[p??loha gibbsms-1.pdf odstran?na u?ivatelem Petr PIKAL/CTCAP]