glm.npp.lognc {hdbayes} | R Documentation |
Estimate the logarithm of the normalizing constant for normalized power prior (NPP) for one data set
Description
Uses Markov chain Monte Carlo (MCMC) and bridge sampling to estimate the logarithm of the normalizing
constant for the NPP for a fixed value of the power prior parameter a_0 \in (0, 1)
for one data
set. The initial priors are independent normal priors on the regression coefficients and a half-normal
prior on the dispersion parameter (if applicable).
Usage
glm.npp.lognc(
formula,
family,
histdata,
a0,
offset0 = NULL,
beta.mean = NULL,
beta.sd = NULL,
disp.mean = NULL,
disp.sd = NULL,
bridge.args = NULL,
iter_warmup = 1000,
iter_sampling = 1000,
chains = 4,
...
)
Arguments
formula |
a two-sided formula giving the relationship between the response variable and covariates. |
family |
an object of class |
histdata |
a |
a0 |
the power prior parameter (a scalar between 0 and 1). |
offset0 |
vector whose dimension is equal to the rows of the historical data set giving an offset for the historical data. Defaults to a vector of 0s. |
beta.mean |
a scalar or a vector whose dimension is equal to the number of regression coefficients giving the mean parameters for the normal initial prior on regression coefficients given the dispersion parameter. If a scalar is provided, beta.mean will be a vector of repeated elements of the given scalar. Defaults to a vector of 0s. |
beta.sd |
a scalar or a vector whose dimension is equal to the number of regression coefficients giving
the sd parameters for the initial prior on regression coefficients. The sd used is
|
disp.mean |
mean parameter for the half-normal prior on dispersion parameter. Defaults to 0. |
disp.sd |
sd parameter for the half-normal prior on dispersion parameter. Defaults to 10. |
bridge.args |
a |
iter_warmup |
number of warmup iterations to run per chain. Defaults to 1000. See the argument |
iter_sampling |
number of post-warmup iterations to run per chain. Defaults to 1000. See the argument |
chains |
number of Markov chains to run. Defaults to 4. See the argument |
... |
arguments passed to |
Value
The function returns a vector giving the value of a0, the estimated logarithm of the normalizing constant, the minimum estimated bulk effective sample size of the MCMC sampling, and the maximum Rhat.
References
Gronau, Q. F., Singmann, H., and Wagenmakers, E.-J. (2020). bridgesampling: An r package for estimating normalizing constants. Journal of Statistical Software, 92(10).
Examples
if (instantiate::stan_cmdstan_exists()) {
data(actg036)
## take subset for speed purposes
actg036 = actg036[1:50, ]
glm.npp.lognc(
cd4 ~ treatment + age + race,
family = poisson(), histdata = actg036, a0 = 0.5,
chains = 1, iter_warmup = 500, iter_sampling = 5000
)
}