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 |
Estimates alpha and beta parameter to obtain EB estimator
alphabetaEB(data.dir, pcap, method, opt, maxiter, tol)
alphabetaEB(data.dir, pcap, method, opt, maxiter, tol)
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 |
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 |
## 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)
## 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
bootstrapEB(data, method, opt, seed = NA, maxiter = 25, tol = 1e-05, B = 50)
bootstrapEB(data, method, opt, seed = NA, maxiter = 25, tol = 1e-05, B = 50)
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 |
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 |
Rao J, Peralta IM (2015). Small Area Estimation Second Edition. John Wiley & Sons, Inc.,Hoboken, New Jersey, Canada. ISBN 978-1-118-73578-7.
## 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)
## 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)
An example data for trying and testing in saebnocov package
dataEB
dataEB
A sample data has 3 column, which are:
code of each area
status "success" or not in each unit sample of each area
a weight value in each unit sample of each area
data(dataEB)
data(dataEB)
Small Area Estimation method with Empirical Bayes and its RRMSE value by Naive Method
EBnaive(data, method, opt, maxiter = 100, tol = 1e-05)
EBnaive(data, method, opt, maxiter = 100, tol = 1e-05)
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 |
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 |
## 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)
## 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
estEBnaive(data.dir, pcap, param)
estEBnaive(data.dir, pcap, param)
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 |
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 |
## 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)
## 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
jackknifeEB(data, method, opt, maxiter = 100, tol = 1e-05)
jackknifeEB(data, method, opt, maxiter = 100, tol = 1e-05)
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 |
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 |
## 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)
## 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.
matrixClaire(alpha, beta)
matrixClaire(alpha, beta)
alpha |
An alpha estimate value on iterating process |
beta |
A beta estimate value on iterating process |
This function returns a value of matrix G.
## 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)
## 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
matrixRao(alpha, beta, ni, yi)
matrixRao(alpha, beta, ni, yi)
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 |
This function returns a value of matrix G.
## 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)
## 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.
momentClaire(data.dir, pcap)
momentClaire(data.dir, pcap)
data.dir |
Direct estimates of the data from function pcapdir |
pcap |
weighted sample mean and variance from function pcapdir |
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. |
## 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)
## 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
momentRao(data.dir, pcap)
momentRao(data.dir, pcap)
data.dir |
Direct estimates of the data from function pcapdir |
pcap |
weighted sample mean and variance from function pcapdir |
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. |
## 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)
## 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.
newtonRaphsonC(data.dir, pcap, maxiter, tol)
newtonRaphsonC(data.dir, pcap, maxiter, tol)
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 |
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. |
## 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)
## 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
newtonRaphsonR(data.dir, pcap, maxiter, tol)
newtonRaphsonR(data.dir, pcap, maxiter, tol)
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 |
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 |
## 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)
## 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
pcapdir(data)
pcapdir(data)
data |
the data must contain two or three columns : code, y, and weight data if exist. |
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) |
## load dataset with no weight value data(dataEB) pcapdir(dataEB[,-c(3)]) ##load dataset with weight value data(dataEB) pcapdir(dataEB)
## 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.
vectorClaire(alpha, beta, p)
vectorClaire(alpha, beta, p)
alpha |
An alpha estimate value on iterating process |
beta |
A beta estimate value on iterating process |
p |
direct estimator or proportion value |
This function returns a value of vector g.
## 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)
## 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
vectorRao(alpha, beta, ni, yi)
vectorRao(alpha, beta, ni, yi)
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 |
This function returns a value of vector g.
## 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)
## 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)