Skip to contents

This function takes functional categorical curve as input and transform it into as many indicator curves as the number of state input return DATAFRAME Works even on dataframe without time condition respected (same start and end) This function sort the states by ascending order (if numeric) and put the name 'state_X' as the column of the output concerning the 'X' state. This function will also work with character states. Now for the different lists, the ith element of a list concern the ith states ordered.

Usage

state_indicator(data, id_col = "id", time_col = "time")

Arguments

data

a multistates dataframe ('id', 'time', 'states')

id_col

a character for the id column, default 'id'

time_col

a character for the time column, default 'time'

Value

a dataframe with columns ('id', 'time', list of states_XX)

Author

Francois Bassac

Examples

N_states = 3
lambdas = lambda_determination(N_states)
transition_df = transfer_probabilities(N_states)

df = generate_X_df_multistates(nind = 100, N_states, start=0, end=100,
lambdas, transition_df)

si_df = state_indicator(df, id_col='id',
time_col='time')