rlDirectEval: Fitting restricted likelihood location-scale model using...

Description Usage Arguments Details Value Author(s) Examples

View source: R/rlDirectEval.R

Description

Deprecated - use rl_direct Full model:

μ~N(η, τ^2), σ^2~IG(α, β), y_1, …, y_n~N(μ, σ^2)

For the restricted likelihood, conditioning is done on a pair of location and scale statistics T(y)=(l(y), s(y)) with the property that l(σ y+μ)=σ l(y)+μ and s(σ y+μ)=σ s(y). Current implementation allows for these to be a pair of M-estimators as implemented in rlm

Usage

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
rlDirectEval(
  y,
  psi,
  ...,
  scale.est = "Huber",
  k2 = 1.345,
  eta,
  tau,
  alpha,
  beta,
  mu_lims,
  sigma2_lims,
  length_mu,
  length_sigma2,
  smooth = 1,
  N,
  maxit = 1000
)

Arguments

y

vector of data

psi

the psi function used to define the location estimator. It is a function (possibly given by name) that is described in rlm. Tuning constants are passed via ...

...

additional arguments to be passed to psi

scale.est, k2

specification of the scale estimator (issued by name- either 'MAD', 'Huber', or 'proposal 2') and the tuning constant for the Huber proposal 2 scale estimation. See these parameters in rlm for more information.

eta, tau

prior mean and standard deviation for mu

alpha, beta

prior shape and scale for sigma^2

mu_lims, sigma2_lims

vectors of length 2 defining the limits for the numerical integration necessary to find the normalizing constant in Bayes' Theorem

length_mu, length_sigma2

length of the grid in each parameter to do the numerical integration (standard Riemann sum)

smooth

scalar or vector of length 2 that will scale the initial bandwidth computed by hpi.

N

number of samples of the statistics to use for the kernel density estimation

maxit

the limit on the number of IWLS iterations. Same as in rlm

Details

Direct evaluation uses kernel density estimation with a Gaussian kernel to estimate the restricted likelihood. N specifies the number of samples of the statistics to generate for the kernel density estimate. hpi is used to specify the initial bandwidths independently for the location and the scale. These can be multiplied by smooth to 'oversmooth' or 'undersmooth' the estimate. Oversmoothing may result in more stable estimates.

A simple Riemann sum is used to determine the normalizing constant. Parameters for this numerical integration are specified by mu_lims,sigma2_lims, length_mu, and length_sigma2.

Value

A list of length 4: the joint posterior, the two marginals, and the bandwidths used for the kernel density estimate

Author(s)

John R. Lewis lewis.865@osu.edu

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
library(MASS)
set.seed(1) # for reproducibility,
 # length_mu, length_sigma2, N should be larger in reality -
 # they are small so the example runs quickly
y<-data(newcomb)
fit<-rlDirectEval(y=newcomb, psi=psi.bisquare, scale.est='Huber',
   eta=23.6, tau=2.04, alpha=5, beta=10, mu_lims=c(20,32),
   sigma2_lims=c(0.001,100), length_mu=20, length_sigma2=20,
   smooth=1,N=100)
names(fit)
plot(fit$muPost[,1],fit$muPost[,2], type='l', col=4)
plot(fit$sigma2Post[,1],fit$sigma2Post[,2], type='l')

jrlewi/brlm documentation built on March 17, 2021, 1:10 a.m.