Package 'saebnocov'

Title: Small Area Estimation using Empirical Bayes without Auxiliary Variable
Description: Estimates the parameter of small area in binary data without auxiliary variable using Empirical Bayes technique, mainly from Rao and Molina (2015,ISBN:9781118735787) with book entitled "Small Area Estimation Second Edition". This package provides another option of direct estimation using weight. This package also features alpha and beta parameter estimation on calculating process of small area. Those methods are Newton-Raphson and Moment which based on Wilcox (1979) <doi:10.1177/001316447903900302> and Kleinman (1973) <doi:10.1080/01621459.1973.10481332>.
Authors: Siti Rafika Fiandasari [aut, cre], Margaretha Ari Anggorowati [aut], Bahrul Ilmi Nasution [aut]
Maintainer: Siti Rafika Fiandasari <[email protected]>
License: GPL (>= 3)
Version: 0.1.0
Built: 2024-11-10 05:00:21 UTC
Source: https://github.com/cran/saebnocov

Help Index


Estimates alpha and beta parameter to obtain EB estimator

Description

Estimates alpha and beta parameter to obtain EB estimator

Usage

alphabetaEB(data.dir, pcap, method, opt, maxiter, tol)

Arguments

data.dir

Direct estimates of the data from function pcapdir

pcap

weighted sample mean and variance from function pcapdir

method

Method to estimate alpha and beta parameter according to person(rao or claire)

opt

Method to estimate alpha and beta parameter according to the way of calculation (moment or nr)

maxiter

the Maximum iteration value

tol

Tolerance error value at iteration

Value

This function returns a data frame with following objects :

alpha_cap

an alpha estimator by user's choice method

beta_cap

an beta estimator by user's choice method

Examples

## load dataset with no weight value
data(dataEB)
temp = pcapdir(dataEB[,-c(3)])
## estimates alpha and beta parameter
## in EB estimate with Moment method by J.N.K.Rao
alphabetaEB(data.dir = temp$direst ,pcap = temp$pcap,
method = "rao", opt = "moment",maxiter = 100,tol = 0.00001)

##load dataset with weight value
data(dataEB)
temp = pcapdir(dataEB)
## estimates alpha and beta parameter
## in EB estimate with Moment method by Claire E.B.O.
alphabetaEB(data.dir = temp$direst ,pcap = temp$pcap,
method = "claire", opt = "moment",maxiter = 100,tol = 0.00001)

Small Area Estimation method with Empirical Bayes and its RRMSE value by Bootstrap Method

Description

Small Area Estimation method with Empirical Bayes and its RRMSE value by Bootstrap Method

Usage

bootstrapEB(data, method, opt, seed = NA, maxiter = 25, tol = 1e-05, B = 50)

Arguments

data

the data must contain two or three columns : code, y, and weight data if exist.

method

Method to estimate alpha and beta parameter according to person(rao or claire)

opt

Method to estimate alpha and beta parameter according to the way of calculation (moment or nr)

seed

Setting a seed in set.seed() function to initialize a pseudorandom number generator with default number 0

maxiter

the Maximum iteration value with default 100

tol

Tolerance error value at iteration with default 0.00001

B

The number of iteration of bootstrap resampling with default 200

Value

This function returns a list with following objects :

finalres

an information about direct estimator and EB estimator in each area with its RRMSE value obtained by bootstrap method

eb.estimation

an information about EB estimator in each area with its RRMSE value obtained by Naive method

References

Rao J, Peralta IM (2015). Small Area Estimation Second Edition. John Wiley & Sons, Inc.,Hoboken, New Jersey, Canada. ISBN 978-1-118-73578-7.

Examples

## load dataset with no weight value
data(dataEB)
## Calculates EB estimator with its
## RRMSE value by Bootstrap method.
## Its alpha and beta estimator obtained
## by Moment method by J.N.K.Rao
bootstrapEB(data = dataEB[,-c(3)], method = "rao",
 opt = "moment", maxiter = 20, tol = 1e-5,B=20,seed=0)

##load dataset with weight value
data(dataEB)
## Calculates EB estimator with its
## RRMSE value by Bootstrap method.
## Its alpha and beta estimator obtained
## by Moment method by Claire E.B.O.
bootstrapEB(data = dataEB, method = "rao",
 opt = "moment", maxiter = 20, tol = 1e-5,B=20,seed=0)

