Description Usage Arguments Value Examples
The function adjusts the total number of shared visits per pair.
1 | adjust_visits(unadjusted_pairs, ids, prob = 1/75)
|
unadjusted_pairs |
a |
ids |
a |
prob |
probability of sharing a single visit, depending on the frequency of visits. Default |
a data frame with the columns:
"allPairs"
pair identifiers
"Freq"
unadjusted number of shared visits
"id_1"
first member of the pair's id
"id_2"
second member of the pair's id
"N_visits.x"
first member of the pair's number of visits
"N_visits.y"
second member of the pair's number of visits
"Corrected"
the adjusted number of shared visits per pair
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 | # load data
data("simulated_data")
db_dates <- prepare_db(your_database = simulated_data,
ids_column = "subject",
dates_column = "sim_dates")
# first get unadjusted pairs
unadjusted_observed_pairs <- get_observed_pairs(db_dates)
ids <- data.table(ids = as.character(names(table(db_dates$subject))),
N_visits = as.character(as.numeric(table(db_dates$subject))))
setkey(ids, "ids")
# now adjust the pairs
adjusted_observed <- adjust_visits(unadjusted_pairs = unadjusted_observed_pairs,
ids = ids,
prob = 1/75)
head(adjusted_observed)
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.