get_threshold {nncc}R Documentation

Identify the right threshold

Description

To find a threshold for distance to define controls that are qualified to be matched with a case.

Usage

get_threshold(data, vars, case_var = "case", p_threshold = 0.5, seed = 1600)

Arguments

data

The dataset

vars

The variables to use for calculating distance

case_var

The name of the case identifier variable

p_threshold

The probability that the closest matching approach produces the closer matching relative to the random matching approach. The greater p_threshold, the smaller the threshold.

seed

A random seed.

Details

This function uses logistic regression to predict by the distance whether a control is the closest (unique) match for each case vs. a random selection and by default returns the 50

For more information, please refer to the vignette using browseVignettes("nncc").

Value

A list with items:

threshold

The numeric threshold chosen

modeldata

The data used to fit the logistic regression model

strata

The strata made by make_knn_strata

model

The fit logisitic regression model


[Package nncc version 2.0.0 Index]