ddhazard(formula, data, model = "logit", by, max_T, id, a_0, Q_0, Q = Q_0, order = 1, control = list(), verbose = F)
"logit"
, "exp_trunc_time_w_jump"
, "exp_trunc_time"
, "exp_bin"
or "exp_combined"
for the discrete time function using the logistic link function in the first case or for the continuous time model with different estimation method in the four latter cases (see the ddhazard for details on the methods)static_glm
)TRUE
if you want status messages during executionfahrmeier_94
. The list contains:
formula |
The passed formula |
state_vecs |
2D matrix with the estimated state vectors (regression parameters) in each bin |
state_vars |
3D array with smoothed variance estimates for each state vector |
lag_one_cov |
3D array with lagged correlation matrix for each for each change in the state vector. Only present when the model is logit and the method is EKF |
n_risk |
The number of observations in each interval |
times |
The interval borders |
risk_set |
The object from get_risk_obj if saved |
data |
The data argument if saved |
order |
Order of the random walk |
F_ |
Matrix with that map transition from one state vector to the next |
method |
Method used in the E-step |
est_Q_0 |
TRUE if Q_0 was estimated in the EM-algorithm |
hazard_func |
Hazard function |
control
argument allows you to pass a list
to select additional parameters. See the vignette 'ddhazard' for more information on hyper parameters. Unspecified elements of the list will yield default values
method |
Set to the method to use in the E-step. Either "EKF" for the Extended Kalman Filter or "UKF" for the Unscented Kalman Filter. "EKF" is the default |
LR |
Learning rate for the Extended Kalman filter |
NR_eps |
Tolerance for the Extended Kalman filter. Default is NULL which means that no extra iteration is made in the correction step |
alpha |
Hyper parameter $\alpha$ in the Unscented Kalman Filter |
beta |
Hyper parameter $\beta$ in the Unscented Kalman Filter |
kappa |
Hyper parameter $\kappa$ in the Unscented Kalman Filter |
n_max |
Maximum number of iteration in the EM-algorithm |
eps |
Tolerance parameter for the EM-algorithm |
est_Q_0 |
TRUE if you want the EM-algorithm to estimate Q_0 . Default is FALSE |
save_risk_set |
TRUE if you want to save the list from get_risk_obj used to estimate the model. It may be needed for later call to residuals , plot and logLike . Can be set to FALSE to save memory |
save_data |
TRUE if you want to save the list data argument. It may be needed for later call to residuals , plot and logLike . Can be set to FALSE to save memory |
ridge_eps |
Penalty term added to the diagonal of the covariance matrix of the observational equation in either the EKF or UKF |
fixed_terms_method |
The method used to estimate the fixed effects. Either 'M_step' or 'E_step' for estimation in the M-step or E-step respectively |
Q_0_term_for_fixed_E_step |
The diagonal value of the initial covariance matrix, Q_0 , for the fixed effects if fixed effects are estimated in the E-step |
order
argument. 1. and 2. order random walks is implemented. The regression parameters are updated at time by
, 2by
, ..., max_T
. See the vignette 'ddhazard' for more detailsThe Extended Kalman filter or Unscented Kalman filter needs an initial co-variance matrix Q_0
and state vector a_0
. An estimate from a time-invariant model is provided for a_0
if it is not supplied (the same model you would get from static_glm
function). A diagonal matrix with large entries is recommended for Q_0
. What is large dependents on the data set and model
. Further, a variance matrix for the first iteration Q
is needed. It is recommended to select diagonal matrix with low values for the latter. The Q
, a_0
and optionally Q_0
is estimated with an EM-algorithm
The model is specified through the model
argument. Currently, 'logit'
and 'exponential'
is available. The former uses an logistic model where outcomes are binned into the intervals. Be aware that there can be loss of information due to binning. It is key for the logit model that the id
argument is provided if individuals in the data set have time varying co-variates. The latter model uses an exponential model for the arrival times where there is no loss information due to binning
It is recommended to see the Shiny app demo for this function by calling ddhazard_app()
Durbin, James, and Siem Jan Koopman. Time series analysis by state space methods. No. 38. Oxford University Press, 2012.
plot
, residuals
, predict
, static_glm
, ddhazard_app