Learn R Programming

msaeDB (version 0.2.1)

saedbns: EBLUPs under Univariate Fay Herriot Model with Difference Benchmarking for non-sampled area

Description

This function produces EBLUPs, MSE, and aggregation of Univariate SAE with Difference Benchmarking for non-sampled area

Usage

saedbns(
  formula,
  vardir,
  weight,
  cluster,
  nonsample,
  samevar = FALSE,
  MAXITER = 100,
  PRECISION = 1e-04,
  data
)

Arguments

formula

List of formula that describe the fitted model

vardir

Sampling variances of direct estimations included in data frame as the vector with the name of sampling variances in order : var1, cov12,.,cov1r,var2,cov23,.,cov2r,.,cov(r-1)(r),var(r)

weight

Known proportion of units in small areas, where \(\sum_{d=1}^{D}\) \(W_{rd}\) = 1 . d = 1 ... D is the number of small areas, and r = 1 ... R is the number of response variables

cluster

cluster information

nonsample

A column with logical values, TRUE if the area is non-sampled

samevar

Whether the variances of the data are same or not. Logical input with default FALSE

MAXITER

Maximum number of iteration in Fisher-scoring algorithm with default 100

PRECISION

Limit of Fisher-scoring convergence tolerance with default 1e-4

data

The data frame

Value

This function returns a list of the following objects:

SAE_Eblup_sampled

A dataframe with the values of the EBLUPs estimators for sampled areas

SAE_Eblup_all

A dataframe with the values of the EBLUPs estimators for all areas

MSE_Eblup_sampled

A dataframe with the values of estimated mean square errors of EBLUPs estimators for sampled areas

MSE_Eblup_all

A dataframe with the values of estimated mean square errors of EBLUPs estimators for all areas

randomEffect_sampled

a dataframe with the values of the random effect estimators for sampled areas

randomEffect_all

a dataframe with the values of the random effect estimators for all areas

Rmatrix_sampled

a block diagonal matrix composed of sampling errors for sampled areas

fit

A list containing the following objects:

method : The fitting method (this function is using "REML") convergence : The convergence result of Fisher-scoring algorithm (Logical Value) iterations : The number of Fisher-Scoring algorithm iterations estcoef : A dataframe with the estimated model coefficient, standard error,t statistics, p-values of the significance of each coefficient refvar : A dataframe with estimated random effect variances informationFisher : A matrix of information fisher from Fisher-scoring algorithm

difference_benchmarking

a list containing the following objects:

Estimation_sampled : A dataframe with the values of benchmarked EBLUPs estimators for sampled areas Estimation_all : A dataframe with the values of benchmarked EBLUPs estimators for all areas Aggregation_sampled : The aggregation of benchmarked EBLUPs estimators, EBLUPs estimators and direct estimations for sampled areas Aggregation_all : The aggregation of benchmarked EBLUPs estimators, EBLUPs estimators and direct estimations for all areas MSE_DB_sampled : A dataframe with the values of estimated mean square errors of benchmarked EBLUPs estimators for sampled areas MSE_DB_all : A dataframe with the values of estimated mean square errors of benchmarked EBLUPs estimators for all areas g.4a : First component of g4 in difference benchmarking MSE estimation formula g.4b : Second component of g4 in difference benchmarking MSE estimation formula

Examples

Run this code
# NOT RUN {
##load dataset
data(datamsaeDBns)
#Note : Make sure yout dataset does not contain NA Values
#       you can set 0 in Direct estinations and vardir for non-sampled areas.

#Compute Fitted model for Y1, Y2, and Y3
#Y1 ~ X1 + X2
#Y2 ~ X1 + X2
#Y3 ~ X1 + X2

##Using parameter 'data'
formula = list(f1 = Y1~X1+X2,
               f2 = Y2~X1+X2,
               f3 = Y3~X1+X2)
vardir = c("v1","v12","v13","v2","v23","v3")
weight = c("w1","w2","w3")
cluster = c("clY1","clY2","clY3")
nonsample = "nonsample"
saeDBns <- saedbns(formula,vardir, weight,cluster, nonsample, data=datamsaeDBns)

#to calculate only one response variable
saeDB1 <- saedbns(formula=list(f1=Y1~X1+X2),vardir ="v1", weight="w1",
         cluster = "clY1",nonsample = "nonsample",data=datamsaeDBns )

# }

Run the code above in your browser using DataLab