[R] Limiting state probability for Markov chain

Justin USHIZE RUTIKANGA justinushize at aims.ac.za
Tue Apr 28 08:52:24 CEST 2015


Dear All,

I am trying to determine  the liming state probability  .
my_fun<-function(A,b){
for (j in 1:3){
x<-A;
while ((sum(x[j,]) ==1) )
{
  x <- x%*%x;
  print (x);
  if ( b%*%x==b)
  {
    break;
  }}}
}
A<-rbind(c(.5,.3,.2), c(.3,.3,.4),c(.1,.5,.4))
b <- matrix(data=c(1,0,0), nrow=1, ncol=3, byrow=FALSE)
my_fun(A,b)

I got the  following warning
1: In if (b %*% x == b) { :
  the condition has length > 1 and only the first element will be used
2: In if (b %*% x == b) { :
  the condition has length > 1 and only the first element will be used
3: In if (b %*% x == b) { :
  the condition has length > 1 and only the first element will be used
4: In if (b %*% x == b) { :
  the condition has length > 1 and only the first element will be used
5: In if (b %*% x == b) { :
  the condition has length > 1 and only the first element will be used
6: In if (b %*% x == b) { :
  the condition has length > 1 and only the first element will be used
7: In if (b %*% x == b) { :
  the condition has length > 1 and only the first element will be used
8: In if (b %*% x == b) { :
  the condition has length > 1 and only the first element will be used
9: In if (b %*% x == b) { :
  the condition has length > 1 and only the first element will be used
your help will be appreciate

Best Regard
Ushize Rutikanga Justin
Student at African Institute for Mathematical Sciences (AIMS) South Africa
E-mail:justinushize at aims.ac.za
Tel:+27717029144

	[[alternative HTML version deleted]]



More information about the R-help mailing list