clusterModel {surveyPrev}R Documentation

Calculate cluster model estimates using beta binomial model

Description

This function calculate smoothed direct estimates at given admin level.

Usage

clusterModel(
  data,
  cluster.info,
  admin.info,
  admin,
  CI = 0.95,
  model = c("bym2", "iid"),
  stratification = FALSE,
  aggregation = FALSE,
  overdisp.mean = 0,
  overdisp.prec = 0.4
)

Arguments

data

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

cluster.info

dataframe that contains admin 1 and admin 2 information and coordinates for each cluster.

admin.info

dataframe that contains population and urban/rural proportion at specific admin level

admin

admin level for the model

CI

Credible interval to be used. Default to 0.95.

model

smoothing model used in the random effect. Options are independent ("iid") or spatial ("bym2").

stratification

whether or not to include urban/rural stratum.

aggregation

whether or not report aggregation results.

overdisp.mean

prior mean for logit(d), where d is the intracluster correlation.

overdisp.prec

prior precision for logit(d), where d is the intracluster correlation.

Value

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

Author(s)

Qianyu Dong

Examples

## Not run: 
geo <- getDHSgeo(country = "Zambia", year = 2018)
data(ZambiaAdm1)
data(ZambiaAdm2)
data(ZambiaPopWomen)
cluster.info <- clusterInfo(geo = geo,
                            poly.adm1 = ZambiaAdm1,
                            poly.adm2 = ZambiaAdm2)

dhsData <- getDHSdata(country = "Zambia",
                                 indicator = "ancvisit4+",
                                 year = 2018)

data <- getDHSindicator(dhsData, indicator = "ancvisit4")
admin.info1 <- adminInfo(poly.adm = ZambiaAdm1,
                        admin = 1,
                        agg.pop =ZambiaPopWomen$admin1_pop,
                        proportion = ZambiaPopWomen$admin1_urban)
cl_res_ad1 <- clusterModel(data=data,
                  cluster.info = cluster.info,
                  admin.info = admin.info1,
                  stratification = FALSE,
                  model = "bym2",
                  admin = 1,
                  aggregation = TRUE,
                  CI = 0.95)
cl_res_ad1$res.admin1

# compare with the DHS direct estimates
dhs_table <- get_api_table(country = "ZM",
                           survey = "ZM2018DHS",
                           indicator = "RH_ANCN_W_N4P",
                           simplify = TRUE)
subset(dhs_table, ByVariableLabel == "Five years preceding the survey")


## End(Not run)


[Package surveyPrev version 1.0.0 Index]