get_kernel {dsmmR} | R Documentation |
Obtain the Drifting semi-Markov kernel
Description
This is a generic method that computes and returns the drifting semi-Markov kernel.
Usage
get_kernel(obj, t, u, v, l, klim = 100)
Arguments
obj |
An object that inherits from the S3
classes |
t |
Optional, but recommended. Positive integer specifying
the instance |
u |
Optional. Can be either of the two options below:
|
v |
Optional. Can be either of the two options below:
|
l |
Optional. Positive integer specifying the sojourn time |
klim |
Optional. Positive integer. Used only when A larger value will result in a considerably larger
kernel, which has dimensions of |
Details
The drifting semi-Markov kernel is given as the probability that,
given at the instance the previous state
is
, the next state state
will be reached
with a sojourn time of
:
where is the model size, defined as the length of the embedded
Markov chain
minus the last state,
is the visited state at the instant
and
is the sojourn time of the state
.
Specifically, it is given as the sum of a linear combination:
where are
polynomials with degree
that satisfy certain conditions (see dsmmR) and
are
semi-Markov kernels.
Three possible model specifications are described below.
We will use the exponentials
to distinguish between
the drifting semi-Markov kernel
and the
semi-Markov kernels
used in
Model 1, Model 2 and Model 3.
Model 1
In this case, both and
are "drifting" between
fixed points of the model, hence the "drifting" in drifting semi-Markov
models. Therefore, the semi-Markov kernels
are
equal to:
where for we have
Markov Transition
matrices
, and
sojourn time
distributions
, where
is the
polynomial degree.
Thus, the drifting semi-Markov kernel will be equal to:
Model 2
In this case, is drifting and
is not drifting.
Therefore, the semi-Markov kernels
are
equal to:
Thus, the drifting semi-Markov kernel will be equal to:
Model 3
In this case, is drifting and
is not drifting.
Therefore, the semi-Markov kernels
are now described as:
Thus, the drifting semi-Markov kernel will be equal to:
Value
An array with dimensions of
, giving the
value of the drifting semi-Markov kernel
for
the corresponding
. If any of
or
are
specified, we obtain the element of the array for their given value.
See Also
For the objects required to calculate this kernel: fit_dsmm, parametric_dsmm, nonparametric_dsmm.
For sequence simulation through this kernel: simulate.dsmm.
For the theoretical background of drifting semi-Markov models: dsmmR.
Examples
# Setup.
states <- c("Rouen", "Bucharest", "Samos", "Aigio", "Marseille")
emc <- create_sequence(states, probs = c(0.3, 0.1, 0.1, 0.3, 0.2))
obj_model_2 <- fit_dsmm(
sequence = emc,
states = states,
degree = 3,
f_is_drifting = FALSE,
p_is_drifting = TRUE
)
# Get the kernel.
kernel_model_2 <- get_kernel(obj_model_2)
cat(paste0("If no further arguments are made, kernel has dimensions ",
"for all u, v, l, t:\n",
"(s, s, k_max, n + 1) = (",
paste(dim(kernel_model_2), collapse = ", "), ")"))
# Specifying `t`.
kernel_model_2_t <- get_kernel(obj_model_2, t = 100)
# kernel_model_2_t[ , , , t = 100]
cat(paste0("If we specify t, the kernel has dimensions for ",
"all the remaining u, v, l:\n(s, s, k_max) = (",
paste(dim(kernel_model_2_t), collapse = ", "), ")"))
# Specifying `t` and `u`.
kernel_model_2_tu <- get_kernel(obj_model_2, t = 2, u = "Aigio")
# kernel_model_2_tu["Aigio", , , t = 2]
cat(paste0("If we specify t and u, the kernel has dimensions for ",
"all the remaining v, l:\n(s, k_max) = (",
paste(dim(kernel_model_2_tu), collapse = ", "), ")"))
# Specifying `t`, `u` and `v`.
kernel_model_2_tuv <- get_kernel(obj_model_2, t = 3,
u = "Rouen", v = "Bucharest")
# kernel_model_2_tuv["Rouen", "Bucharest", , t = 3]
cat(paste0("If we specify t, u and v, the kernel has dimensions ",
"for all l:\n(k_max) = (",
paste(length(kernel_model_2_tuv), collapse = ", "), ")"))
# It is possible to ask for any valid combination of `u`, `v`, `l` and `t`.