data.mme {mme} | R Documentation |
Function to generate matrices and the initial values
Description
Based on the input data, this function generates some matrices that are
required in subsequent calculations and the initial values obtained from the function initial.values
.
Usage
data.mme(fi, k, pp, mod)
Arguments
fi |
input data set with (d x t) rows and 4+k+sum(pp) columns. The first four columns of the data set are, in this order: the area indicator (integer), the time indicator (integer), the sample size of each domain and the population size of each domain. The following k columns are the categories of the response variable. Then, the auxiliary variables: first, the auxiliary variables of the first category, second, the auxiliary variables of the second category, and so on. Examples of input data sets are in |
k |
number of categories of the response variable. |
pp |
vector with the number of auxiliary variables per category. |
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
A list containing the following components.
n |
vector with the area sample sizes. |
N |
vector with the area population sizes. |
Z |
design matrix of random effects. |
Xk |
list of matrices with the auxiliary variables per category. The dimension of the list is the number of domains |
X |
list of matrices with the auxiliary variables. The dimension of the list is the number of categories of the response variable minus one. |
y |
matrix with the response variable. The rows are the domains and the columns are the categories of the response variable. |
initial |
a list with the initial values for the fixed and the random effects obtained from |
References
Lopez-Vizcaino, ME, Lombardia, MJ and Morales, D (2013). Multinomial-based small area estimation of labour force indicators. Statistical Modelling, 13, 153-178.
See Also
initial.values
, wmatrix
,
phi.mult
, prmu
,
Fbetaf
, phi.direct
,
sPhikf
, ci
,
modelfit1
, msef
,
mseb
Examples
k=3 #number of categories of the response variable
pp=c(1,1) #vector with the number of auxiliary variables in each category
data(simdata2) #Data
mod=2
##Needed matrix and initial values
datar=data.mme(simdata2,k,pp,mod)