find_pairs: Find significant pairs

Description Usage Arguments Value See Also Examples

Description

Find significant pairs using the Bonferroni method and (optionally) with the shuffling algorithm to avoid False-Positives. This is the wrap-up of the following functions:

Usage

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
find_pairs(your_database,
           ids_column,
           dates_column,
           prob = 1/75,
           alpha = 0.01,
           only_significant = TRUE,
           shuffling = FALSE,
           n_shuffl = 100,
           period_months = 3,
           FP_threshold = max,
           max_threshold = NULL)

Arguments

your_database

a data frame with the clinic visit dates in a long format.

ids_column

character, column name with the person identifiers

dates_column

character, column name with the visit dates

prob

probability of sharing a single visit, default 1/75

alpha

type I error

only_significant

returns only the significant pairs above the threshold (default) or all the pairs with the corresponding p-values

shuffling

logical indicating if the shuffling should be performed. By default (FALSE) only the Bonferroni method is used.

n_shuffl

number of repetitions of shuffling algorithm (default 100)

period_months

the length of the follow-up period in months (by default 3)

FP_threshold

the function used to get the False-Positive fraction from the shuffling repetitions at each position. By default the max is called at each threshold. Another possibilities are mean or median.

max_threshold

maximum false-positive threshold to be inspected. If it is NULL, the 99.995%-quantile of the distribution of the unadjusted number of shared visits is used.

Value

A list containing

"unadjusted_pairs"

pairs with unadjusted number of shared visits

"Bonferroni_pairs"

pairs obtained with the Bonferroni correction. If significant_only==TRUE only those above the threshold are returned.

"adjusted_pairs"

pairs with adjusted number of shared visits returned only if shuffling==TRUE.

"Shuffled_pairs"

pairs obtained by the shuffling algorithm (returned only if shuffling==TRUE).

"shuffling_threshold"

threshold determined by the shuffling algorithm

"shuffling_simulation_output"

output from the shuffling function if shuffling==TRUE

See Also

prepare_db, get_observed_pairs, Bonferroni_m, adjust_visits, Shuffling_simulation

Examples

1
2
3
4
5
data("simulated_data")
pairs <- find_pairs(simulated_data, 
                    ids_column = "subject",
                    dates_column = "sim_dates",
                    shuffling = TRUE, n_shuffl = 2)

alexmarzel/svisits documentation built on May 12, 2019, 1:36 a.m.