markov | R Documentation |
A function to estimate probability or transition matrices.
markov(data, stateVars, n.states, stateNames=NULL,
discretized=FALSE, pool=FALSE, std=FALSE,
balanced=TRUE)
initState(data, stateVars, n.states, stateNames=NULL,
discretized=FALSE, pool=FALSE, std=FALSE,
balanced=TRUE)
data |
A data frame arranged in such a way that there is one row per observation, and one column recording the state of each observation, with as many columns as time periods. |
stateVars |
The columns in the data frame which describe the temporal evolution of the variable of interest (one column per year). |
n.states |
The number of states to be assumed for the Markov process (equals the number of rows and columns of the estimated transition matrix). |
stateNames |
The names to be given to the states of the Markov process. |
discretized |
Is the data already discretized? (Default: |
pool |
If |
std |
Should the data be standardized? If |
balanced |
Is the panel data set balanced? If the panel is unbalanced, then set |
The function 'markov
' returns a classic transition markov matrix. The function
'initStates
' retrieves the initial states of the markov process
An object of class 'markov
' containing the following items:
t |
A matrix of transition counts. |
p |
A probability matrix. The rows of this matrix sum to one. |
If pool=TRUE
, it is recommended to set std=TRUE
.
Osmar Leandro Loaiza Quintero
Restrepo, Patricia; Franco, Rosa and Munoz, Luz (2010). Algebra Lineal con Aplicaciones, Universidad Nacional de Colombia, Medellin.
steadyState, mfpt, spMarkov
data(usinc)
stateVars<-names(usinc[,7:87])
stateNames<-c('Poor','Lower','Middle','Upper','Rich')
M<-markov(usinc, stateVars=stateVars,n.states=5,stateNames=stateNames)
M$t;M$p
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.