cmseRHNERM: Conditional mean squared error estimation of the empirical...

Description Usage Arguments Value Author(s) References Examples

View source: R/RDM-function.R

Description

Calculates the conditional mean squared error estimates of the empirical Bayes estimators under random heteroscedastic nested error regression models based on the parametric bootstrap.

Usage

1
cmseRHNERM(y, X, ni, C, k=1, maxr=100, B=100)

Arguments

y

N*1 vector of response values.

X

N*p matrix containing N*1 vector of 1 in the first column and vectors of covariates in the rest of columns.

ni

m*1 vector of sample sizes in each area.

C

m*p matrix of area-level covariates included in the area-level parameters.

k

area number in which the conditional mean squared error estimator is calculated.

maxr

maximum number of iteration for computing the maximum likelihood estimates.

B

number of bootstrap replicates.

Value

conditional mean squared error estimate in the kth area.

Author(s)

Shonosuke Sugasawa

References

Kubokawa, K., Sugasawa, S., Ghosh, M. and Chaudhuri, S. (2016). Prediction in Heteroscedastic nested error regression models with random dispersions. Statistica Sinica, 26, 465-492.

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
#generate data
set.seed(1234)
beta=c(1,1); la=1; tau=c(8,4)
m=20; ni=rep(3,m); N=sum(ni)
X=cbind(rep(1,N),rnorm(N))

mu=beta[1]+beta[2]*X[,2]
sig=1/rgamma(m,tau[1]/2,tau[2]/2); v=rnorm(m,0,sqrt(la*sig))
y=c()
cum=c(0,cumsum(ni))
for(i in 1:m){
  term=(cum[i]+1):cum[i+1]
  y[term]=mu[term]+v[i]+rnorm(ni[i],0,sqrt(sig[i]))
}

#fit the random heteroscedastic nested error regression
C=cbind(rep(1,m),rnorm(m))
cmse=cmseRHNERM(y,X,ni,C,B=10)
cmse

rhnerm documentation built on May 29, 2017, 12:41 p.m.