thinhong / denim

R package for discrete model
https://thinhong.github.io/denim/
Other
2 stars 1 forks source link

A typology of transitions #27

Open choisy opened 2 years ago

choisy commented 2 years ago

I have the feeling that there is a bit of loose semantic in the description of the package. It's important to make sure that the terms used are correct and precise. As an example, the file distribution.R and the class Distribution seem to gather things that are not all distributions and that are actually quite different things. It's worth thinking carefully about what we are dealing with here and about a clear hierarchical typology of these various things. My understanding is that we are basically dealing with transitions between compartments and there are various ways to define these transitions. First, they can be defined by specifying a distribution of waiting time or not. If not, then they can either be defined by a fixed number or a fixed proportion of individuals transitioning from one compartment to the other. In the case the transition is defined by specifying a distribution of waiting time, then this distribution can be parametric or not. If parametric, then it could be either a lognormal, a Weibull or a gamma distribution. This later has a 1-parameter specific case that is called an exponential distribution. Such a hierarchical typology could be summarized by this diagramme:

Screen Shot 2022-04-06 at 16 39 44

All this means that when you come to think of classes, you may want to think about them in the same hierarchical manner as on the diagramme where daughter classes would inherit the methods of the parent class. Because what is annoying at the moment is that you are defining one single class named Distribution and this class gather things are very diverse, many of these things not even being distributions! And I think you did realize that at some point because, in terms of slots, you don't always a much consistency.

thinhong commented 2 years ago

Thank you so much, this explain a lot of the inconsistency in my code. I made everything as Distribution and have to make 3 exceptions for the fixed number, fixed proportion, and math expression! I will fix them and make this hierarchy diagram in the vignette to explain the transition.

choisy commented 2 years ago

Yes, and I believe that the writing of the print() methods will be easier as well!