| hyperpar {sdPrior} | R Documentation |
Find Scale Parameters for Inverse Gamma Hyperprior of Nonlinear Effects with Spike and Slab Prior (Simulation-based)
Description
This function implements a optimisation routine that computes the scale parameter b and selection parameter
r. . Here, we assume an inverse gamma prior IG(a,b) for \psi^2 and \tau^2\sim N(0,r(\delta)\psi^2)
and given shape paramter a,
such that approximately P(f(x)\le c|spike,\forall x\in D)\ge 1-\alpha1 and P(\exists x\in D s.t. f(x)\ge c|slab)\ge 1-\alpha2.
Usage
hyperpar(Z, Kinv, a = 5, c = 0.1, alpha1 = 0.1, alpha2 = 0.1,
R = 10000, myseed = 123)
Arguments
Z |
the row of the design matrix (or the complete matrix of several observations) evaluated at. |
Kinv |
the generalised inverse of |
a |
is the shape parameter of the inverse gamma distribution, default is 5. |
c |
denotes the expected range of eqnf . |
alpha1 |
denotes the 1- |
alpha2 |
denotes the 1- |
R |
denotes the number of replicates drawn during simulation. |
myseed |
denotes the required seed for the simulation based method. |
Value
an object of class list with root values r, b from uniroot.
Author(s)
Nadja Klein
References
Nadja Klein, Thomas Kneib, Stefan Lang and Helga Wagner (2016). Spike and Slab Priors for Effect Selection in Distributional Regression. Working Paper.
Examples
set.seed(123)
library(MASS)
# prior precision matrix (second order differences)
# of a spline of degree l=3 and with m=22 inner knots
# yielding dim(K)=m+l-1=22
K <- t(diff(diag(22), differences=2))%*%diff(diag(22), differences=2)
# generalised inverse of K (same as if we used mixed model representation!)
Kinv <- ginv(K)
# covariate x
x <- runif(1)
Z <- matrix(DesignM(x)$Z_B,nrow=1)
fgrid <- seq(-3,3,length=1000)
mdf <- hyperpar(Z,Kinv,a=5,c=0.1,alpha1=0.05,alpha2=0.05,R=10000,myseed=123)