directEST_varfix: Calculate direct estimates

directEST_varfixR Documentation

Calculate direct estimates

Description

This function calculate direct estimates at given admin level.

Usage

directEST_varfix(
  data,
  cluster.info,
  admin,
  strata = "all",
  CI = 0.95,
  weight = c("population", "survey")[1],
  admin.info = NULL,
  aggregation = FALSE,
  alt.strata = NULL,
  var.fix = TRUE,
  eps = 1e-12,
  floor_var = 1e-12,
  tol = 1e-12,
  all.fix = FALSE,
  ...
)

Arguments

data

dataframe that contains the indicator of interests, output of getDHSindicator function

cluster.info

list contains data and wrong.points. data contains admin 1 and admin 2 information and coordinates for each cluster. wrong.points. contains cluster id for cluster without coordinates or admin 1 information. Output of getDHSindicator function

admin

admin level for the model.

strata

use only urban or rural data, only for national level model

CI

Credible interval to be used. Default to 0.95.

weight

the weight used for aggregating result, "population" or "survey"

admin.info

list contains data and mat, data contains population and urban/rural proportion at specific admin level and mat is the adjacency matrix, output of adminInfo function

aggregation

whether or not report aggregation results.

alt.strata

the variable name in the data frame that correspond to the stratification variable. Most of the DHS surveys are stratified by admin 1 area crossed with urban/rural, which is the default stratification variable created by the function (when alt.strata = NULL). When a different set of strata is used. The stratification variable should be included in the data and alt.strata should be set to the column name.

var.fix

Whether to add phantom cluster to fix direct estimate with variance close to 0.

eps

the threshold of variance to implement the variance fix method.

floor_var

the threshold of variance to implement the variance fix method.

tol

the threshold of variance to implement the variance fix method.

all.fix

Whether to add phantom cluster to all areas

...

Additional arguments passed on to the 'smoothSurvey' function

Value

This function returns the dataset that contain district name and population for given tiff files and polygons of admin level,

Examples

## Not run: 

##
## Direct estimation of ANC visit 4+ proportion
##

geo <- getDHSgeo(country = "Zambia", year = 2018)
data(ZambiaAdm1)
data(ZambiaAdm2)
data(ZambiaPopWomen)
cluster.info<-clusterInfo(geo=geo, poly.adm1=ZambiaAdm1, poly.adm2=ZambiaAdm2,
by.adm1 = "NAME_1",by.adm2 = "NAME_2")
# "RH_ANCN_W_N4P" is an indicator for having more than four ANC visits.
#  In previous versions of the package, it is labeled "ancvisit4+".
dhsData <- getDHSdata(country = "Zambia",
                                 indicator = "RH_ANCN_W_N4P",
                                 year = 2018)
data <- getDHSindicator(dhsData, indicator = "RH_ANCN_W_N4P")
res_ad1 <- directEST_new(data = data,
                  cluster.info = cluster.info,
                  admin = 1,
                  aggregation = FALSE)

## End(Not run)


surveyPrev documentation built on June 19, 2026, 5:06 p.m.