NonParaUpdatePrior: Replacing a parametric prior by an optimal non-parametric one

View source: R/NonParaUpdatePrior.R

NonParaUpdatePriorR Documentation

Replacing a parametric prior by an optimal non-parametric one

Description

This is the iterative marginal procedure, outlined in the Van de Wiel et al. (2012) reference below. It allows to replace one parametric prior by a nonparametric one, which is typically desirable for the main parameter of interest. The nonparametic prior is found by an iterative Empirical Bayes type method, which aims to maximize marginal likelihood. The nonparametric prior may contain a point mass (default)

Usage

NonParaUpdatePrior(fitall,fitall0=NULL,  modus = "fixed", shrinkpara = NULL, shrinklc = NULL, lincombs=NULL, 
includeP0 = TRUE, unimodal = TRUE, logconcave = FALSE, symmetric = FALSE, allow2modes=TRUE, maxiter = 10, tol = 0.005, 
ndrawtot = 10000, ntotals = c(500, 2000, 5000, 10000), priornew = NULL, gaussinit0 = NULL, 
gammainit0 = NULL, p0init=0.8, p0lower = 0.5, pointmass = 0, maxsupport = 6, plotdens = TRUE, 
ncpus = 2)

Arguments

fitall

A 2-component list object resulting from FitAllShrink or from CombinePosteriors

fitall0

An optional 2-component list object resulting from FitAllShrink containing the fits under the null-model.

modus

Character string. Either "fixed", "random" or "logdisp". Type of variable for which the nonparametric prior is fit.

shrinkpara

Character or character vector. Name(s) of the variable(s) for which the nonparametric prior is fit. Corresponding variable can be a factor.

shrinklc

Character string. Name of the linear combination for which the nonparametric prior is fit.

lincombs

List object. Name of the list object that contains the linear combination(s), usually created by inla.make.lincomb or AllComp. Only required when fitall does not consist of INLA outputs, e.g. after CombinePosteriors.

includeP0

Boolean. Should the nonparametric prior contain a point mass?

unimodal

Boolean. Should the nonparametric prior be unimodal?

logconcave

Boolean. Should the nonparametric prior be log-concave?

symmetric

Boolean. Should the nonparametric prior be symmetric?

allow2modes

Boolean. Can the smooth part of the nonparametric prior contain a mode on the negative and positive half-plane?

maxiter

Integer. The maximum number of iterations in the iterative marginal procedure

tol

Numeric. Tolerance for the Kolmogorov-Smirnov distance between two succesive iterations. If this distance is smaller than tol the algorithm stops.

ndrawtot

Integer. Total number of draws from the empirical mixture of posteriors on which the new prior is fitted.

ntotals

Vector of integers. Consecutive number of posteriors that are used to determine the new prior.

priornew

Numeric matrix or dataframe with 2 columns. Starting prior. Need not te be specified.

gaussinit0

Numeric vector of length 2. Mean and precision of Gaussian starting prior. Need not to be specified.

gammainit0

Numeric vector of length 2. Shape and rate of the Gamma starting prior. Need not to be specified.

p0init

Numeric between 0 and 1. Initial value of the mixture proportion of the point mass. Only relevant when includeP0=TRUE.

p0lower

Numeric between 0 and 1. Lower bound for the mixture proportion of the point mass. Only relevant when includeP0=TRUE.

pointmass

Numeric. Location of the pointmass. Only relevant when includeP0=TRUE.

maxsupport

Numeric. maximum of the support of the prior and posteriors. For numerical stability. -maxsupport is the minimum of the support.

plotdens

Boolean. Should the consecutive nonparametric estimates be plotted on the screen?

ncpus

Integer. The number of cpus to use for parallel computations.

Details

About shrinklc: it is assumed that only one type of linear combinations is present in the fit object fitall. Fitting a unimodal prior requires the package "Iso", whereas a log-concave prior requires the package "logcondens" (Lutz and Rufibach, 2011). These options may be used to increase stability of the prior, in particular for the tails.

Value

A list with the following components:

priornew

The (smooth) part of the nonparametric prior

p0est

Estimate of the point mass mixture component

inputpar

List of input parameters

densall

Consecutive fits of the nonparametric prior

ksmaxall

Kolmogorov-Smirnov distances between consecutive fits

sdall

Standard deviations for consecutive fits

totalloglikall

Marginal log-likelihood sums for consecutive fits

nallforlik

Number of elements used for computing totalloglikall

notfit

IDs of list elements of fitall for which a fit is not available

Author(s)

Mark A. van de Wiel

References

Lutz, D. and Rufibach, K. (2011). logcondens: Computations related to univariate log-concave density estimation. J. Statist. Software 39, 1-28.

Van de Wiel MA, Leday GGR, Pardo L, Rue H, Van der Vaart AW, Van Wieringen WN (2012). Bayesian analysis of RNA sequencing data by estimating multiple shrinkage priors. Biostatistics.

See Also

MixtureUpdatePrior for parametric mixture priors (with point mass) and NonParaUpdatePosterior for computing posteriors from the output of this function.

Examples

#See ShrinkSeq, ShrinkGauss and CombinePosteriors

markvdwiel/ShrinkBayes documentation built on March 27, 2022, 7:47 p.m.