tlnise: TLNise

Description Usage Arguments Details Value Author(s) References Examples

Description

Two level Normal independent sampling estimation

Usage

1
2
3
tlnise(Y, V, w = NA, V0 = NA, prior = NA, N = 1000, seed = NULL,
       Tol = 1e-06, maxiter = 1000, intercept = TRUE, labelY = NA,
       labelYj = NA, labelw = NA, digits = 4, brief = 1, prnt = TRUE)

Arguments

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 the 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

Details

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.

Value

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

Author(s)

S-PLUS original by Philip Everson; R port by Roger D. Peng

References

Everson PJ, Morris CN (2000). “Inference for Multivariate Normal Hierarchical Models,” Journal of the Royal Statistical Society, Series B, 62 (6) 399–412.

Examples

1
2
3
4
x <- rnorm(10)  ## Second level
y <- rnorm(10, x)  ## First level means

out <- tlnise(Y = y, V = rep(1, 10), w = rep(1, 10), seed = 1234)

Example output

Two-level normal independent sampling estimation (version 1.1)
[1] ******** Prior Parameter = -2

[1] ******** Locating Posterior Mode ************ 

[1] Converged in 26 EM iterations.
[1] Posterior mode of B0:

       [,1]
[1,] 0.2368

[1] lf(modeB0) = -7.253 ; lf0(modeB0) = -6.101 ; adj = 1.151

[1] ******** Drawing Constrained Wisharts ******** 


[1] CWish acceptance rate = 1000 / 1000 = 1

[1] ******** Processing Draws ************** 

[1] Average scaled importance weight = 1

[1] Posterior mean estimate of A:
     [,1]
[1,]  3.3

[1] Between-group SD estimate:
      [,1]
[1,] 1.817

tlnise documentation built on Oct. 13, 2016, 12:13 p.m.

Related to tlnise in tlnise...