File: expmMC.Rd

package info (click to toggle)
r-cran-ctmcd 1.4.1-2
  • links: PTS, VCS
  • area: main
  • in suites: bullseye, sid
  • size: 1,384 kB
  • sloc: cpp: 183; ansic: 19; makefile: 2
file content (62 lines) | stat: -rw-r--r-- 1,491 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
\name{expmMC}
\alias{expmMC}
%- Also NEED an '\alias' for EACH other topic documented here.
\title{
Matrix Exponential Function
}
\description{
Computation of the matrix exponential and interface to the markovchain package
}
\usage{
expmMC(gm, t, method = "PadeRBS", order = 8)
}
%- maybe also 'usage' for other objects documented here.
\arguments{
  \item{gm}{
generator matrix (either gm or matrix object)
}
  \item{t}{
time horizon
}
  \item{method}{
method to compute the matrix exponential, see expm for details
}
  \item{order}{
order for Pade or Taylor method, see expm for details
}
}
\details{
An interface to the markovchain package is provided so that the resulting transition matrices are returned as markovchain objects and can be further processed in the markovchain package, e.g., visualized (see example below).
}

\references{
G. A. Spedicato: Discrete Time Markov Chains with R. The R Journal (To Appear), 2017
}
\author{
G. A. Spedicato, M. Pfeuffer
}


%% ~Make other sections like Warning with \section{Warning }{....} ~

\seealso{
\code{\link{expm}}
}
\examples{
### Exemplary Transition Matrix
tm0=matrix(1:16,4,4)
tm0=tm0/rowSums(tm0)
tm0[4,]=c(0,0,0,1)

### Generator Matrix Estimate
gm_est=gm(tm0,te=1,method="DA")
gm_est

### Matrix Exponential and Conversion to markovchain object 
### (markovchain package needs to be installed)
mc=expmMC(gm_est,.5)
if(require("markovchain")==TRUE){
  plot(mc)
}
}