Sample Data for Practice

Description

An example data for trying and testing in saebnocov package

Usage

dataEB

Format

A sample data has 3 column, which are:

code

code of each area

y

status "success" or not in each unit sample of each area

weight

a weight value in each unit sample of each area

Examples

data(dataEB)

Small Area Estimation method with Empirical Bayes and its RRMSE value by Naive Method

Description

Small Area Estimation method with Empirical Bayes and its RRMSE value by Naive Method

Usage

EBnaive(data, method, opt, maxiter = 100, tol = 1e-05)

Arguments

data

the data must contain two or three columns : code, y, and weight data if exist.

method

Method to estimate alpha and beta parameter according to person(rao or claire)

opt

Method to estimate alpha and beta parameter according to the way of calculation (moment or nr)

maxiter

the Maximum iteration value with default 100

tol

Tolerance error value at iteration with default 0.00001

Value

This function returns a list with following objects :

finalres

an information about direct estimatior and EB estimator in each area

estimation

an information about EB estimator and its RRMSE value obtained by Naive method

parameter

Alpha and beta estimator

pcap

pcap (the weighted sample mean), vardir (the weighted sample variance),yt (the total number of the "success" category from each area), and nt (the total number of sample from each area)

dir.est

an information about direct estimator

Examples

## load dataset with no weight value
data(dataEB)
## Calculates EB estimator
## with its RRMSE value by Naive method.
## Its alpha and beta estimator obtained
## by Moment method by J.N.K.Rao
EBnaive(data = dataEB[,-c(3)],method = "rao",opt = "moment", maxiter = 100, tol = 1e-5)

##load dataset with weight value
data(dataEB)
## Calculates EB estimator
## with its RRMSE value by Naive method.
## Its alpha and beta estimator obtained
## by Moment method by Claire E.B.O.
EBnaive(data = dataEB, method = "claire",opt = "moment", maxiter = 100, tol = 1e-5)

Small Area Estimation method with Empirical Bayes and its RRMSE value by Naive Method

Description

Small Area Estimation method with Empirical Bayes and its RRMSE value by Naive Method

Usage

estEBnaive(data.dir, pcap, param)

Arguments

data.dir

direct estimator information from function direct.est

pcap

pcap (the weighted sample mean), vardir (the weighted sample variance),yt (the total number of the "success" category from each area), and nt (the total number of sample from each area)

param

Alpha and Beta estimator

Value

This function returns a list with following objects :

eb.est

EB estimator in each area

mse

MSE of EB estimator obtained by Naive method

rrmse

RRMSE of EB estimator obtained by Naive method

Examples

## load dataset with no weight value
data(dataEB)
temp = pcapdir(dataEB[,-c(3)])

## estimates alpha and beta parameter
## in EB estimate with Moment method by J.N.K.Rao
temp1 = alphabetaEB(data.dir = temp$direst ,pcap = temp$pcap,
                      method = "rao", opt = "moment",
                      maxiter = 100,tol = 0.00001)

## calculates EB estimator
## and its MSE by naive method
estEBnaive(data.dir = temp$direst, pcap = temp$pcap, param = temp1)

Small Area Estimation method with Empirical Bayes and its RRMSE value by Jackknife Method

Description

Small Area Estimation method with Empirical Bayes and its RRMSE value by Jackknife Method

Usage

jackknifeEB(data, method, opt, maxiter = 100, tol = 1e-05)

Arguments

data

the data must contain two or three columns : code, y, and weight data if exist.

method

Method to estimate alpha and beta parameter according to person(rao or claire)

opt

Method to estimate alpha and beta parameter according to the way of calculation (moment or nr)

maxiter

the Maximum iteration value with default 100

tol

Tolerance error value at iteration with default 0.00001

Value

This function returns a list with following objects :

finalres

an information about direct estimator and EB estimator in each area with its RRMSE value obtained by jackknife method

eb.estimation

an information about EB estimator in each area with its RRMSE value obtained by Naive method

Examples

## load dataset with no weight value
data(dataEB)
## Calculates EB estimator with
## its RRMSE value by Jackknife method.
## Its alpha and beta estimator obtained
## by Moment method by J.N.K.Rao
jackknifeEB(data = dataEB[,-c(3)], method = "rao",
 opt = "moment", maxiter = 20, tol = 1e-5)

