I have many short time series (1-5 data points) that document the development of morphological traits (length and pigmentation) of some lab critters in response to different dietary supplement. I already know that, depending on dietary supplement, these traits increase at different rates (and depending on family but that's maybe not important for this question).
I now would like to test whether growth or pigmentation rates, across different diets, can affect survival. As I said the morphological information I have for every timepoint; survival is determined by how long the timeseries are (1-5: I believe this is referred to as (right) truncated and not censored data). I suspect that organisms who both grow and pigment too fast have a higher change of dying, depending on what diet they feed on, but I am not sure how to test it.
I have been trying with a GAM-framework, 0/1 as response, and morphological info filled with NA
after death. Did not work, of course, but just to give you an idea:
mod = gam(Survival ~ Food + Time_num +
s(Time_num, Length, by=Food, k=5) +
s(Time_num, Pigmentation, by=Food, k=5) +
s(Time_num, Length, Pigmentation, by=Food, k=5) +
s(Family, Individual, bs="re")
, family = "binomial", data=mod_data)
How can I account for truncation of individual time series? I would like to stay at the level of each individual (i.e. no family or treatment by timepoint averaging). R
syntax would be appreciated.
EDIT: To clarify, I am interested in the time of survival (numeric 1-5 is sampling timepoints/dates), and how it is influenced by how fast organisms grow and/or become pigmented. The data (for all my ~1000 individuals) looks like this:
Individual 1A, Food A
Time: 1 2 3 4 5
Alive: 1 1 1 0 0
Length: 1.1 1.5 2.6 NA NA
Pigmentation: 0.3 0.5 0.7 NA NA
Individual 2A, Food A
Time: 1 2 3 4 5
Alive: 1 1 1 1 1
Length: 1.2 1.5 2.9 3.6 5.8
Pigmentation: 0.3 0.45 0.6 0.7 0.8
Individual 3A, Food B
Time: 1 2 3 4 5
Alive: 1 0 0 0 0
Length: 1.1 NA NA NA NA
Pigmentation: 0.3 NA NA NA NA
etc....
The 0/1 (dead/alive) response could of course be converted to 1-5, so I probably want that as my response in the end.