Learn R Programming

Inflongitudinal (version 0.1.0)

tvm.imputation: tvm.imputation: Impute Influential Responses in Longitudinal Data

Description

This function identifies influential response values using the `tvm` function, replaces them with NA, and imputes the missing values using the `mice` package.

Usage

tvm.imputation(
  data,
  subject_col,
  time_col,
  response_col,
  k,
  impute_method = "pmm",
  m = 5
)

Value

A data frame with imputed values for the influential response points while maintaining original NA values.

Arguments

data

A data frame containing the longitudinal data.

subject_col

Character. The name of the column representing subject IDs.

time_col

Character. The name of the column representing time points.

response_col

Character. The name of the column representing the response variable.

k

Numeric. The number of clusters for the `tvm` function.

impute_method

Character. The imputation method to be used in `mice` (default is "pmm").

m

Numeric. The number of multiple imputations to be performed (default is 5).

Examples

Run this code
infsdata <- infsdata[1:5,]
imptvm <- tvm.imputation(infsdata, "subject_id", "time", "response", k = 3)
head(imptvm)

Run the code above in your browser using DataLab