Feature engineering and longitudinal data

I need some advice for my feature engineering. Suppose I have 90 days follow-up data. on 12 patients and I have the vital status of the patients at the end of these 90 days (deceased=1, alive=0)

ID<-as.factor(c(1,1,1,2,2,2,2,3,3,4,4,4))
time<-c(0,12,36,0,7,23,68,0,23,0,32,45)
Age<-rnorm(12,45,9)
Sexe<-c("F","F","F","M","M","M","M","M","M","F","F","F")
biology1<-rnorm(12,12,3)
biology2<-rnorm (12,100,20)
biology3<-rnorm(12,45,9)
biology4<-rnorm(12,20,2)
sign1<-c(1,1,1,1,0,1,0,1,0,0,0,1)
sign2<-c(1,0,0,1,1,0,1,0,1,1,0,1)
stage<-c(3,3,4,2,2,1,1,3,2,3,2,3)
Death<-c(1,1,1,0,0,0,0,0,0,1,1,1)
data<-data.frame(ID,time,Age,Sexe,sign1,sign2,biology1,biology2,biology3,biology4,stage,Death)


Patients were seen at irregular rhythms where they benefited from clinical and biological examinations. I would like to make a model of mortality prediction. What kind of transformations will be adapted to the numerical variables for my case, and which take into account the evolutivity of the data, knowing that the data are not periodic. For the moment I am thinking of calculating the slopes for the numerical variables. What other transformation could I do that takes into account the evolutivity of the variables? The variable "stage", is an ordinal variable and in principle the higher the stage, the more critical the state of the patient is, and the more likely he is to die, Would it be a good idea to do the One-Hot-Encoding? Or should I do Ordinal Encoding? And in the latter case is it a good idea to leave the variable with its 1,2, 3,4? (knowing that there is no interval property)

What type of encoding could I do that takes into account the evolutivity of the binary variables (sign1 and sign2)? For example patient 1 has 1,then 0, then 0 for sign 2 Would it be a good idea to make a slope here as well?

• Trying to use data science to model mortality prediction with complex models and just 12 patients is a bad idea. – Valentas Jan 21 at 20:43