modelfit2: Function to fit Model 2 In mme: Multinomial Mixed Effects Models

Description

This function fits the multinomial mixed model with two independent random effects for each category of the response variable: one domain random effect and another independent time and domain random effect (Model 2). The formulation is described in Lopez-Vizcaino et al. (2013). The fitting algorithm combines the penalized quasi-likelihood method (PQL) for estimating and predicting the fixed and random effects, respectively, with the residual maximum likelihood method (REML) for estimating the variance components. This function uses as initial values the output of the function `initial.values`.

Usage

 `1` ```modelfit2(d, t, pp, Xk, X, Z, initial, y, M, MM) ```

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 `data.mme`. `initial` output of the function `initial.values`. `y` matrix with the response variable obtained from `data.mme`, except the reference category. The rows are the domains and the columns are the categories of the response variable minus one. `M` vector with the area sample sizes. `MM` vector with the population sample sizes.

Value

A list containing the following components.

 `Estimated.probabilities` matrix with the estimated probabilities for the categories of response variable. `Fisher.information.matrix.phi` Fisher information matrix of the variance components. `Fisher.information.matrix.beta` Fisher information matrix of the fixed effects. `u1` matrix with the estimated first random effect. `u2` matrix with the estimated second random effect. `mean` matrix with the estimated mean of response variable. `warning1` 0=OK,1=The model could not be fitted. `warning2` 0=OK,1=The value of the variance component is negative: the initial value is taken. `beta.Stddev.p.value` matrix with the estimated fixed effects, its standard deviations and its p-values. `phi.Stddev.p.value` matrix with the estimated variance components, its standard deviations and its p-values.

References

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

`data.mme`, `initial.values`, `wmatrix`, `phi.mult.it`, `prmu.time`, `phi.direct.it`, `sPhikf.it`, `ci`, `Fbetaf.it`, `msef.it`, `mseb`

Examples

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

Example output

```Loading required package: MASS

Package mme: Multinomial Mixed Effects Models
Version 0.1-5 (built on 2013-06-10) is now loaded.
Copyright E. Lopez-Vizcaino, M.J. Lombardia and D. Morales
```

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