| Title: | Methods for Multiple Systems Estimation |
|---|---|
| Description: | Methods for multiple systems estimation using Poisson log-linear models, with particular attention to sparse capture data, model selection and its associated uncertainty, and Bayesian thresholding of interaction effects. The package implements and extends methodology from Silverman (2020) <doi:10.1111/rssa.12505>, Chan, Silverman and Vincent (2021) <doi:10.1080/01621459.2019.1708748>, and Silverman, Chan and Vincent (2024) <doi:10.1007/s11222-023-10346-9>. |
| Authors: | Bernard W. Silverman [aut, cre], Lax Chan [ctb], Kyle Vincent [ctb] |
| Maintainer: | Bernard W. Silverman <[email protected]> |
| License: | GPL (>= 2) |
| Version: | 1.3.2 |
| Built: | 2026-10-23 09:59:50 UTC |
| Source: | https://github.com/bernardsilverman/multiplesystemsestimation |
An artificial three-list data set used to demonstrate failures of the
conditions tested by check_extended_MLE. The data appear
in Table 2 of Chan, Silverman and Vincent (2021).
Artificial_3Artificial_3
A data frame with 4 rows and 4 columns. Columns A,
B and C are binary list-membership indicators. Column
n gives the number of cases having each observed capture history.
If all three two-list interactions are included,
check_extended_MLE() returns status 2: the extended MLE exists,
but the model matrix is not of full rank and the parameters are not
identifiable. If the model contains AB, either alone or together with
AC or BC, the extended MLE does not exist. The main-effects model and
models containing either or both of AC and BC, but not AB, pass both
checks.
Chan, L., Silverman, B. W. and Vincent, K. (2021). Multiple Systems Estimation for Sparse Capture Data: Inferential Challenges When There Are Nonoverlapping Lists. Journal of the American Statistical Association, 116(535), 1297–1306. doi:10.1080/01621459.2019.1708748.
Checks whether a hierarchical log-linear model satisfies both the Fienberg–Rinaldo condition for existence of the extended maximum-likelihood estimate and the rank condition required for identifiable model parameters.
check_extended_MLE(data, model)check_extended_MLE(data, model)
data |
Capture history data in the standard package format, with one indicator column for each list followed by a count column. |
model |
A character string specifying a hierarchical model, such as
|
Two distinct conditions are checked.
The Fienberg–Rinaldo condition determines whether the required extended maximum-likelihood fit exists, allowing for parameters corresponding to sparse interactions to be estimated at minus infinity.
The relevant model matrix is also checked for full column rank. Failure of this condition means that the model parameters are not identifiable.
The two checks are carried out separately, so either one or both may fail.
A single integer status code:
0Both conditions are satisfied.
1The Fienberg–Rinaldo condition fails.
2The model parameters are not identifiable.
3Both conditions fail.
Fienberg, S. E. and Rinaldo, A. (2012). Maximum likelihood estimation in log-linear models. The Annals of Statistics, 40, 996–1023.
Chan, L., Silverman, B. W. and Vincent, K. (2021). Multiple Systems Estimation for Sparse Capture Data: Inferential Challenges When There Are Nonoverlapping Lists. Journal of the American Statistical Association, 116(535), 1297–1306. doi:10.1080/01621459.2019.1708748.
data(Artificial_3) check_extended_MLE( Artificial_3, "[12,13,23]" ) # The result is 2: the existence condition is satisfied, # but the model parameters are not identifiable.data(Artificial_3) check_extended_MLE( Artificial_3, "[12,13,23]" ) # The result is 2: the existence condition is satisfied, # but the model parameters are not identifiable.
Provides a common interface to the principal population-estimation methods in MultipleSystemsEstimation.
estimate_population( zdat, method = c("auto", "bic", "stepwise", "fixed", "bayesthresh"), ... )estimate_population( zdat, method = c("auto", "bic", "stepwise", "fixed", "bayesthresh"), ... )
zdat |
Capture history data. A matrix with one more column than the number of lists. Each row corresponds to an observed capture history with 1 in the columns corresponding to the capture lists in the history, and 0 otherwise. The last column contains the observed count for the capture history. |
method |
Estimation method. One of |
... |
Additional arguments passed to the selected estimation
function. See |
The default method is "auto". This selects the BIC-based method
when there are no more than five lists, and the stepwise method when
there are six or more lists.
For six-list data, the BIC method remains available by specifying
method = "bic", but exhaustive BIC enumeration is computationally
burdensome. Accordingly, method = "auto" selects the stepwise
method for six-list data.
The estimation method can be selected explicitly using
method = "bic", "stepwise", "bayesthresh", or
"fixed".
Through their respective maxorder arguments,
the stepwise, BIC and Bayesian-threshold methods can all be restricted to
two-list interactions, or consider higher-order interactions.
Method-specific arguments are passed through ... to the selected
estimation function. See the documentation for the individual methods
for details of the available arguments and their defaults.
A list with components:
inputA list containing the original call and
data.
methodThe method actually used, including after
method = "auto" has been resolved.
estimateA named numeric vector containing the estimated
dark_figure and total population.
fitted_modelThe supplied, selected or retained model in hierarchy notation.
uncertaintyConfidence or credible endpoints for the dark figure and total population, or an explanatory character string when bootstrap inference was not requested.
detailsMethod-specific supporting output when requested,
and "not requested" otherwise.
estimate_population_bic,
estimate_population_stepwise,
estimate_population_bayesthresh,
estimate_population_fixed
data(Korea) # Three lists: automatically uses the BIC method. estimate_population(Korea) # Pass BIC-specific arguments through ... estimate_population( Korea, method = "bic", nboot = 100 ) # Pass stepwise-specific arguments through ... estimate_population( Korea, method = "stepwise", pthresh = 0.02 ) # The bayesthresh method estimate_population( Western, method = "bayesthresh", burnin = 100, mcmc = 1000 ) # Pass a fixed-model specification through ... estimate_population( Korea, method = "fixed", model = "[12,23]" )data(Korea) # Three lists: automatically uses the BIC method. estimate_population(Korea) # Pass BIC-specific arguments through ... estimate_population( Korea, method = "bic", nboot = 100 ) # Pass stepwise-specific arguments through ... estimate_population( Korea, method = "stepwise", pthresh = 0.02 ) # The bayesthresh method estimate_population( Western, method = "bayesthresh", burnin = 100, mcmc = 1000 ) # Pass a fixed-model specification through ... estimate_population( Korea, method = "fixed", model = "[12,23]" )
Fits the Bayesian-threshold estimator of Silverman (2020), based on a Poisson log-linear model for the capture history counts.
The intercept and main effects have independent improper flat priors.
For the interaction parameters, a proper normal prior is used by default;
an improper flat prior can instead be specified. For the Bayesian parts of
the procedure, inference is carried out by Markov chain Monte Carlo, calling
MCMCpack::MCMCpoisson().
The method begins by including all two-list interactions. The interactions
are then thresholded by discarding those for which the absolute ratio of
posterior mean to posterior standard deviation is below threshold. The
model containing the retained interactions is then re-estimated, and the
posterior distribution of the total population is obtained by adding the
observed population to the posterior estimate of the unobserved cell.
estimate_population_bayesthresh( zdat, prior = "proper", prior_variance = 1, threshold = 2, maxorder = 2, alpha = c(0.025, 0.1, 0.9, 0.975), return_details = FALSE, ... )estimate_population_bayesthresh( zdat, prior = "proper", prior_variance = 1, threshold = 2, maxorder = 2, alpha = c(0.025, 0.1, 0.9, 0.975), return_details = FALSE, ... )
zdat |
Capture history data in the standard package format. |
prior |
Either |
prior_variance |
Prior variance for interaction parameters when a proper prior is used. |
threshold |
Threshold applied to the absolute ratio of posterior mean to posterior standard deviation for interaction parameters. |
maxorder |
Maximum interaction order, 2, 3 or 4. |
alpha |
Numeric vector of cumulative probability levels at which
posterior credible-interval endpoints are to be reported. The default is
|
return_details |
Logical. If |
... |
Additional arguments passed to
|
By default, the interaction parameters have independent zero-centred
normal priors, with variance specified by prior_variance.
Setting prior = "improper" instead assigns independent improper
flat priors to these parameters.
Under improper priors, sparse effects may be handled separately at minus
infinity. For example, if two lists are non-overlapping and their
two-list interaction is included in the model, its parameter has a
posterior distribution concentrated at minus infinity. Such effects
are retained in the model and reported in minus_infinity_effects,
but their parameters are excluded from the MCMC.
Thresholding proceeds in increasing order of interaction, starting
with the two-list interactions. If maxorder >= 3, a three-list
interaction is eligible for consideration only if all three of its
constituent two-list interactions have been retained with
finite parameters. Thus, under improper priors, a three-list
interaction containing a non-overlapping pair of lists
cannot be eligible.
The model containing the retained two-list interactions, including any effects handled at minus infinity, and all eligible three-list interactions is then fitted. The eligible three-list interactions are thresholded, except that, under improper priors, any newly minimal sparse effects are handled separately at minus infinity.
If maxorder = 4, the procedure continues to four-list
interactions after thresholding the three-list interactions. A
four-list interaction is eligible only if all four of its constituent
three-list interactions have been retained with finite
parameters. Eligible four-list interactions are fitted and thresholded
in the same way.
Under improper priors, the initial model containing all two-list interactions is checked for identifiability and against the Fienberg–Rinaldo existence criterion before thresholding begins. If either check fails, the procedure stops.
Before extending the analysis to three-list interactions, the model containing the retained two-list interactions and all eligible three-list interactions is also checked against the Fienberg–Rinaldo criterion. If this check fails, the extension is not carried out. Instead, the completed two-list analysis is returned, together with the eligible triples. The analogous check is applied before extending to four-list interactions; failure returns the completed three-list analysis.
These existence checks are needed because, under improper priors on the interaction parameters, a model without an extended maximum-likelihood estimate will not have a proper posterior. However, results of Forster (2010) show that proper priors on the interaction parameters can yield a proper posterior even when a finite maximum-likelihood estimate does not exist. Consequently, when proper priors are used, Bayesian fitting and thresholding proceed without applying the Fienberg–Rinaldo criterion.
When proper priors are used for the interaction parameters, the improper
priors on the intercept and main effects are approximated internally by
independent zero-centred normal priors with very large variance. This is
an implementation device arising from the way MCMCpack::MCMCpoisson()
specifies its prior distribution, rather than a change to the underlying
prior specification.
A list with components:
inputA list containing the original call and
data.
methodThe character string "bayesthresh".
estimateA named numeric vector containing posterior median
estimates of the dark_figure and total population.
fitted_modelThe retained model in hierarchy notation.
uncertaintyA two-row matrix of posterior quantiles for the
dark figure and total population at the probabilities in alpha.
detailsIf return_details = TRUE, a list containing
minus_infinity_effects, pairwise threshold_statistics,
applicable eligible_triples, retained_triples, and
triple_threshold_statistics, triple_status, and when order four is requested, eligible_quads, retained_quads, quad_threshold_statistics, and quad_status, and posterior, the complete
MCMC sample of total population size. Otherwise "not requested".
Silverman, B. W. (2020). Multiple-systems analysis for the quantification of modern slavery: classical and Bayesian approaches. Journal of the Royal Statistical Society: Series A (Statistics in Society), 183, 691–736.
Fienberg, S. E. and Rinaldo, A. (2012). Maximum likelihood estimation in log-linear models. The Annals of Statistics, 40, 996–1023.
Forster, J. J. (2010). Bayesian inference for Poisson and multinomial log-linear models. Statistical Methodology, 7, 210–224.
Martin, A. D., Quinn, K. M. and Park, J. H. (2011). MCMCpack: Markov Chain Monte Carlo in R. Journal of Statistical Software, 42(9), 1–21.
data(Western, package = "MultipleSystemsEstimation") fit <- estimate_population_bayesthresh( Western, burnin = 100, mcmc = 1000, seed = 1234 ) fit$estimate fit$fitted_modeldata(Western, package = "MultipleSystemsEstimation") fit <- estimate_population_bayesthresh( Western, burnin = 100, mcmc = 1000, seed = 1234 ) fit$estimate fit$fitted_model
Selects a model using the BIC criterion, accounting for sparse data and checking parameter identifiability and existence of the extended MLE. Hierarchical log-linear models are fitted to the observed data and ordered by increasing BIC. The point estimate is based on the model with the lowest BIC value.
If requested, constructs bootstrap BCa confidence intervals for population size that allow for uncertainty arising from BIC-based model selection. To reduce the computational load to feasible levels, an approximation is used in which the bootstrap and jackknife calculations are restricted to a specified number of the best-ranked models.
estimate_population_bic( zdat, nboot = 0, iseed = 1234, alpha = c(0.025, 0.1, 0.9, 0.975), maxorder = NULL, ntopmodels = NULL, return_details = FALSE, maxmodel = 100000L )estimate_population_bic( zdat, nboot = 0, iseed = 1234, alpha = c(0.025, 0.1, 0.9, 0.975), maxorder = NULL, ntopmodels = NULL, return_details = FALSE, maxmodel = 100000L )
zdat |
A capture history data matrix with |
nboot |
Non-negative integer giving the number of bootstrap
replications. If |
iseed |
Integer seed used to initialise the random-number generator. The default is 1234. |
alpha |
Numeric vector of cumulative probability levels at which the
endpoints of the BCa confidence intervals are to be evaluated. The default is
|
maxorder |
Maximum order of interaction to include in the
hierarchical models considered. If |
ntopmodels |
Number of models, ranked by BIC on the original data,
to retain for bootstrap inference. If |
return_details |
Logical. If |
maxmodel |
Maximum number of candidate models to generate. If this limit would be exceeded, the maximum interaction order is reduced until the complete set of eligible models is within the limit. |
If nboot > 0, the routine implements the bootstrap procedure described by Silverman,
Chan and Vincent (2024). Multinomial bootstrap samples are generated and the
BIC model-selection procedure is repeated for each bootstrap sample,
restricting consideration to a set of models having the smallest BIC values for the original data.
With the default settings, all available models are retained for bootstrap inference for two- and three-list data. For four-list data, the 20 models with the smallest BIC values are retained, and for five- and six-list data the 100 models with the smallest BIC values are retained. Focusing attention on a subset of all possible models enables considerable computational economies.
Models are generated directly. When their number exceeds maxmodel, the
maximum interaction order is reduced to a lower value as necessary.
This may even reduce the search to the main-effects-only model. Requested and
actual orders are recorded in details.
A masked interaction is a higher-order effect whose contribution cannot change any extended fitted mean because a lower-order effect is already estimated at minus infinity. For example, if lists A and B have no overlap then AB, if included in the model, is estimated at minus infinity. The interaction ABC is masked. Including ABC in the hierarchical model will not change the fitted mean of any history but will increase the number of nominal parameters, and so the BIC criterion cannot select this model.
A small value of nboot, such as that used in the example, is useful
only for checking that the routine runs. A substantially larger number of
bootstrap replications should be used for substantive inference.
A list with components:
inputA list containing the original call and
data.
methodThe character string "bic".
estimateA named numeric vector containing the estimated
dark_figure and total population.
fitted_modelThe hierarchy with the smallest BIC on the original data.
uncertaintyA two-row matrix of BCa endpoints for the dark
figure and total population when nboot > 0; otherwise an
explanatory character string.
detailsIf return_details = TRUE, a list containing
minus_infinity_effects, bootstrap_estimates,
bca_acceleration, BIC, maxorder,
requested_maxorder, and bic_results. The last is
the original-data enumeration after masked enlargements are excluded,
with one row per eligible model
giving its total-population estimate, BIC and maximum interaction order,
ordered by increasing BIC. Otherwise "not requested".
Silverman, B. W., Chan, L. and Vincent, K. (2024). Bootstrapping Multiple Systems Estimates to Account for Model Selection. Statistics and Computing, 34, 44. Available from doi:10.1007/s11222-023-10346-9.
data(Korea) # A very small number of bootstrap replications is used here only # to keep the example quick. estimate_population_bic(Korea, nboot = 10)data(Korea) # A very small number of bootstrap replications is used here only # to keep the example quick. estimate_population_bic(Korea, nboot = 10)
Estimates the total population, including the unobserved population, using a specified hierarchical log-linear model.
estimate_population_fixed( zdat, model = NULL, nboot = 0, iseed = 1234, alpha = c(0.025, 0.1, 0.9, 0.975), return_details = FALSE )estimate_population_fixed( zdat, model = NULL, nboot = 0, iseed = 1234, alpha = c(0.025, 0.1, 0.9, 0.975), return_details = FALSE )
zdat |
A capture history data matrix with |
model |
A character string specifying a hierarchical log-linear
model by its maximal interactions. For example, |
nboot |
Non-negative integer giving the number of bootstrap
replications. If |
iseed |
Integer seed used to initialise the random-number generator
when |
alpha |
Numeric vector of cumulative probability levels at which the
endpoints of the BCa confidence intervals are to be calculated. This
argument is used only when
|
return_details |
Logical. If |
Optional bootstrap and jackknife calculations provide BCa confidence intervals while fitting the same fixed model to every resampled data set.
The specified hierarchical model is fitted to the observed data. Parameter identifiability and existence of the extended MLE are checked for the original data and for every bootstrap and jackknife data set. Minimal zero-sufficient-statistic effects are represented at minus infinity by the fitting routine.
A masked interaction is a higher-order effect whose contribution cannot change any extended fitted mean because a lower-order effect is already estimated at minus infinity. For example, if lists A and B have no overlap then AB, if included in the model, is estimated at minus infinity. The interaction ABC is masked. Including ABC in the hierarchical model will not change the fitted mean of any history but will increase the number of nominal parameters, and so the BIC criterion cannot select this model.
If nboot > 0, multinomial bootstrap samples are generated from the
observed capture history counts. The same fixed hierarchical model is
fitted to every bootstrap sample. Unlike
estimate_population_stepwise, there is no model-selection
step within the bootstrap replications.
Bootstrap replications for which the fixed model cannot be fitted are
omitted; their number is available as details$bootstrap_failed
when return_details = TRUE. If the model cannot be fitted to any bootstrap
sample, the routine stops with an error.
A delete-one jackknife calculation is also carried out to estimate the acceleration parameter required for the BCa confidence intervals. If the fixed model cannot be fitted after a positive-count deletion, the routine stops with an informative error.
A small positive value of nboot, such as that used in the example,
is useful only for checking that the routine runs. A substantially larger
number of bootstrap replications should be used for substantive inference.
A list with components:
inputA list containing the original call and
data.
methodThe character string "fixed".
estimateA named numeric vector containing the estimated
dark_figure and total population.
fitted_modelThe hierarchy fitted to the original data.
masked_effectsEffects masked in the original data, whose
reported coefficients are zero by convention. Always returned, including
when return_details = FALSE.
uncertaintyA two-row matrix of BCa endpoints for the dark
figure and total population when nboot > 0; otherwise an
explanatory character string.
detailsIf return_details = TRUE, a list containing
minus_infinity_effects, masked_effects, bootstrap_estimates,
bootstrap_failed, bca_acceleration, and glm_fit. The last is the complete
conditional GLM fit for the fixed model. Masked effects have conventional coefficient zero and are listed separately in masked_effects. Otherwise
"not requested".
Chan, L., Silverman, B. W., and Vincent, K. (2021). Multiple Systems Estimation for Sparse Capture Data: Inferential Challenges when there are Non-Overlapping Lists. Journal of the American Statistical Association, 116(535), 1297–1306. Available from https://www.tandfonline.com/doi/full/10.1080/01621459.2019.1708748.
DiCiccio, T. J. and Efron, B. (1996). Bootstrap Confidence Intervals. Statistical Science, 11(3), 189–228.
data(Korea) # Main-effects model without bootstrapping estimate_population_fixed(Korea) # A fixed pairwise-interaction model using hierarchy notation estimate_population_fixed(Korea, model = "[23,1]") # A very small number of bootstrap replications is used here only # to keep the example quick. estimate_population_fixed( Korea, model = "[23,1]", nboot = 2 )data(Korea) # Main-effects model without bootstrapping estimate_population_fixed(Korea) # A fixed pairwise-interaction model using hierarchy notation estimate_population_fixed(Korea, model = "[23,1]") # A very small number of bootstrap replications is used here only # to keep the example quick. estimate_population_fixed( Korea, model = "[23,1]", nboot = 2 )
Estimates the total population, including the unobserved population, using an extension of the stepwise model-selection procedure of Chan, Silverman and Vincent (2021). Optional bootstrap and jackknife calculations provide BCa confidence intervals while repeating the stepwise selection procedure for each resampled data set.
estimate_population_stepwise( zdat, nboot = 0, pthresh = 0.02, maxorder = Inf, iseed = 1234, alpha = c(0.025, 0.1, 0.9, 0.975), return_details = FALSE )estimate_population_stepwise( zdat, nboot = 0, pthresh = 0.02, maxorder = Inf, iseed = 1234, alpha = c(0.025, 0.1, 0.9, 0.975), return_details = FALSE )
zdat |
A capture history data matrix with |
nboot |
Non-negative integer giving the number of bootstrap
replications. If |
pthresh |
P-value threshold used by the stepwise model-selection procedure. The default is 0.02. |
maxorder |
Maximum order of interactions considered for selection.
An integer of at least 2, or |
iseed |
Integer seed used to initialise the random-number generator
when |
alpha |
Numeric vector of cumulative probability levels at which the
endpoints of the BCa confidence intervals are to be calculated. This
argument is used only when
|
return_details |
Logical. If |
By default, interactions of any order may be considered.
Setting maxorder = 2 restricts the procedure to the
pairwise method of Chan, Silverman and Vincent (2021).
An interaction is considered only when all its
lower-order terms are already present, so every candidate
model is hierarchical.
A masked sparse interaction
is not eligible for selection, including when pthresh = 1.
The procedure starts with a main-effects model. At each stage it considers
eligible interactions not already included and adds the interaction having
the smallest p-value if that p-value does not exceed pthresh. It
stops when no eligible interaction meets the threshold. Candidate models
are checked for parameter identifiability and existence of the extended MLE.
The procedure is first applied to the observed data to obtain the point estimate and fitted model.
If nboot > 0, multinomial bootstrap samples are generated from the
observed capture history counts. The complete stepwise model-selection
procedure is repeated for each bootstrap sample, so the resulting
inference allows for variation in the selected model rather than treating
the model selected from the original data as fixed.
A delete-one jackknife calculation is also carried out to estimate the acceleration parameter required for the BCa confidence intervals. The jackknife calculation takes account of the number of individuals having each observed capture history.
A small positive value of nboot, such as that used in the example,
is useful only for checking that the routine runs. A substantially larger
number of bootstrap replications should be used for substantive inference.
A list with components:
inputA list containing the original call and
data.
methodThe character string "stepwise".
estimateA named numeric vector containing the estimated
dark_figure and total population.
fitted_modelThe hierarchy selected from the original data.
uncertaintyA two-row matrix of BCa endpoints for the dark
figure and total population when nboot > 0; otherwise an
explanatory character string.
detailsIf return_details = TRUE, a list containing
minus_infinity_effects, bootstrap_estimates, and
bca_acceleration. Otherwise "not requested".
Chan, L., Silverman, B. W., and Vincent, K. (2021). Multiple Systems Estimation for Sparse Capture Data: Inferential Challenges when there are Non-Overlapping Lists. Journal of the American Statistical Association, 116(535), 1297–1306. Available from https://www.tandfonline.com/doi/full/10.1080/01621459.2019.1708748.
DiCiccio, T. J. and Efron, B. (1996). Bootstrap Confidence Intervals. Statistical Science, 11(3), 189–228.
data(Korea) # Point estimate and fitted model without bootstrapping estimate_population_stepwise(Korea) # Allow interactions of any order estimate_population_stepwise(Kosovo, maxorder = Inf) # A very small number of bootstrap replications is used here only # to keep the example quick. estimate_population_stepwise(Korea, nboot = 10)data(Korea) # Point estimate and fitted model without bootstrapping estimate_population_stepwise(Korea) # Allow interactions of any order estimate_population_stepwise(Kosovo, maxorder = Inf) # A very small number of bootstrap replications is used here only # to keep the example quick. estimate_population_stepwise(Korea, nboot = 10)
Given a hierarchical model, finds its outer neighbours, its inner neighbours, or both.
find_neighbour_hierarchies( modelstr, nlists = NA, keepmaineffects = TRUE, maxorder = nlists - 1, type = c("all", "outer", "inner") )find_neighbour_hierarchies( modelstr, nlists = NA, keepmaineffects = TRUE, maxorder = nlists - 1, type = c("all", "outer", "inner") )
modelstr |
A model string written in hierarchical form. |
nlists |
The total number of lists. If |
keepmaineffects |
If |
maxorder |
The maximum interaction order permitted in outer neighbours. |
type |
Which neighbours to return. |
An outer neighbour is obtained by adding an interaction term all of whose subsets are already in the model.
An inner neighbour is obtained by removing one of the generators defining
the hierarchical model. Removing a generator removes only the defining
interaction term itself, not the lower-order terms that it implies. For
example, removing the generator 123 from [123,34] yields
[12,13,23,34], not [34]. Main effects are not removed when
keepmaineffects = TRUE.
A character vector containing the requested neighbouring hierarchical models.
Silverman, B. W., Chan, L. and Vincent, K. (2024). Bootstrapping Multiple Systems Estimates to Account for Model Selection. Statistics and Computing, 34, 44. doi:10.1007/s11222-023-10346-9.
modelstr <- "[12,23]" find_neighbour_hierarchies(modelstr) find_neighbour_hierarchies(modelstr, type = "outer") find_neighbour_hierarchies(modelstr, type = "inner")modelstr <- "[12,23]" find_neighbour_hierarchies(modelstr) find_neighbour_hierarchies(modelstr, type = "outer") find_neighbour_hierarchies(modelstr, type = "inner")
Generates all hierarchical models satisfying specified criteria. The user can specify the number of lists, the maximum order of models to be considered, and (optionally) a data set for which any masked sparse interactions will not be included in the models. Intercept and main effects are always included.
get_hierarchical_models( nlists, maxorder = nlists - 1L, xdata = NULL, maxmodel = 100000L )get_hierarchical_models( nlists, maxorder = nlists - 1L, xdata = NULL, maxmodel = 100000L )
nlists |
Number of lists (an integer from 2 to 9). |
maxorder |
Maximum interaction order; Inf permits all orders. |
xdata |
Optional capture history data. If supplied, models including masked sparse interactions for this data set will not be included. Minimal sparse interactions remain eligible. |
maxmodel |
Maximum number of models to be generated. If exceeded, the maximum order will be reduced, if necessary as far as 1, to bring the number of models below the specified limit. |
A named list of integer vectors specifying the hierarchical models.
The name
of each vector in the list is the hierarchy string representation of the model,
and the vector itself is the vector of encoded capture histories
included in the model.
A capture history is encoded as the integer
, where is the set of capture lists in
the history. The returned list has two attributes:
requested_maxorderThe value of maxorder supplied
by the user, or its default value if omitted.
maxorderThe actual maximum interaction order of the generated
models. This is capped at nlists and may be reduced
further to satisfy maxmodel.
models <- get_hierarchical_models(3) names(models) models[[1]]models <- get_hierarchical_models(3) names(models) models[[1]]
Three-list capture-history data concerning Korean women held in sexual slavery by the Japanese military in Palembang, Indonesia. Further details are given in the data section and Figure 1 of Ball, Shin and Yang (2018).
KoreaKorea
A numeric matrix with 7 rows and 4 columns. Columns b,
c and d are binary list-membership indicators. Column
Count gives the number of cases having each capture history.
Ball, P., Shin, E. H.-S. and Yang, H. (2018). There may have been 14 undocumented Korean "comfort women" in Palembang, Indonesia. Technical report, Human Rights Data Analysis Group.
Four-list capture-history data for 4,400 documented killings during the
Kosovo conflict between 20 March and 22 June 1999. The lists are
exhumations (EXH), the American Bar Association Central and East
European Law Initiative (ABA), the Organization for Security and
Co-operation in Europe (OSCE), and Human Rights Watch
(HRW). All 15 observable capture histories have positive count.
KosovoKosovo
A data frame with 15 rows and 5 columns. The first four columns
are binary list-membership indicators. Column Frequency gives the
number of cases having each capture history.
Ball, P., Betts, W., Scheuren, F., Dudukovich, J. and Asher, J. (2002). Killings and refugee flow in Kosovo, March–June 1999. American Association for the Advancement of Science. Report to the International Criminal Tribunal for the Former Yugoslavia.
Six-list capture-history data for identified victims of human trafficking in the Netherlands. The data are described in Table 2 of Silverman (2020).
NedNed
A data frame with 24 rows and 7 columns. Columns I,
K, O, P, R and Z are binary
list-membership indicators. Column frequency gives the number of
cases having each observed capture history.
Silverman, B. W. (2020). Multiple-systems analysis for the quantification of modern slavery: classical and Bayesian approaches. Journal of the Royal Statistical Society: Series A, 183(3), 691–736. doi:10.1111/rssa.12505.
A five-list version of Ned, constructed by combining lists
I and O into a single list, IO.
Ned_5Ned_5
A data frame with 17 rows and 6 columns. Columns IO,
K, P, R and Z are binary list-membership
indicators. Column frequency gives the number of cases having each
observed capture history.
Capture-history data for identified victims of human trafficking in Greater New Orleans. The data comprise eight confidentially labelled lists, denoted A to H. Further details are given by Bales, Murphy and Silverman (2020).
NewOrlNewOrl
A data frame with 19 rows and 9 columns. Columns A to
H are binary indicators of inclusion in the eight lists. Column
n gives the number of cases having each observed capture history.
Bales, K., Murphy, L. and Silverman, B. W. (2020). How many trafficked people are there in Greater New Orleans? Journal of Human Trafficking, 6(4), 375–384. doi:10.1080/23322705.2019.1634936.
A five-list version of NewOrl, constructed by combining
the four smallest lists B, E, F and G into a single list, BEFG.
NewOrl_5NewOrl_5
A data frame with 14 rows and 6 columns. Columns A,
BEFG, C, D and H are binary list-membership
indicators. Column n gives the number of cases having each
observed capture history.
Combines duplicate capture histories by summing their counts. It can also add all observable histories having zero count and remove non-informative capture lists.
tidy_lists(zdat, includezerocounts = FALSE, remove_noninformative = FALSE)tidy_lists(zdat, includezerocounts = FALSE, remove_noninformative = FALSE)
zdat |
A matrix or data frame with |
includezerocounts |
If |
remove_noninformative |
If |
A data frame with one row for each retained capture history and one column for each retained list, followed by the count column.
# Two rows have the same capture history: A only. zdat <- data.frame( A = c(1, 1, 0, 1), B = c(0, 0, 1, 1), C = c(0, 0, 0, 1), count = c(3, 5, 4, 2) ) zdat # Consolidate rows with the same capture history by summing their counts. # The two A-only rows become one row with count 3 + 5 = 8. tidy_lists(zdat) # Include all seven observable histories, filling missing counts with zero. # The unobserved history (0, 0, 0) is excluded. tidy_lists(zdat, includezerocounts = TRUE) # Add a duplicate list, an empty list and a list containing every case. # Keep the count column last. redundant <- data.frame( zdat[c("A", "B", "C")], A_copy = zdat$A, empty = 0, everyone = 1, count = zdat$count ) redundant # Remove the three redundant lists and consolidate repeated histories. tidy_lists(redundant, remove_noninformative = TRUE)# Two rows have the same capture history: A only. zdat <- data.frame( A = c(1, 1, 0, 1), B = c(0, 0, 1, 1), C = c(0, 0, 0, 1), count = c(3, 5, 4, 2) ) zdat # Consolidate rows with the same capture history by summing their counts. # The two A-only rows become one row with count 3 + 5 = 8. tidy_lists(zdat) # Include all seven observable histories, filling missing counts with zero. # The unobserved history (0, 0, 0) is excluded. tidy_lists(zdat, includezerocounts = TRUE) # Add a duplicate list, an empty list and a list containing every case. # Keep the count column last. redundant <- data.frame( zdat[c("A", "B", "C")], A_copy = zdat$A, empty = 0, everyone = 1, count = zdat$count ) redundant # Remove the three redundant lists and consolidate repeated histories. tidy_lists(redundant, remove_noninformative = TRUE)
Six-list capture-history data from the United Kingdom 2013 strategic
assessment of modern slavery. The lists are local authorities
(LA), non-governmental organisations (NG), police forces
(PF), government organisations (GO), the general public
(GP), and the National Crime Agency (NCA).
UKdatUKdat
A data frame with 25 rows and 7 columns. The first six columns
are binary list-membership indicators. Column count gives the
number of cases having each observed capture history. Capture histories
having zero count are omitted.
Home Office (2014). Modern Slavery: an application of multiple systems estimation. https://www.gov.uk/government/publications/modern-slavery-an-application-of-multiple-systems-estimation.
A five-list version of UKdat, constructed by combining the
police-force and National Crime Agency lists into a single list,
PFNCA.
UKdat_5UKdat_5
A data frame with 18 rows and 6 columns. Columns LA,
NG, PFNCA, GO and GP are binary
list-membership indicators. Column count gives the number of cases
having each observed capture history.
Capture-history data for identified victims of sex trafficking at a western United States site. The five source lists are confidentially labelled A to E. Further details are given by Farrell et al. (2018).
WesternWestern
A data frame with 13 rows and 6 columns. Columns A to
E are binary list-membership indicators. Column n gives
the number of cases having each observed capture history.
Farrell, A., Dank, M., Kafafian, M., Lockwood, S., Pfeffer, R., Hughes, A. and Vincent, K. (2018). Capturing human trafficking victimization through crime reporting. Technical Report 2015-VF-GX-0105, National Institute of Justice. https://www.ojp.gov/pdffiles1/nij/grants/252520.pdf.