model: Choose between the three models

Description Usage Arguments Value References Examples

View source: R/utilities.R

Description

This function chooses one of the three models.

Usage

1
model(d, t, pp, Xk, X, Z, initial, y, M, MM, mod)

Arguments

d

number of areas.

t

number of time periods.

pp

vector with the number of the auxiliary variables per category.

Xk

list of matrices with the auxiliary variables per category obtained from data.mme. The dimension of the list is the number of domains.

X

list of matrices with the auxiliary variables obtained from data.mme. The dimension of the list is the number of categories of the response variable minus one.

Z

design matrix of random effects obtained from data.mme.

initial

output of the function initial.values.

y

matrix with the response variable obtained from data.mme. The rows are the domains and the columns are the categories of the response variable.

M

vector with the area sample sizes.

MM

vector with the population sample sizes.

mod

a number specifying the type of models: 1=multinomial mixed model with one independent random effect in each category of the response variable (Model 1), 2=multinomial mixed model with two independent random effects in each category of the response variable: one domain random effect and another independent time and domain random effect (Model 2) and 3= multinomial model with two independent random effects in each category of the response variable: one domain random effect and another correlated time and domain random effect (Model 3).

Value

the output of the function modelfit1, modelfit2 or modelfit3.

References

Lopez-Vizcaino, ME, Lombardia, MJ and Morales, D (2013). Multinomial-based small area estimation of labour force indicators. Statistical Modelling, 13 ,153-178.

Lopez-Vizcaino, ME, Lombardia, MJ and Morales, D (2013). Small area estimation of labour force indicator under a multinomial mixed model with correlated time and area effects. Submitted for review.

Examples

1
2
3
4
5
6
7
k=3 #number of categories of the response variable
pp=c(1,1) #vector with the number of auxiliary variables in each category
data(simdata)  #data
mod=1 #Model 1
datar=data.mme(simdata,k,pp,mod)
result=model(datar$d,datar$t,pp,datar$Xk,datar$X,datar$Z,datar$initial,datar$y[,1:(k-1)],
datar$n,datar$N, mod)

mme documentation built on May 30, 2017, 3:38 a.m.