[datatable-help] Forward Recursive method

Dandis rana_dandis at yahoo.com
Tue Jun 28 12:24:08 CEST 2016


Hello guys,

I am trying to compute the likelihood for a hidden Markov chain problem
using the forward recursive process, described in the attached pdf,

LikelihoodComputation.pdf
<http://r.789695.n4.nabble.com/file/n4722233/LikelihoodComputation.pdf>  

My goal is to find the parameters beta and mu that will maximize the above
likelihood using R software and the following transition and emission
matrices 


n=3
h=0.1
x=matrix(data=NA, nrow=n+1, ncol=n+1)      # x is the transition matrix
for(i in 0:n){
  for(j in 0:n){
    if(i==j){ x[i+1,j+1] = 1-beta*j*(n-j)*h-mu*j*h}
    else{
      if(j==i+1){x[i+1,j+1] = beta*j*(n-j)*h}
      else{
        if(j==i-1){ x[i+1,j+1] = j*mu*h}
        else{x[i+1,j+1] =0}
      }}}}
x

E=matrix(data=NA, nrow=n+1, ncol=n+1) # the emission matrix 
for(i in 0:n){
  for(j in 0:n){
    E[i+1,j+1]=dbinom(j, size=i, prob=0.59) }}
E

Can you please help me to program this using R , or just give me a hint how
to start!


Thanks in advance,

Dandis






--
View this message in context: http://r.789695.n4.nabble.com/Forward-Recursive-method-tp4722233.html
Sent from the datatable-help mailing list archive at Nabble.com.


More information about the datatable-help mailing list