I have a series of patients in whom I have measured the value of a certain blood quantity at several time points. However, the time points vary a lot and the number of measurements range between 2 and 5. I would like to fit a smoothing spline to a graph were I have each patient's blood values on the Y-axis and time on the X-axis. I would like to have a graph like the one shown below
I am using R, and with the
smooth.spline function I can have a smoothing spline with all data-points used, but I think I should consider each patient's data points as dependent and hence I cannot put them just to a two vector.
How could I produce a smoothing as shown above?