Learn R Programming

Inflongitudinal (version 0.1.0)

rld: Relative Longitudinal Difference (RLD)

Description

This function identifies influential subjects in longitudinal data based on their relative change in response over time. It helps in detecting subjects whose response values exhibit significant fluctuations beyond a specified threshold (k standard deviations).

Usage

rld(data, subject_id, time, response, k = 2, verbose = FALSE)

Value

A list containing:

influential_subjects

IDs of influential subjects.

influential_data

Data frame of influential subjects.

non_influential_data

Data frame of non-influential subjects.

relative_change_plot

Plot of max relative change per subject.

longitudinal_plot

Plot of longitudinal data with influential subjects highlighted.

IS_table

A data frame containing the Influence Score (IS) and the Partial Influence Score (PIS) values for each subject at each time point.

Arguments

data

A data frame containing the longitudinal data.

subject_id

A column specifying the column name for subject IDs.

time

A column specifying different time points that observations are measured like 0 as baseline, 1 as first visit etc.

response

A column specifying the column name for response values.

k

A numeric value (default = 2) used to define the threshold for detecting influential subjects.

verbose

Logical; if TRUE, prints informative messages during execution.

Details

The function follows these steps:

  • Computes the relative change in response values over time for each subject.

  • Calculates the threshold based on k standard deviations from the mean relative change.

  • Identifies subjects whose relative change exceeds the threshold.

  • Separates data into influential and non-influential subjects.

  • Generates visualizations to highlight influential subjects.

This method is particularly useful for detecting subjects with extreme response variations in longitudinal studies.

See Also

tvm, wlm, sld, slm

Examples

Run this code
data(infsdata)
infsdata <- infsdata[1:5,]
result <- rld(infsdata, "subject_id", "time", "response", k = 2)
print(result$influential_subjects)
head(result$influential_data)
head(result$non_influential_data)

Run the code above in your browser using DataLab