lorad_estimate {lorad} | R Documentation |
Calculates the LoRaD estimate of the marginal likelihood
Description
Provided with a data frame containing sampled paraneter vectors and a dictionary relating column names to parameter types, returns a named character vector containing the following quantities:
logML (the estimated log marginal likelihood)
nsamples (number of samples)
nparams (length of each parameter vector)
training_frac (fraction of samples used for training)
tsamples (number of samples used for training)
esamples (number of sampled used for etimation)
coverage (nominal fraction of the estimation sampled used)
esamplesused (number of estimation samples actually used for estimation)
realized_coverage (actual fraction of estimation sample used)
rmax (lowest radial distance: defines boundary of working parameter space)
log_delta (volume under the unnormalized posterior inside working parameter space)
Usage
lorad_estimate(params, colspec, training_frac, training_mode, coverage)
Arguments
params |
Data frame in which rows are sample points and columns are parameters, except that last column holds the log posterior kernel |
colspec |
Named character vector associating column names in params with column specifications |
training_frac |
Number between 0 and 1 specifying the training fraction |
training_mode |
One of random, left, or right, specifying how training fraction is chosen |
coverage |
Number between 0 and 1 specifying fraction of training sample used to compute working parameter space |
Value
Named character vector of length 11.
Examples
normals <- rnorm(1000000,0,10)
prob_normals <- dnorm(normals,0,10,log=TRUE)
proportions <- rbeta(1000000,1,2)
prob_proportions <- dbeta(proportions,1,2,log=TRUE)
lengths <- rgamma(1000000, 10, 1)
prob_lengths <- dgamma(lengths,10,1,log=TRUE)
paramsdf <- data.frame(
normals,prob_normals,
proportions, prob_proportions,
lengths, prob_lengths)
columnkey <- c(
"normals"="unconstrained",
"prob_normals"="posterior",
"proportions"="proportion",
"prob_proportions"="posterior",
"lengths"="positive",
"prob_lengths"="posterior")
results <- lorad_estimate(paramsdf, columnkey, 0.5, 'random', 0.1)
lorad_summary(results)