SlideShare a Scribd company logo
1 of 6
> library(expm)
> initial <- c(0.1,0.2,0,0.4,0.3)
> T <- seq(0.01,2,by= 0.01)
> Q <- cbind(c(-3,3,0, 0, 0), c(2, -5, 3, 0, 0),c(0, 4, -7, 3, 0), c(0, 0, 4, -7, 3), c(0, 0, 0, 4, -4))
> store <- matrix (0,201,5)
> store[1,] <- initial
> Q1 <- 0
>
> for(i in 2:201){
+ Q1 <- 0.01*(i-1)*Q
+ eQt<- expm(Q1)
+ store[i,] <- initial%*%eQt
+ }
>
> plot(c(0,T),store[,1],main="Probabilitiesforstate 0",xlab="T",ylab="")
>
> plot(c(0,T),store[,2],main="Probabilitiesforstate 1",xlab="T",ylab="")
>
>
> plot(c(0,T),store[,3],main="Probabilitiesforstate 2",xlab="T",ylab="")
> plot(c(0,T),store[,4],main="Probabilitiesforstate 3",xlab="T",ylab="")
>
>
> plot(c(0,T),store[,5],main="Probabilitiesforstate 4",xlab="T",ylab="")
0.0 0.5 1.0 1.5 2.0
0.100.120.140.160.18
Probabilities for state 0
T
0.0 0.5 1.0 1.5 2.0
0.150.160.170.180.190.20
Probabilities for state 1
T
0.0 0.5 1.0 1.5 2.0
0.000.050.100.15
Probabilities for state 2
T
0.0 0.5 1.0 1.5 2.0
0.200.250.300.350.40
Probabilities for state 3
T
0.0 0.5 1.0 1.5 2.0
0.200.220.240.260.280.30
Probabilities for state 4
T

More Related Content

What's hot

Reverse Engineering: C++ "for" operator
Reverse Engineering: C++ "for" operatorReverse Engineering: C++ "for" operator
Reverse Engineering: C++ "for" operatorerithion
 
מודלים חישוביים - תרגול מס 2 - אוניברסיטת חיפה
   מודלים חישוביים - תרגול מס 2 - אוניברסיטת חיפה    מודלים חישוביים - תרגול מס 2 - אוניברסיטת חיפה
מודלים חישוביים - תרגול מס 2 - אוניברסיטת חיפה Igor Kleiner
 
Bolashak sertificate.PDF
Bolashak sertificate.PDFBolashak sertificate.PDF
Bolashak sertificate.PDFMeiram Shakenov
 
Hotel revenue management Ecornell certificate
Hotel revenue management Ecornell certificateHotel revenue management Ecornell certificate
Hotel revenue management Ecornell certificateJulien A. Péchey
 
Emo-Exploitation
Emo-ExploitationEmo-Exploitation
Emo-Exploitationw0nd
 
Advance Engineering Mathematics
Advance Engineering MathematicsAdvance Engineering Mathematics
Advance Engineering MathematicsPrasenjitRathore
 
The Ring programming language version 1.5.2 book - Part 51 of 181
The Ring programming language version 1.5.2 book - Part 51 of 181The Ring programming language version 1.5.2 book - Part 51 of 181
The Ring programming language version 1.5.2 book - Part 51 of 181Mahmoud Samir Fayed
 
SARAWAK 4X4 JAMBOREE 2016
SARAWAK 4X4 JAMBOREE 2016SARAWAK 4X4 JAMBOREE 2016
SARAWAK 4X4 JAMBOREE 2016Leona Chin
 
Solutions manual for operations research an introduction 10th edition by taha...
Solutions manual for operations research an introduction 10th edition by taha...Solutions manual for operations research an introduction 10th edition by taha...
Solutions manual for operations research an introduction 10th edition by taha...ricmka
 
Rd sharma class 10 solutions some applications of trigonometry
Rd sharma class 10 solutions some applications of trigonometryRd sharma class 10 solutions some applications of trigonometry
Rd sharma class 10 solutions some applications of trigonometrygyanpub
 
A Taste of Python - Devdays Toronto 2009
A Taste of Python - Devdays Toronto 2009A Taste of Python - Devdays Toronto 2009
A Taste of Python - Devdays Toronto 2009Jordan Baker
 
Hangman Game Programming in C (coding)
Hangman Game Programming in C (coding)Hangman Game Programming in C (coding)
Hangman Game Programming in C (coding)hasan0812
 
