tlnise {tlnise} | R Documentation |
Two level Normal independent sampling estimation
tlnise(Y, V, w = NA, V0 = NA, prior = NA, N = 1000, seed = 10, Tol = 1e-06, maxiter = 1000, intercept = TRUE, labelY = NA, labelYj = NA, labelw = NA, digits = 4, brief = 1, prnt = TRUE) initTLNise()
Y |
Jxp (or pxJ) matrix of p-dimensional Normal outcomes |
V |
pxpxJ array of pxp Level-1 covariances (assumed known) |
w |
Jxq (or qxJ) covariate matrix (adds column of 1's if not included and intercept = TRUE ) |
V0 |
"typical" Vj (default is average of Vj's) |
prior |
prior parameter (see Details) |
N |
number of Constrained Wishart draws for inference |
seed |
seed for random number generator |
Tol |
tolerance for determining modal convergence |
maxiter |
maximum number of EM iterations for finding mode |
intercept |
if TRUE , an intercept term is included in the regression |
labelY |
optional names vector for the J observations |
labelYj |
optional names vector for the p elements of Yj |
labelw |
optional names vector for covariates |
digits |
number of significant digits for reporting results |
brief |
level of output, from 0 (minimum) to 2 (maximum) |
prnt |
controls printing during execution |
The prior is p(B_0) = |B_0|^{(prior - p - 1)/2}.
Note that for the prior distribution, prior = -(p+1)
corresponds to a uniform on level-2 covariance matrix A (default),
prior = 0
is the Jeffreys' prior, and prior = (p+1)
is the uniform prior on shrinkage matrix B0.
tlnise
returns a list, the precise contents of which depends on
the value of the brief
argument. Setting brief = 2
returns the maximum amount of information. Setting brief = 1
or brief = 0
returns a subset of that information.
If brief = 2
, the a list with the following components is returned:
gamma |
matrix of posterior mean and SD estimates of Gamma, and thei ratios |
theta |
pxJ matrix of posterior mean estimates for thetaj's |
SDtheta |
pxJ matrix of posterior SD estimates for thetaj's |
A |
pxp estimated posterior mean of variance matrix A |
rtA |
p-vector of between group SD estimates |
Dgamma |
rxr estimated posterior covariance matrix for Gamma |
Vtheta |
pxpxJ array of estimated covariances for thetaj's |
B0 |
pxpxN array of simulated B0 values |
lr |
N-vector of log density ratios for each B0 value |
lf |
N-vector of log f(B0|Y) evaluated at each B0 |
lf0 |
N-vector of log f0(B0|Y) evaluated at each B0 (f0 is the CWish envelope density for f) |
df |
degrees of freedom for f0 |
Sigma |
scale matrix for f0 |
nvec |
number of matrices begun, diagonal and off-diagonal elements simulated to get N CWish matrices |
nrej |
number of rejections that occurred at each step 1,..,p |
initTLNise
needs to be called to initialize the random number
generator used by tlnise
. Once initTLNise
is called,
the seed
argument to tlnise
to be used (for
reproducibility of results).
S-PLUS original by Philip Everson; R port by Roger D. Peng
Everson PJ, Morris CN (2000). “Inference for Multivariate Normal Hierarchical Models,” Journal of the Royal Statistical Society, Series B, 62 (6) 399–412.
x <- rnorm(10) ## Second level y <- rnorm(10, x) ## First level means initTLNise() out <- tlnise(Y = y, V = rep(1, 10), w = rep(1, 10), seed = 1234)