imputeTimeSeriesLab | R Documentation |
imputeTimeSeriesLab
does imputation for time-series data.
imputeTimeSeriesLab(
labData,
idColName,
labItemColName,
windowColName,
valueColName,
impMethod,
imputeOverallMean = FALSe
)
labData |
a file or dataframe of laboratory test data with at least 4 columns about patient ID, lab item, test value and test date, respectively. |
idColName |
the column name that records patient ID in labData. |
labItemColName |
the column name that records lab item in labData. If lab code is combined by multiple columns, then just simply add |
windowColName |
the column name that records time window sequence in labData. |
valueColName |
the column name that records lab test value in labData. If there are more than one value column to be imputed, just simply add |
impMethod |
desired imputation method: |
imputeOverallMean |
|
Two imputation methods are provided: mean
or interpolation
. If choosing mean
method, the imputation is based the mean of all other non-null values among all the windows of the specific lab item for certain patient. If interpolation
, the imputation uses linear interpolation method, and other out-of-range null values will be imputed by mean of known values. If nocb
, the imputation method is "next observation carried backward".
A data.table
with imputed data.
timeSeriesData <- getTimeSeriesLab(labData = labSample,
idColName = SUBJECT_ID,
labItemColName = ITEMID,
dateColName = CHARTTIME,
valueColName = VALUENUM,
indexDate = first,
gapDate = 360,
completeWindows = TRUE)
imputeTSData <- imputeTimeSeriesLab(labData = timeSeriesData,
idColName = ID,
labItemColName = ITEMID,
windowColName = Window,
valueColName = Max & Min & Mean & Nearest,
impMethod = mean,
imputeOverallMean=FALSE)
head(imputeTSData)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.