hyperpar: Find Scale Parameters for Inverse Gamma Hyperprior of...

Description Usage Arguments Value Author(s) References Examples

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 ψ^2 and τ^2\sim N(0,r(δ)ψ^2) and given shape paramter a, such that approximately P(f(x)≤ c|spike,\forall x\in D)≥ 1-α1 and P(\exists x\in D s.t. f(x)≥ c|slab)≥ 1-α2.

Usage

1
2
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 K.

a

is the shape parameter of the inverse gamma distribution, default is 5.

c

denotes the expected range of eqnf .

alpha1

denotes the 1-α1 level for b.

alpha2

denotes the 1-α2 level for r.

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

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
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)

sdPrior documentation built on May 2, 2019, 8:57 a.m.

Related to hyperpar in sdPrior...