Generate (additional) transition probability or rewards variables
mcwr_genvars(
data,
timing = "",
add = FALSE,
replace = FALSE,
nop = FALSE,
nor = FALSE,
order = FALSE
)an mcwr data.frame
a character or numeric scalar.
It specifies how rewards are distributed to from and target states. It is
required if option nor is not used. timespec can be one of ‘bop’, ‘mid’, and ‘eop’, which stands for
‘beginning-of-period’, ‘mid-period’, and ‘end-of period’, respectively. Alternatively, it can also
be a number in the interval [0 1] that specifies the fraction of the interval that goes to the
from-state. Values of 0, 0.5, and 1 correspond to ‘beginning-of-period’, ‘mid-period’, and
‘end-of-period’, respectively.
a boolean TRUE/FALSE. If TRUE, existing r-variables are left unchanged.
add a boolean TRUE/FALSE. If TRUE, existing r-variables are replaced.
a boolean TRUE/FALSE. If TRUE, not generate any p-variables.
By default, all missing p-variables are generated. Since existing
p-variables must satisfy the sums-to-unity condition, only p-variables that are (by implication)
all-zero can be missing. mcwr_expectancies() will run whether such redundant variables exist or not.
a boolean TRUE/FALSE. If TRUE, does not generate any r-variables.
a boolean TRUE/FALSE. If TRUE, orders variables alphabetically according to the column list 'age p* r*'.
A data.frame, suitable for further processing by mcwr_*() functions.
The main purpose of this function is to generate rewards variables (r-variables). It examines existing p- and r-variables, determines the implied full set of states, and generates any missing variables that are missing from the data frame. It interacts flexibly with existing r-variables: You can leave them unchanged or have them replaced.
An effective way to create r-variables may be to generate a full set of r-variables using mcwr_genvars() and
then edit them where necessary. This is illustrated under in the examples section of mcwr.
Other mcwr:
mcwr_check(),
mcwr_exit(),
mcwr_expectancies(),
mcwr_switch()