Learn R Programming

ldamatch (version 1.0.3)

estimate_exhaustive: Estimates the maximum number of cases to be checked during exhaustive search.

Description

Estimates the maximum number of cases to be checked during exhaustive search.

Usage

estimate_exhaustive(
  min_preserved = sum(group_sizes),
  condition,
  cases_per_second = 100,
  print_info = TRUE,
  max_removed_per_cond = NULL,
  group_sizes = NULL,
  props = prop.table(table(condition)),
  max_cases = Inf
)

Value

The maximum number of cases: an integer if not greater than the maximum integer size (.Machine$integer.max), otherwise a Big Integer (see the gmp package).

Arguments

min_preserved

Assumes that at least a total of this many subjects will be preserved.

condition

A factor vector containing condition labels.

cases_per_second

Assumes that this number of cases are checked out per second, for estimating the time it takes to run the exhaustive search; default: 100.

print_info

If TRUE, prints partial calculations as well for the number of cases and estimated time when removing 1, 2, ... subjects.

max_removed_per_cond

A named integer vector, containing the maximum number of subjects that can be removed from each group. Specify 0 for groups if you want to preserve all of their subjects. If you do not specify a value for a group, it defaults to 2 less than the group size. Values outside the valid range of 0..(N-1) (where N is the number of subjects in the group) are corrected without a warning.

group_sizes

A particular set of group sizes that we know a matched solution for; min_preserved need not be specified if this one is.

props

Either the desired proportions (percentage) of the sample for each condition as a named vector, or the names of the conditions for which we prefer to preserve the subjects, in decreasing order of preference. If not specified, the (full) sample proportions are used.

max_cases

Once it is certain that the number of cases is definitely above this number, calculation stops. In this case, the returned number is guaranteed to be larger than max_cases, but it is not the exact number of exhaustive cases. Default is infimum, i.e. the exact number of cases is calculated.

Examples

Run this code
estimate_exhaustive(58, as.factor(c(rep("ALN", 25), rep("TD", 44))))
estimate_exhaustive(84, as.factor(c(rep("ASD", 51), rep("TD", 44))))

Run the code above in your browser using DataLab