mvrnormSeries: Generate data under the Dynamic or Rao-Yu Time Series Models In sae2: Small Area Estimation: Time-Series Models

Description

Function to generate data under a Rao-Yu time series model, a dynamic model, or a mixture of both. The function can produce either univariate or multivariate observations. All components of the returned random variable have unconditional mean zero. The function calls mvrnorm in MASS.

Usage

 1 2 3 4 mvrnormSeries(NV=1, D, T, sigma.e, rho.dyn, sigma.v.dyn, sigma.u.dyn, rho.u.dyn, rho.RY, sigma.v.RY, sigma.u.RY, rho.u.RY, tol=1e-6, conditional.mean=FALSE)

Arguments

 NV The number of variables. D The number of domains. T The number of time instances (constant for all domains). sigma.e The covariance matrix for the variation due to sampling, specified either as a single square matrix with NV*T rows and columns, or as a list of D matrices, each with NV*T rows and columns. The rows should vary over T more quickly than over NV. Sampling covariances between domains are assumed to be zero. rho.dyn The temporal correlation parameter in the dynamic model. This parameter is not a true correlation, however, and it may exceed 1. sigma.v.dyn A vector of length NV with the v (nu) component of the variance under the dynamic model. This component measures the variance of the random effect at the beginning of the series. sigma.u.dyn A vector of length NV with the u component of the variance under the dynamic model. rho.u.dyn For NV>1, the cross-sectional correlation(s) under the model. The vector should specify (NV*(NV-1))/2 correlations, in lower triangular form. For example, for NV=3, the correlations should be specified in the order (2,1), (3,1), (3,2). rho.RY The temporal correlation parameter in the Rao-Yu model. This is a true correlation, unlike the parameter in the dynamic model. sigma.v.RY A vector of length NV with the v (nu) component of the variance under the Rao-Yu model. This component reflects a constant random effect for each domain unchanging over time. sigma.u.RY A vector of length NV with the u component of the variance under the Rao-Yu model. rho.u.RY For NV>1, the cross-sectional correlation under the model. The vector should specify (NV*(NV-1))/2 correlations, in lower triangular form. For example, for NV=3, the correlations should be specified in the order (2,1), (3,1), (3,2). tol A tolerance parameter used by mvrnorm in MASS to determine if the covariance matrix is non-singular. conditional.mean If true, the function will also return the generated values of the random effects.

Details

The function assembles the covariance matrix from the covariance matrix under the dynamic model (if specified), the Rao-Yu model (if specified) and a required sampling covariance matrix.

Value

If conditional.mean=FALSE, then for NV=1, a multivariate normal random vector with mean zero and length D*T. For NV>1, a matrix with D*T rows and NV columns.

If conditional.mean=TRUE, a list with the first element as above and a second element that is the sum of the random effects without the sampling error. Simulation studies can evaluate the small area estimates using the first element of the list as input against the second element of the list, which is the target of the small area estimation.

Robert E. Fay