Thanks for your response. Yes, someone shared with me this code. Actually, they mentioned this function twice in the script, but this is the first line where it appears. The other line is this one.

And related to the packages, they just instal the packages 'msm', and they use the libraries msm, fitdistrplus, logspline, extrafont, lubridate, extrafontdb, and Rttf2pt1.