- 1、本文档共17页,可阅读全部内容。
- 2、原创力文档(book118)网站文档一经付费(服务费),不意味着购买了该文档的版权,仅供个人/单位学习、研究之用,不得用于商业用途,未经授权,严禁复制、发行、汇编、翻译或者网络传播等,侵权必究。
- 3、本站所有内容均由合作方或网友上传,本站不对文档的完整性、权威性及其观点立场正确性做任何保证或承诺!文档内容仅供研究参考,付费前请自行鉴别。如您付费,意味着您自己接受本站规则且自行承担风险,本站不退款、不进行额外附加服务;查看《如何避免下载的几个坑》。如果您已付费下载过本站文档,您可以点击 这里二次下载。
- 4、如文档侵犯商业秘密、侵犯著作权、侵犯人身权等,请点击“版权申诉”(推荐),也可以打举报电话:400-050-0827(电话支持时间:9:00-18:30)。
查看更多
markovchainCrashIntro
Crash Introduction to markovchain R package
Giorgio Alfredo Spedicato, Ph.D C.Stat ACAS
June 14, 2015
Intro
I The markovchain package (Spedicato 2015) will be introduced.
I The package is intended to provide S4 classes to perform
probabilistic and statistical analysis of Discrete Time Markov
Chains (DTMC). See (Brémaud 1999) for a theoretical review
of the mathematics underlying the DTMC models.
I The vignette will show: how to load the package and create a
DTMC, how to manage a DTMC, how to perform basic
probabilistic analysis, how to fit a DTMC.
I The package is on Cran since Summer 2013.
I It requires a recent version of R (=3.0). Since version 0.2
parts of code have been moved to Rcpp (Eddelbuettel 2013).
I The package won a slot in Google Summer of Code 2015 for
optimizing internals and expanding functionalities.
First moves into the markovchain package
Loading the package
I The package is loaded using
#load the package
library(markovchain)
## Package: markovchain
## Version: 0.2.5
## Date: 2015-06-15
## BugReport: /spedygiorgio/markovchain/issues
Creating a DTMC
I DTMC can be easily create following standard S4 classes
syntax. The show method displays it.
tmA - matrix(c(0,0.5,0.5,.5,0,.5,.5,.5,0),nrow = 3,
byrow = TRUE) #define the transition matrix
dtmcA - new(markovchain,transitionMatrix=tmA,
states=c(a,b,c),
name=MarkovChain A) #create the DTMC
dtmcA
## MarkovChain A
## A 3 - dimensional discrete Markov Chain with following states
## a b c
## The transition matrix (by rows) is defined as follows
## a b c
## a 0.0 0.5 0.5
## b 0.5 0.0 0.5
## c 0.5 0.5 0.0
I Otherwise, it can also be created directly coercing a matrix.
dtmcA2-as(tmA, markovchain) #using coerce from matrix
states(dtmcA2) #note default names assigned to states
## [1] s1 s2 s3
I It is also possible to display a DTMC, using igraph package
(Csardi and Nepusz 2006) capabilities
plot(dtmcA)
0.5
0.5
0.5
a
b
c
Probabilistic analysis
The basic
I It is possible to access transition probabilities and to
您可能关注的文档
- Introducing Instant Messaging and Chat in the Workplace.pdf
- Intrinsic Charm Contribution to Double Quarkonium Hadroproduction.pdf
- introduction copula.pdf
- Introduction Cyclic equation systems Sequential circuits Implementation Example Conclusion.pdf
- Introduction Personalization of Information Services.pdf
- introduction to bow-tie method - dubai.pdf
- Introduction to Career Path of Tester.ppt
- Introduction to Weak Methods in Theorem Proving 13.1 The General Problem.pdf
- Introduction to OpenCV.ppt
- Inventec Hazardous Substance Free (HSF) Management Standard_rev 2.0_Chinese.pdf
文档评论(0)