##load dataset with weight value
data(dataEB)
## Calculates EB estimator with
## its RRMSE value by Jackknife method.
## Its alpha and beta estimator obtained
## by Moment method by Claire E.B.O.
jackknifeEB(data = dataEB, method = "rao",
 opt = "moment", maxiter = 20, tol = 1e-5)

Matrix G in Newton Raphson method by Claire E.B.O.

Description

Matrix G in Newton Raphson method by Claire E.B.O.

Usage

matrixClaire(alpha, beta)

Arguments

alpha

An alpha estimate value on iterating process

beta

A beta estimate value on iterating process

Value

This function returns a value of matrix G.

Examples

## load dataset with no weight value
data(dataEB)
temp = pcapdir(dataEB[,-c(3)])

## estimates alpha and beta parameter
## in EB estimate with Moment method by J.N.K.Rao
temp1 = alphabetaEB(data.dir = temp$direst ,pcap = temp$pcap,
                      method = "rao", opt = "moment",
                      maxiter = 100,tol = 0.00001)

##calculates matrix G
matrixClaire(alpha = temp1$alpha_cap, beta = temp1$beta_cap)

Matrix G in Newton Raphson method by J.N.K.Rao

Description

Matrix G in Newton Raphson method by J.N.K.Rao

Usage

matrixRao(alpha, beta, ni, yi)

Arguments

alpha

An alpha estimate value on iterating process

beta

A beta estimate value on iterating process

ni

The number of sample in each area

yi

The number of "success" value in each area

Value

This function returns a value of matrix G.

Examples

## load dataset with no weight value
data(dataEB)
temp = pcapdir(dataEB[,-c(3)])

## estimates alpha and beta parameter
## in EB estimate with Moment method by J.N.K.Rao
temp1 = alphabetaEB(data.dir = temp$direst ,pcap = temp$pcap,
                      method = "rao", opt = "moment",
                      maxiter = 100,tol = 0.00001)

##calculates matrix G
matrixRao(alpha = temp1$alpha_cap,
 beta = temp1$beta_cap, ni = temp$direst$ni,
  yi = temp$direst$yi)

Estimates alpha and beta parameter with Moment method by Claire E.B.O.

Description

Estimates alpha and beta parameter with Moment method by Claire E.B.O.

Usage

momentClaire(data.dir, pcap)

Arguments

data.dir

Direct estimates of the data from function pcapdir

pcap

weighted sample mean and variance from function pcapdir

Value

This function returns a data frame with following objects :

alpha_cap

an alpha estimator by Moment method of Claire E.B.O.

beta_cap

a beta estimator by Moment method of Claire E.B.O.

Examples

## load dataset with no weight value
data(dataEB)
temp = pcapdir(dataEB[,-c(3)])
momentClaire(data.dir = temp$direst, pcap = temp$pcap)

##load dataset with weight value
data(dataEB)
temp = pcapdir(dataEB[,-c(3)])
momentClaire(data.dir = temp$direst, pcap = temp$pcap)

Estimates alpha and beta parameter with Moment method by J.N.K.Rao

Description

Estimates alpha and beta parameter with Moment method by J.N.K.Rao

Usage

momentRao(data.dir, pcap)

Arguments

data.dir

Direct estimates of the data from function pcapdir

pcap

weighted sample mean and variance from function pcapdir

Value

This function returns a data frame with following objects :

alpha_cap

an alpha estimator by Moment method of Claire E.B.O.

beta_cap

an beta estimator by Moment method of Claire E.B.O.

Examples

## load dataset with no weight value
data(dataEB)
temp = pcapdir(dataEB[,-c(3)])
momentRao(data.dir = temp$direst, pcap = temp$pcap)

##load dataset with weight value
data(dataEB)
temp = pcapdir(dataEB[,-c(3)])
momentRao(data.dir = temp$direst, pcap = temp$pcap)

Estimates alpha and beta parameter with Newton Raphson method by Claire E.B.O.

Description

Estimates alpha and beta parameter with Newton Raphson method by Claire E.B.O.

Usage

newtonRaphsonC(data.dir, pcap, maxiter, tol)

Arguments

data.dir

Direct estimates of the data from function pcapdir

pcap

weighted sample mean and variance from function pcapdir

maxiter

