Implements a linear interpolation between observered marker values.
Usage
lin_interpolate(t, i, data_id, data_marker, data_time)
Value
A matrix with columns \((f(t_1),...,f(t_K))\) as described above for every individual in the vector i.
Arguments
t
A vector of time values where the function should be evaluated.
i
A vector of ids of individuals for whom the marker values should be interpolated.
data_id
The vector of ids from a data frame of time dependent variables.
data_marker
The vector of marker values from a data frame of time dependent variables.
data_time
The vector of time values from a data frame of time dependent variables.
Details
Given time points \(t_1,...,t_K\) and marker values \(m_1,...,m_J\) at different time points \(t^m_1,...,t^m_J\), the function calculates a linear interpolation \(f\) with \(f(t^m_i) = m_i\) at the time points \(t_1,...,t_K\) for all indicated individuals. Returned are then \((f(t_1),...,f(t_K))\). Note that the first value is always observed at time point \(0\) and the function \(f\) is extrapolated constantly after the last observed marker value.