A simple snake game project
A simple snake game projectA simple snake game project
A simple snake game projectAmit Kumar
 

What's hot (17)

cwit-poster_logo
cwit-poster_logocwit-poster_logo
cwit-poster_logo
 
Reverse Engineering: C++ "for" operator
Reverse Engineering: C++ "for" operatorReverse Engineering: C++ "for" operator
Reverse Engineering: C++ "for" operator
 
What is recursion?
What is recursion? What is recursion?
What is recursion?
 
מודלים חישוביים - תרגול מס 2 - אוניברסיטת חיפה
   מודלים חישוביים - תרגול מס 2 - אוניברסיטת חיפה    מודלים חישוביים - תרגול מס 2 - אוניברסיטת חיפה
מודלים חישוביים - תרגול מס 2 - אוניברסיטת חיפה
 
Bolashak sertificate.PDF
Bolashak sertificate.PDFBolashak sertificate.PDF
Bolashak sertificate.PDF
 
Hotel revenue management Ecornell certificate
Hotel revenue management Ecornell certificateHotel revenue management Ecornell certificate
Hotel revenue management Ecornell certificate
 
Emo-Exploitation
Emo-ExploitationEmo-Exploitation
Emo-Exploitation
 
Problemas de Arreglos en c++
Problemas de Arreglos en c++Problemas de Arreglos en c++
Problemas de Arreglos en c++
 
Advance Engineering Mathematics
Advance Engineering MathematicsAdvance Engineering Mathematics
Advance Engineering Mathematics
 
Vcs28
Vcs28Vcs28
Vcs28
 
The Ring programming language version 1.5.2 book - Part 51 of 181
The Ring programming language version 1.5.2 book - Part 51 of 181The Ring programming language version 1.5.2 book - Part 51 of 181
The Ring programming language version 1.5.2 book - Part 51 of 181
 
SARAWAK 4X4 JAMBOREE 2016
SARAWAK 4X4 JAMBOREE 2016SARAWAK 4X4 JAMBOREE 2016
SARAWAK 4X4 JAMBOREE 2016
 
Solutions manual for operations research an introduction 10th edition by taha...
Solutions manual for operations research an introduction 10th edition by taha...Solutions manual for operations research an introduction 10th edition by taha...
Solutions manual for operations research an introduction 10th edition by taha...
 
Rd sharma class 10 solutions some applications of trigonometry
Rd sharma class 10 solutions some applications of trigonometryRd sharma class 10 solutions some applications of trigonometry
Rd sharma class 10 solutions some applications of trigonometry
 
A Taste of Python - Devdays Toronto 2009
A Taste of Python - Devdays Toronto 2009A Taste of Python - Devdays Toronto 2009
A Taste of Python - Devdays Toronto 2009
 
Hangman Game Programming in C (coding)
Hangman Game Programming in C (coding)Hangman Game Programming in C (coding)
Hangman Game Programming in C (coding)
 
A simple snake game project
A simple snake game projectA simple snake game project
A simple snake game project
 

Viewers also liked

Viewers also liked (13)

JAMES WAMBUGU - CV updated Jan 2015
JAMES WAMBUGU - CV updated Jan 2015JAMES WAMBUGU - CV updated Jan 2015
JAMES WAMBUGU - CV updated Jan 2015
 
Hamsters
HamstersHamsters
Hamsters
 
IKLAN MAJALAH HIDAYATULLAH EDISI FEBRUARI 2016
IKLAN MAJALAH HIDAYATULLAH EDISI FEBRUARI 2016IKLAN MAJALAH HIDAYATULLAH EDISI FEBRUARI 2016
IKLAN MAJALAH HIDAYATULLAH EDISI FEBRUARI 2016
 
Giá thành cty xây dựng
Giá thành cty xây dựngGiá thành cty xây dựng
Giá thành cty xây dựng
 
Hamsters
HamstersHamsters
Hamsters
 
Dadaismo
DadaismoDadaismo
Dadaismo
 
Hamsters
HamstersHamsters
Hamsters
 
COLOR CORAL
COLOR CORALCOLOR CORAL
COLOR CORAL
 
STAR ENERGY
STAR ENERGYSTAR ENERGY
STAR ENERGY
 
ninda ctvkt
ninda ctvktninda ctvkt
ninda ctvkt
 
Maintenance Manager
Maintenance ManagerMaintenance Manager
Maintenance Manager
 