the Maximum iteration value

tol

Tolerance error value in iteration

Value

This function returns a data frame with following objects :

alpha_cap

an alpha estimator by Newton Raphson method of Claire E.B.O.

beta_cap

an beta estimator by Newton Raphson method of Claire E.B.O.

Examples

## load dataset with no weight value
data(dataEB)
temp = pcapdir(dataEB[,-c(3)])
newtonRaphsonC(data.dir = temp$direst, pcap = temp$pcap,
 maxiter = 100, tol = 0.00001)

##load dataset with weight value
data(dataEB)
temp = pcapdir(dataEB[,-c(3)])
newtonRaphsonC(data.dir = temp$direst, pcap = temp$pcap,
 maxiter = 100, tol = 0.00001)

Estimates alpha and beta parameter with Newton Raphson method by J.N.K. Rao

Description

Estimates alpha and beta parameter with Newton Raphson method by J.N.K. Rao

Usage

newtonRaphsonR(data.dir, pcap, maxiter, tol)

Arguments

data.dir

Direct estimates of the data from function pcapdir

pcap

weighted sample mean and variance from function pcapdir

maxiter

the Maximum iteration value

tol

Tolerance error value in iteration

Value

This function returns a data frame with following objects :

alpha_cap

an alpha estimator by Newton Raphson method of J.N.K.Rao

beta_cap

an beta estimator by Newton Raphson method of J.N.K.Rao

Examples

## load dataset with no weight value
data(dataEB)
temp = pcapdir(dataEB[,-c(3)])
newtonRaphsonR(data.dir = temp$direst, pcap = temp$pcap,
 maxiter = 100, tol = 0.00001)

##load dataset with weight value
data(dataEB)
temp = pcapdir(dataEB)
newtonRaphsonR(data.dir = temp$direst, pcap = temp$pcap,
 maxiter = 100, tol = 0.00001)

Weighted Sample Mean and Variance

Description

Weighted Sample Mean and Variance

Usage

pcapdir(data)

Arguments

data

the data must contain two or three columns : code, y, and weight data if exist.

Value

This function returns a list with following objects :

direst

an information about direct estimatior in each area

pcap

pcap (the weighted sample mean), vardir (the weighted sample variance),yt (the total number of the "success" category from each area), and nt (the total number of sample from each area)

Examples

## load dataset with no weight value
data(dataEB)
pcapdir(dataEB[,-c(3)])

##load dataset with weight value
data(dataEB)
pcapdir(dataEB)

Vector g in Newton Raphson Method by Claire E.B.O.

Description

Vector g in Newton Raphson Method by Claire E.B.O.

Usage

vectorClaire(alpha, beta, p)

Arguments

alpha

An alpha estimate value on iterating process

beta

A beta estimate value on iterating process

p

direct estimator or proportion value

Value

This function returns a value of vector g.

Examples

## load dataset with no weight value
data(dataEB)
temp = pcapdir(dataEB[,-c(3)])

## estimates alpha and beta parameter
## in EB estimate with Moment method by J.N.K.Rao
temp1 = alphabetaEB(data.dir = temp$direst ,pcap = temp$pcap,
                      method = "rao", opt = "moment",
                      maxiter = 100,tol = 0.00001)

##calculates vector g
vectorClaire(alpha = temp1$alpha_cap, beta = temp1$beta_cap, p = temp$direst$p)

Vector g in Newton Raphson Method by J.N.K.Rao

Description

Vector g in Newton Raphson Method by J.N.K.Rao

Usage

vectorRao(alpha, beta, ni, yi)

Arguments

alpha

An alpha estimate value on iterating process

beta

A beta estimate value on iterating process

ni

The number of sample in each area

yi

The number of "success" value in each area

Value

This function returns a value of vector g.

Examples

## load dataset with no weight value
data(dataEB)
temp = pcapdir(dataEB[,-c(3)])

## estimates alpha and beta parameter
## in EB estimate with Moment method by J.N.K.Rao
temp1 = alphabetaEB(data.dir = temp$direst ,pcap = temp$pcap,
                      method = "rao", opt = "moment",
                      maxiter = 100,tol = 0.00001)

##calculates vector g
vectorRao(alpha = temp1$alpha_cap, beta = temp1$beta_cap,
 ni = temp$direst$ni, yi = temp$direst$yi)