RHNERM: Estimation of random heteroscedastic nested error regression...

Description Usage Arguments Value Author(s) References Examples

View source: R/RDM-function.R

Description

Calculates the maximum likelihood estimates of the model parameters in random heteroscedastic nested error regression models. The empirical Bayes estimates of area-level parameters with random effects are also given.

Usage

1
RHNERM(y, X, ni, C, maxr=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.

maxr

maximum number of iteration for computing the maximum likelihood estimates.

Value

The function returns a list with the following objects:

MLE

(p+3)*1 vector of maximum likelihood estimates of the model parameters.

EB

m*1 vector of empirical Bayes estimates of the area-level parameters.

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))
fit=RHNERM(y,X,ni,C)
fit

rhnerm documentation built on May 1, 2019, 10:08 p.m.

Related to RHNERM in rhnerm...