Type: | Package |
Title: | Fits a Fay Herriot Model |
Version: | 0.1 |
Date: | 2015-10-03 |
Author: | Abhishek Nandy |
Maintainer: | Abhishek Nandy <nandy006@umn.edu> |
Description: | Inference techniques for Fay Herriot Model. |
License: | GPL-2 | GPL-3 [expanded from: GPL (≥ 2)] |
Depends: | MASS |
Packaged: | 2015-10-05 03:16:17 UTC; abhishek |
NeedsCompilation: | no |
Repository: | CRAN |
Date/Publication: | 2015-10-05 12:37:47 |
Fits a Fay Herriot model
Description
It has some useful functions which the users might find convenient for fitting Fay Herriot Model. Details are included in package vignette.
Details
Package: | smallarea |
Type: | Package |
Version: | 0.1 |
Date: | 2013-04-25 |
License: | GPL(>=2) |
Author(s)
Abhishek Nandy
Maintainer: Abhishek nandy<nandy006@umn.edu>
References
On measuring the variability of small area estimators under a basic area level model. Datta, Rao, Smith. Biometrika(2005),92, 1,pp. 183-196 Large Sample Techniques for Statistics, Springer Texts in Statistics. Jiming Jiang. Chapters - 4,12 and 13. Small Area Estimation, JNK Rao, Wiley 2003 Variance Components, Wiley Series in Probability and Statistics,2006 Searle, Casella, Mc-Culloh
Examples
data=data.frame(response=c(1,2,3,4,8),D=c(0.2,0.5,0.1,0.9,1))
data
ans=smallareafit(response~D,data,method="FH")
ans1=smallareafit(response~D,data,method="REML")
ans2=smallareafit(response~D,data,method="PR")
ans3=smallareafit(response~D,data,method="ML")
Estimates of variance component, unknown sampling variance, regression coefficients and small area means in Fay Herriot model with unknown sampling variance.
Description
The function returns a list of 5 elements. The first element is an estimate of the variance component , the second element is an estimate of the parameter related to sampling variance, the third element is a vector of estimates of the regression coefficients in the Fay-Herriot model, the fourth element is a vector of the predictors pf the small area means and last element is the design matrix, the first column being a column of ones and the remaining columns represent the values of the covariates for different small areas. See details below.
Usage
estimate.unknownsampvar(response, mat.design, sample.size)
Arguments
response |
A numeric vector. It represents the response or the direct survey based estimators in the Fay Herriot Model |
mat.design |
A numeric matrix. The first column is a column of ones(also called the intercept). The other columns consist of observations of each of the covariates or the explanatory variable in Fay Herriot Model. |
sample.size |
A numeric vector. The known sample sizes used to calculate the direct survey based estimators. |
Details
For more details please see the package vignette.
Value
psi.hat |
Estimate of the variance component |
del.hat |
Estimate of the parameter for sampling variance |
beta.hat |
Estimate of the unknown regression coefficients |
theta.hat |
Predictors of the small area means |
mat.design |
design matrix |
Author(s)
Abhishek Nandy
References
On measuring the variability of small area estimators under a basic area level model. Datta, Rao, Smith. Biometrika(2005),92, 1,pp. 183-196 Large Sample Techniques for Statistics, Springer Texts in Statistics. Jiming Jiang. Chapters - 4,12 and 13.
See Also
Examples
set.seed( 55 ) # setting a random seed
require(MASS) # the function mvrnorm requires MASS
x1 <- rep( 1, 10 ) # vector of ones representing intercept
x2 <- rnorm( 10 ) # vector of covariates randomly generated
x <- cbind( x1, x2 ) # design matrix
x <- as.matrix( x ) # coercing into class matrix
n <- rbinom (10, 20, 0.4) # generating sample sizes for each small area
psi <- 1 # true value of the psi parameter
delta <- 1 # true value of the delta parameter
beta <- c( 1, 0.5 ) # true values of the regression parameters
theta <- mvrnorm( 1, as.vector( x %*% beta ), diag(10) ) # true small area means
y <- mvrnorm( 1, as.vector( theta ), diag( delta/n ) ) # design based estimators
estimate.unknownsampvar( y, x, n )
Estimate of the variance component in Fay Herriot Model using Fay Herriot Method
Description
This function returns a list with one element in it which is the estimate of the variance component in the Fay Herriot Model. The estimate is found by solving an equation (for details see vignette) and is due to Fay Herriot. The uniroot in the stats package is used to find the root. uniroot searches for a root of that equation in a particular interval the lower bound is 0 and the upper bound is set to estimate of the variance component using Prasad Rao method + three times the square root of the number of observation. It depends on the function prasadraoest in the same package. Note that our function does not accept missing values.
Usage
fayherriot(response, designmatrix, sampling.var)
Arguments
response |
a numeric vector. It represents the response or the observed value in the Fay Herriot Model |
designmatrix |
a numeric matrix. The first column is a column of ones(also called the intercept). The other columns consist of observations of each of the covariates or the explanatory variable in Fay Herriot Model. |
sampling.var |
a numeric vector consisting of the known sampling variances of each of the small area levels. |
Details
For more details please see the attached vignette
Value
estimate |
estimate of the variance component |
Author(s)
Abhishek Nandy
References
On measuring the variability of small area estimators under a basic area level model. Datta, Rao, Smith. Biometrika(2005),92, 1,pp. 183-196 Large Sample Techniques for Statistics, Springer Texts in Statistics. Jiming Jiang. Chapters - 4,12 and 13.
See Also
prasadraoest
maximlikelihood
resimaxilikelihood
Examples
response=c(1,2,3,4,5)
designmatrix=cbind(c(1,1,1,1,1),c(1,2,4,4,1),c(2,1,3,1,5))
randomeffect.var=c(0.5,0.7,0.8,0.4,0.5)
fayherriot(response,designmatrix,randomeffect.var)
Maximum likelihood estimates of the variance components and the unknown regression coefficients in Fay Herriot Model.
Description
This function returns a list of three elements the first one is the maximum likelihood estimate of the variance component,the second one is a vector of the maximum likelihood estimate of the unknown regression coefficients the first one being the coefficient of the intecept and the remaining ones are in the same order as the columns of the design matrix and the last one being the value of the maximized loglikelihood function in Fay Herriot model. it uses the optim in the stats package and the BFGS algorithm to minimize the negative loglikelihood. The initial value for this iterative proceedure of maximization are chosen as follows. The initial value for the variance component is the fay Prasad-rao estimate of the variance component, the initial value for the regression coefficients are the estimates of the regression coefficients using the multiple linear regression and ignoring the random effects.(For more details see vignette). Note that our function does not accept any missing values.
Usage
maximlikelihood(response, designmatrix, sampling.var)
Arguments
response |
A numeric vector. It represents the response or the direct survey based estimators in the Fay Herriot Model |
designmatrix |
A numeric matrix. The first column is a column of ones(also called the intercept). The other columns consist of observations of each of the covariates or the explanatory variable in Fay Herriot Model. |
sampling.var |
A numeric vector consisting of the known sampling variances of each of the small area levels. |
Details
For more details please see the package vignette
Value
estimate |
Maximum likelihood estimate of the variance component |
reg.coefficients |
Maximum likelihood estimate of the unknown regression coefficients |
loglikeli.optimum |
The maximized value of the log likelihood function |
Author(s)
Abhishek Nandy
References
On measuring the variability of small area estimators under a basic area level model. Datta, Rao, Smith. Biometrika(2005),92, 1,pp. 183-196 Large Sample Techniques for Statistics, Springer Texts in Statistics. Jiming Jiang. Chapters - 4,12 and 13.
See Also
prasadraoest
fayherriot
resimaxilikelihood
Examples
response=c(1,2,3,4,5)
designmatrix=cbind(c(1,1,1,1,1),c(1,2,4,4,1),c(2,1,3,1,5))
randomeffect.var=c(0.5,0.7,0.8,0.4,0.5)
maximlikelihood(response,designmatrix,randomeffect.var)
Estimate of the variance component in Fay Herriot Model using Prasad Rao Method
Description
This function returns a list with one element in it which is the estimate of the variance component in the Fay Herriot Model. The method used to get the estimate is the prasad rao method also known as BLUP.(for details see vignette). Note that our function does not accept any missing values.
Usage
prasadraoest(response, designmatrix, sampling.var)
Arguments
response |
a numeric vector. It represents the response or the observed value in the Fay Herriot Model |
designmatrix |
a numeric matrix. The first column is a column of ones(also called the intercept). The other columns consist of observations of each of the covariates or the explanatory variable in Fay Herriot Model. |
sampling.var |
a numeric vector consisting of the known sampling variances of each of the small area levels. |
Details
For more details see the package vignette
Value
estimate |
estimate of the variance component |
Author(s)
Abhishek Nandy
References
On measuring the variability of small area estimators under a basic area level model. Datta, Rao, Smith. Biometrika(2005),92, 1,pp. 183-196 Large Sample Techniques for Statistics, Springer Texts in Statistics. Jiming Jiang. Chapters - 4,12 and 13.
See Also
fayherriot
maximlikelihood
resimaxilikelihood
Examples
response=c(1,2,3,4,5)
designmatrix=cbind(c(1,1,1,1,1),c(1,2,4,4,1),c(2,1,3,1,5))
randomeffect.var=c(0.5,0.7,0.8,0.4,0.5)
prasadraoest(response,designmatrix,randomeffect.var)
Estimate of the variance component in Fay Herriot Model using Residual Maximum Likelihood, REML.
Description
This function returns a list with one element in it which is the estimate of the variance component in the Fay Herriot Model using residual maximum likelihood method. The estimates are obtained as a solution of equations known as REML equations. The solution is obtained numerically using Fisher-scoring algorithm. For more details please see the package vignette and the references. Note that our function does not accept any missing values.
Usage
resimaxilikelihood(response, designmatrix, sampling.var,maxiter)
Arguments
response |
a numeric vector. It represents the response or the observed value in the Fay Herriot Model |
designmatrix |
a numeric matrix. The first column is a column of ones(also called the intercept). The other columns consist of observations of each of the covariates or the explanatory variable in Fay Herriot Model. |
sampling.var |
a numeric vector consisting of the known sampling variances of each of the small area levels. |
maxiter |
maximum number of iterations of fisher scoring |
Details
For more details see the package vignette
Value
estimate |
estimate of the variance component |
Author(s)
Abhishek Nandy
References
On measuring the variability of small area estimators under a basic area level model. Datta, Rao, Smith. Biometrika(2005),92, 1,pp. 183-196 Large Sample Techniques for Statistics, Springer Texts in Statistics. Jiming Jiang. Chapters - 4,12 and 13. Small Area Estimation, JNK Rao,Wiley 2003 Variance Components, Wiley Series in Probability and Statistics,2006 Searle, Casella, Mc-Culloh
See Also
prasadraoest
maximlikelihood
fayherriot
Examples
response=c(1,2,3,4,5)
designmatrix=cbind(c(1,1,1,1,1),c(1,2,4,4,1),c(2,1,3,1,5))
randomeffect.var=c(0.5,0.7,0.8,0.4,0.5)
resimaxilikelihood(response,designmatrix,randomeffect.var,100)
Fits a Fay Herriot Model to data
Description
Fits a Fay Herriot model to the data and returns a list of items which area estimates of different paramaters and mse of the estimates of the small area means the details of which are provided in the value section.
Usage
smallareafit(formula, data, method)
Arguments
formula |
an object of class formula. a formula similar in appearance to that of in lm function in R. It has to be ascertained that the data contains a column of the sampling variances, and that while specifying the formula the the name of the variable that contains the sampling variances should preceede the variables which are the covariates. e.g response~D+x1+x2 is a correct way of specifying the formula where as response~x1+D+x2 is not.(note D is the variabe that contains the values of sampling variances and x1 and x2 are covariates). In general the first of the variables on the right hand side of ~ will be treated as the vector of sampling variance. Note that our function does not accept any missing values. |
data |
an optional data.frame. containg the variable names and data. in absence of this arguments the function will accept the corresponding things from the global environment. |
method |
method can be from "PR", "FH", "ML", "REML" |
Details
for more details see the vignette
Value
smallmean.est |
Estimates of the small area mean |
smallmean.mse |
Mean Square Prediction error of the estimates of the small area mead |
var.comp |
an estimate of the variance components |
est.coef |
an estimate of the regression coefficients |
Author(s)
Abhishek Nandy
References
On measuring the variability of small area estimators under a basic area level model. Datta, Rao, Smith. Biometrika(2005),92, 1,pp. 183-196 Large Sample Techniques for Statistics, Springer Texts in Statistics. Jiming Jiang. Chapters - 4,12 and 13. Small Area Estimation, JNK Rao, Wiley 2003 Variance Components, Wiley Series in Probability and Statistics,2006 Searle, Casella, Mc-Culloh
See Also
prasadraoest
fayherriot
resimaxilikelihood
maximlikelihood
Examples
data=data.frame(response=c(1,2,3,4,8),D=c(0.2,0.5,0.1,0.9,1))
data
ans=smallareafit(response~D,data,method="FH")
ans1=smallareafit(response~D,data,method="REML")
ans2=smallareafit(response~D,data,method="PR")
ans3=smallareafit(response~D,data,method="ML")