CV 7TH SEM
CV 7TH SEMCV 7TH SEM
CV 7TH SEM
 
Xi bab vi pergaulan remaja kristen
Xi bab vi pergaulan remaja kristenXi bab vi pergaulan remaja kristen
Xi bab vi pergaulan remaja kristen
 

Similar to Markov Chain Probabilities

Haskellで学ぶ関数型言語
Haskellで学ぶ関数型言語Haskellで学ぶ関数型言語
Haskellで学ぶ関数型言語ikdysfm
 
The Ring programming language version 1.2 book - Part 25 of 84
The Ring programming language version 1.2 book - Part 25 of 84The Ring programming language version 1.2 book - Part 25 of 84
The Ring programming language version 1.2 book - Part 25 of 84Mahmoud Samir Fayed
 
Optimization and Mathematical Programming in R and ROI - R Optimization Infra...
Optimization and Mathematical Programming in R and ROI - R Optimization Infra...Optimization and Mathematical Programming in R and ROI - R Optimization Infra...
Optimization and Mathematical Programming in R and ROI - R Optimization Infra...Dr. Volkan OBAN
 
統計的学習の基礎 4章 前半
統計的学習の基礎 4章 前半統計的学習の基礎 4章 前半
統計的学習の基礎 4章 前半Ken'ichi Matsui
 

Similar to Markov Chain Probabilities (8)

Computer Programming- Lecture 9
Computer Programming- Lecture 9Computer Programming- Lecture 9
Computer Programming- Lecture 9
 
Tuple in python
Tuple in pythonTuple in python
Tuple in python
 
Haskellで学ぶ関数型言語
Haskellで学ぶ関数型言語Haskellで学ぶ関数型言語
Haskellで学ぶ関数型言語
 
C programs
C programsC programs
C programs
 
The Ring programming language version 1.2 book - Part 25 of 84
The Ring programming language version 1.2 book - Part 25 of 84The Ring programming language version 1.2 book - Part 25 of 84
The Ring programming language version 1.2 book - Part 25 of 84
 
R for you
R for youR for you
R for you
 
Optimization and Mathematical Programming in R and ROI - R Optimization Infra...
Optimization and Mathematical Programming in R and ROI - R Optimization Infra...Optimization and Mathematical Programming in R and ROI - R Optimization Infra...
Optimization and Mathematical Programming in R and ROI - R Optimization Infra...
 
統計的学習の基礎 4章 前半
統計的学習の基礎 4章 前半統計的学習の基礎 4章 前半
統計的学習の基礎 4章 前半
 

Markov Chain Probabilities

  • 1. > library(expm) > initial <- c(0.1,0.2,0,0.4,0.3) > T <- seq(0.01,2,by= 0.01) > Q <- cbind(c(-3,3,0, 0, 0), c(2, -5, 3, 0, 0),c(0, 4, -7, 3, 0), c(0, 0, 4, -7, 3), c(0, 0, 0, 4, -4)) > store <- matrix (0,201,5) > store[1,] <- initial > Q1 <- 0 > > for(i in 2:201){ + Q1 <- 0.01*(i-1)*Q + eQt<- expm(Q1) + store[i,] <- initial%*%eQt + } > > plot(c(0,T),store[,1],main="Probabilitiesforstate 0",xlab="T",ylab="") > > plot(c(0,T),store[,2],main="Probabilitiesforstate 1",xlab="T",ylab="") > > > plot(c(0,T),store[,3],main="Probabilitiesforstate 2",xlab="T",ylab="") > plot(c(0,T),store[,4],main="Probabilitiesforstate 3",xlab="T",ylab="") > > > plot(c(0,T),store[,5],main="Probabilitiesforstate 4",xlab="T",ylab="")
  • 2. 0.0 0.5 1.0 1.5 2.0 0.100.120.140.160.18 Probabilities for state 0 T
  • 3. 0.0 0.5 1.0 1.5 2.0 0.150.160.170.180.190.20 Probabilities for state 1 T
  • 4. 0.0 0.5 1.0 1.5 2.0 0.000.050.100.15 Probabilities for state 2 T
  • 5. 0.0 0.5 1.0 1.5 2.0 0.200.250.300.350.40 Probabilities for state 3 T
  • 6. 0.0 0.5 1.0 1.5 2.0 0.200.220.240.260.280.30 Probabilities for state 4 T