Summary of Statistics
All Survival Stats: health_stats
A combination of all the statistics. For static and trend models, if transition probabilities are provided, then one simulation is run and all the statistics are calculated from that simulation (this is to keep results consistent). For frailty model, 'n' number of simulations are performed from which the statistics are calculated.
The function returns all the information (mean and variance of each statistic) as a dataframe.
health_stats(model_type, n_states, init_age, init_state, trans_probs, simulated_path, female, year, wave_index, latent, param_file, n = 1000)
Parameters:
model_type : character
'S' for static model, 'T' for trend model, 'F' for frailty model
n_states : numeric
take values 3 or 5, use 3 for 3-state model, and 5 for 5-state model
init_age : numeric
numeric denoting initial age of indiviudal
init_state : numeric
initial state of individual: 0 for healthy, 1 for disabled
trans_probs : list
list of transition probability matrices, only needed for static and trend models.
simulated_path : matrix
matrix containing life path simulations, only needed for static and trend models.
female : numeric
0 for male, 1 for female, compulsory variable for frailty model
year : numeric
numeric denoting current year, compulsory variable for frailty model
wave_index : numeric
integer for the wave index = (interview year - 1998)/2 + 1, required in 5-state model and ignored in 3-state model
latent : numeric
initial value of latent factor, normally take the value 0
param_file : character OR dataframe/tibble
File path, or dataframe/tibble of parameters (generally, use US_HRS or china_CLHLS), compulsory variable for frailty model
n : numeric
numeric denoting number of unique latent factor simulations
Returns:
Mean and variance of all statistics
Usage:
# 3 state trend model
trans_probs_3state=get_trans_probs(n_states=3, model_type = 'T', param_file = US_HRS, init_age = 65, female = 0, year = 2022, wave_index = 13, latent = 0)
health_stats(model_type = 'T', n_states=3, init_age=65, init_state=0, trans_probs=trans_probs_3state)
# 3 state frailty model
health_stats(model_type = 'F', n_states=3, init_age=65, init_state=0, trans_probs= NULL , simulated_path = NULL, female = 0, year = 2022, wave_index = 13, latent = 0, param_file = US_HRS)
# 5 state trend model
trans_probs_5state=get_trans_probs(n_states=5, model_type = 'T', param_file = US_HRS_5, init_age = 65, female = 0, year = 2022, wave_index = 13, latent = 0)
health_stats(model_type = 'T', n_states=5, init_age=65, init_state=0, trans_probs=trans_probs_5state)
# 5 state frailty model
health_stats(model_type = 'F', n_states=5, init_age=65, init_state=0, trans_probs= NULL , simulated_path = NULL, female = 0, year = 2022, wave_index = 13, latent = 0, param_file = US_HRS_5)