Compute the evidence lower bound (ELBO)
elbo(Y, delta, X, fit, nrep = 10000, center = TRUE)
Failure times.
Censoring indicator, 0: censored, 1: uncensored.
Design matrix.
Fit model.
Number of Monte Carlo samples.
Should the design matrix be centered.
Returns a list containing:
The mean of the ELBO.
The standard-deviation of the ELBO.
The expectation of the likelihood under the variational posterior.
The KL between the variational posterior and prior.
The evidence lower bound (ELBO) is a popular goodness of fit measure used in variational inference. Under the variational posterior the ELBO is given as $$ELBO = E_{\tilde{\Pi}}[\log L_p(\beta; Y, X, \delta)] - KL(\tilde{\Pi} \| \Pi)$$ where \(\tilde{\Pi}\) is the variational posterior, \(\Pi\) is the prior, \(L_p(\beta; Y, X, \delta)\) is Cox's partial likelihood. Intuitively, within the ELBO we incur a trade-off between how well we fit to the data (through the expectation of the log-partial-likelihood) and how close we are to our prior (in terms of KL divergence). Ideally we want the ELBO to be as small as possible.