Learn R Programming

agfh (version 0.2.1)

gamma_err_gen: Generate Data with Gamma Sampling Errors

Description

The traditional Fay-Herriot small area model has a Normal latent variable and Normal observed response errors. This method generates data with Normal latent variables and Gamma errors on the response. Note that the sampling errors are transformed so their mean and variance match the the first two moments of the traditional model.

Usage

gamma_err_gen (M, p, D, lambda, shape, rate)

Value

A list containing

D

copy of argument `D`

beta

vector of length `p` latent coefficients

lambda

copy of argument `lambda`

X

matrix of independent variables

theta

vector of latent effects

Y

vector of responses

err

vector of sampling errors

name

name of sampling error distribution, including shape and rate parameters

Arguments

M

number of areal units

p

dimension of regressors i.e. \(x \in R^p\)

D

vector of precisions for response, length M

lambda

value of latent variance

shape

shape parameter of Gamma distribution

rate

rate parameter of Gamma distribution

Examples

Run this code
  M <- 50
  p <- 3
  D <- rep(0.1, M)
  lamb <- 1/2
  dat <- gamma_err_gen(M, p, D, lamb, 1/2, 10)

Run the code above in your browser using DataLab