pbtf: Proximal Bayesian Trend Filtering

Description Usage Arguments Examples

View source: R/pbtf.R

Description

Proximal Bayesian Trend Filtering

Usage

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
pbtf(
  y,
  x = NULL,
  restrictions = NULL,
  lambda = NULL,
  k = 2,
  delta = 1,
  N.burn = 5000,
  N.sim = 10000,
  t = 5,
  MH_correct = F,
  alpha = NULL,
  alpha_grid = NULL,
  K = 10,
  s = 0.001,
  r = 0.001
)

Arguments

y

normal observations (vector)

x

predictor (vector); if null, will use 1:m by default

restrictions

a collection of shape restrictions, including 'increasing','decreasing','convex','concave'

lambda

lambda parameter of Moreau envelope

k

order of the desired piecewise polynomial; 1 linear, 2 quadratic, 3 cubic; k=0 or k>=4 not recommended

delta

percentage of maximum step size to use, default is 1

N.burn

number of MCMC iterations burned

N.sim

number of MCMC samples returned

t

number of theta sampling steps to carry out before sigma2, default is 5

MH_correct

whether to use MH correction or not

alpha

regularization parameter; if NULL, it is determined by cross validation heuristic

alpha_grid

a grid of alpha candidates to select from; we recommend including 0

K

conduct K-fold-cross validation to find the optimal alpha

s

the shape parameter for inverse gamma prior of sigma2

r

the rate parameter for inverse gamma prior of sigma2

Examples

1
2
3
4
x=seq(0,4*pi,len=100)
y=x+sin(x)+rnorm(100)
out_pbsrtf <- pbtf(y,x,'increasing',k=2,alpha_grid=seq(0,10,len=1001))
plot(out_pbsrtf)

qhengncsu/BNRPxMCMC documentation built on Dec. 31, 2020, 2:10 a.m.