mcwr_genvars {mcwr}R Documentation

Generate mcwr variables

Description

Generate (additional) transition probability or rewards variables

Usage

mcwr_genvars(
  data,
  timing = "",
  add = FALSE,
  replace = FALSE,
  nop = FALSE,
  nor = FALSE,
  order = FALSE
)

Arguments

data

an mcwr data.frame

timing

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.

add

a boolean TRUE/FALSE. If TRUE, existing r-variables are left unchanged.

replace

add a boolean TRUE/FALSE. If TRUE, existing r-variables are replaced.

nop

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.

nor

a boolean TRUE/FALSE. If TRUE, does not generate any r-variables.

order

a boolean TRUE/FALSE. If TRUE, orders variables alphabetically according to the column list 'age p* r*'.

Details

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.

Value

A data.frame, suitable for further processing by mcwr_*() functions.

See Also

Other mcwr: mcwr_check(), mcwr_exit(), mcwr_expectancies(), mcwr_switch()


[Package mcwr version 1.0.0 Index]