Description Usage Arguments Details Value Author(s) Examples
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
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
)
|
y |
vector of data |
psi |
the |
... |
additional arguments to be passed to |
scale.est, k2 |
specification of the scale estimator (issued by name- either |
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 |
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 |
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
.
A list of length 4: the joint posterior, the two marginals, and the bandwidths used for the kernel density estimate
John R. Lewis lewis.865@osu.edu
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')
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.