impute_dose: Imputes dose records using ADDL and II by looking forward and backwards
Description
This function imputes dose records by looking at the missing doses between available records
based on a given II value
Usage
impute_dose(data, id, datetime, amt = "AMT", ii = "II", thr = 50, back = TRUE)
Value
a data frame with imputed dose records
Arguments
data
data frame to perform the calculations on
id
character identifying the id variable within the data frame
datetime
character identifying the date/time variable (POSIXct) within the data frame
amt
character identifying the AMT (amount) variable within the data frame
ii
character identifying the II (Interdose Interval) variable within the data frame
thr
numeric indicating the threshold percentage for imputation (see details)
back
logical indicating if the time for imputed doses should be taken from the previous record (TRUE) or the next (FALSE)
Author
Richard Hooijmaijers
Details
The function fills in the doses by looking at the time difference and II between all records.
Be aware that this can result in unexpected results in a few cases, so results should always be handled with care.
The function will determine if a dose should be imputed based on the 'thr' value. For each dose, the function determines the percentage
difference from the previous dose based on the II value. In case this the expected difference is above the threshold value imputation will be done.