fitMarkovChain | R Documentation |
This function fits a list of clickstreams to a Markov chain. Zero-order,
first-order as well as higher-order Markov chains are supported. For
estimating higher-order Markov chains this function solves the following
linear or quadratic programming problem:
\min ||\sum_{i=1}^k X-\lambda_i
Q_iX||
\mathrm{s.t.}
\sum_{i=1}^k \lambda_i = 1
\lambda_i \ge
0
The distribution of states is given as X
.
\lambda_i
is the lag parameter for lag i
and Q_i
the
transition matrix.
fitMarkovChain(clickstreamList, order = 1, verbose = TRUE, control = list())
clickstreamList |
A list of clickstreams for which a Markov chain is fitted. |
order |
(Optional) The order of the Markov chain that is fitted from
the clickstreams. Per default, Markov chains with |
verbose |
(Optional) An optimal logical variable to indicate whether warnings and infos should be printed. |
control |
(Optional) The control list of optimization parameters. Parameter
|
For solving the quadratic programming problem of higher-order Markov chains,
an augmented Lagrange multiplier method from the package
Rsolnp
is used.
Returns a MarkovChain
object.
At least half of the clickstreams need to consist of as many clicks as the order of the Markov chain that should be fitted.
Michael Scholz michael.scholz@th-deg.de
This method implements the parameter estimation method presented in Ching, W.-K. et al.: Markov Chains – Models, Algorithms and Applications, 2nd edition, Springer, 2013.
MarkovChain
,
Rsolnp
# fitting a simple Markov chain
clickstreams <- c("User1,h,c,c,p,c,h,c,p,p,c,p,p,o",
"User2,i,c,i,c,c,c,d",
"User3,h,i,c,i,c,p,c,c,p,c,c,i,d",
"User4,c,c,p,c,d",
"User5,h,c,c,p,p,c,p,p,p,i,p,o",
"User6,i,h,c,c,p,p,c,p,c,d")
cls <- as.clickstreams(clickstreams, header = TRUE)
mc <- fitMarkovChain(cls)
show(mc)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.