pr                package:hmm.discnp                R Documentation

_P_r_o_b_a_b_i_l_i_t_y _o_f _s_t_a_t_e _s_e_q_u_e_n_c_e_s.

_D_e_s_c_r_i_p_t_i_o_n:

     Calculates the conditional probability of one or more state
     sequences, given the corresponding observations sequences (and the
     model parameters.

_U_s_a_g_e:

     pr(s,y,object=NULL,tpm,Rho,ispd=NULL)

_A_r_g_u_m_e_n_t_s:

       s: A sequence of states of the underlying Markov chain, or a
          list of such sequences. 

       y: A sequence of observations from a hidden Markov model,
          corresponding to the state sequence 's', or a list of such
          sequences corresponding to the state sequences in the list
          's'. If 'y' is missing, it is extracted from 'object'
          provided that 'object' and its 'y' component are not 'NULL'. 
          Otherwise an error is given. 

  object: An object of class 'hmm.discnp' as returned by 'hmm()'. 

     tpm: The transition probability matrix of the chain.  Ignored (and
          extracted from 'object' instead) if 'object' is not 'NULL'. 

     Rho: The matrix of probabilities specifying the distribution of
          the observations, given the underlying state.  The rows of
          this matrix correspond to the possible values of the
          observations, the columns to the states.  Ignored (and
          extracted from 'object' instead) if 'object' is not 'NULL'. 

    ispd: The vector specifying the initial state probability
          distribution of the Markov chain.  Ignored (and extracted
          from 'object' instead) if 'object' is not 'NULL'.  If both
          'ispd' and 'object' are NULL then 'ispd' is taken to be the
          stationary distribution of the chain, calculated from 'tpm'. 

_V_a_l_u_e:

     The probability of 's' given 'y', or a vector of such
     probabilities if 's' and 'y' are lists.

_W_a_r_n_i_n_g:

     The conditional probabilities will be tiny if the sequences
     involved are of any substantial length.  Underflow may be a
     problem.  The implementation of the calculations is not
     sophisticated.

_A_u_t_h_o_r(_s):

     Rolf Turner r.turner@auckland.ac.nz
      <URL: http://www.math.unb.ca/~rolf>

_S_e_e _A_l_s_o:

     'hmm()', 'mps()', 'viterbi()', 'pr()', 'fitted.hmm.discnp()'

_E_x_a_m_p_l_e_s:

     # See the help for sim.hmm() for how to generate y.num.
     ## Not run: 
     fit.num <- hmm(y.num,K=2,verb=TRUE)
     # Using fitted parmeters.
     s.vit.1   <- viterbi(y.num,fit.num)
     pr.vit.1  <- pr(s.vit.1,object=fit.num)
     # Using true parameters from which y.num was generated.
     s.vit.2   <- viterbi(y.num,tpm=P,Rho=R)
     pr.vit.2  <- pr(s.vit.2,y.num,tpm=P,Rho=R)
     ## End(Not run)

