prepare a MICS dataset for analysis
prep_mics_sib_histories.Rdprepare a MICS dataset for analysis
Usage
prep_mics_sib_histories(
mm.df,
survey,
wm.df = NULL,
varmap = sibhist_varmap_mics6,
id.vars = c("hh1", "hh2", "ln"),
doi.var = "wdoi",
doi.ym = c("wm6y", "wm6m"),
dob.var = "wdob",
lowercase = TRUE,
weight.scale = 1,
add_maternal = FALSE,
style = c("mics6", "mics4"),
na.action = NULL,
preg.window = c("2months", "42days"),
keep_missing = FALSE,
keep_varmap_only = FALSE,
death.exposure = c("dhs", "mics"),
verbose = TRUE
)Arguments
- mm.df
the MICS maternal mortality file (
mm.sav), one row per reported sibling- survey
string identifying the survey, eg
"ZW2019". Required: MICS has nov000equivalent, so this cannot be derived; see Details- wm.df
optional women's file (
wm.sav), joined onid.varsto bring across respondent attributes thatmm.dfdoes not carry- varmap
see Details; defaults to
sibhist_varmap_mics6- id.vars
columns of
mm.dfthat together identify a respondent. Combined to formcaseid- doi.var
column holding the date of interview as a CMC. Used when present; otherwise
doi.ymis used- doi.ym
year and month columns from which to construct a CMC date of interview, when
doi.varis absent- dob.var
column holding the respondent's date of birth as a CMC, used to derive respondent age
- lowercase
lowercase all variable names before matching the varmap? See Details
- weight.scale
divide the weight by this number. Defaults to
1, since MICS weights are already normalized; see Details- add_maternal
should maternal/pregnancy-related death info be added?
- style
which MICS roster coding the data use:
"mics6"(the default, also correct for MICS7) or"mics4"(also correct for MICS5). Only used whenadd_maternal = TRUE- na.action
required when
add_maternal = TRUE; see add_maternal_deaths- preg.window
width of the postpartum window for the pregnancy-related column;
"42days"reproduces published MICS tables. See add_maternal_deaths- keep_missing
should we keep reported sibs that are missing sex or survival status?
- keep_varmap_only
should we only keep ego variables mentioned in the varmap?
- death.exposure
whether a sibling who died contributes the month of death as exposure;
"dhs"(default) counts it,"mics"stops the month before. See get_sib_df- verbose
report detailed summaries?
Details
MICS publishes the sibling history as a dedicated file with one row per reported sibling, unlike the DHS, which publishes a wide women's file with one column per sibling attribute per sibling. So no reshape is needed, and this function does not call attributes.to.long.
survey has no default because MICS has no v000 equivalent. Supplying it
explicitly keeps MICS survey ids comparable with the DHS codes.
weight.scale defaults to 1 because MICS weights (wmweight) are already
normalized to average 1. Do not pass 1e6 here: that is a DHS convention.
MICS .sav files use mixed case – questionnaire items and link keys are
uppercase (MM15, HH1, WDOI) while derived and design variables are
lowercase (wmweight, psu, welevel) – so lowercase = TRUE normalizes
them and every shipped MICS varmap is written in lowercase.
Several columns the rest of the pipeline requires are not in every MICS file and are constructed here when absent:
caseid– fromid.vars; MICS has no single respondent iddoi– fromdoi.var, elsedoi.ym. Must end up a CMCage– respondent age, from(doi - dob.var) / 12psu– from the first ofid.vars(the cluster) when nopsucolumn exists, which is the case in most MICS surveyssex– constant'f'; MICS interviews only women
sib.dob and sib.death.date are used when the varmap supplies them
(MM17C/MM18C in MICS6, MM7C/MM8C in MICS4/5) and approximated from
reported ages and years-since-death otherwise.
varmap has the same format as the DHS varmaps: columns orig.varname,
new.varname and sibvar.
Returns a list whose entries include
ego.dat- dataset with information about the survey respondentssib.dat- dataset with information about the reported siblingssumm- a one-row tibble with a summary of the data