MPIDR / rsocsim

Socsim Microsimulation R Package
https://mpidr.github.io/rsocsim/
GNU General Public License v3.0
20 stars 7 forks source link

Simulations end with warning messages #10

Open polizzan opened 1 year ago

polizzan commented 1 year ago

Dear rscocsim team,

I found that the simulations succesfully carried out with the rsocsim::socsim() command return two warning messages:

XX: In readLines(con, n = 1) :
  incomplete final line found on 'sim_results_supervisory.sup_SEED_/logfile.log'
XX: In startSocsimWithFile(supfile, seed, compatibility_mode,  ... :
  can't open transition history file. Hope that's OK

The help file does not currently specify the meaning of these warning messages and what their effect on the simulation output might be.

Many thanks and best wishes, Antonino

tomthe commented 1 year ago

Hi Anonino,

Thank you for telling us about this issue with warning messages. I see them so often that I became blind to them :)

The first message ("incomplete final line ...log") is a bug on my part. It does not indicate an error in the simulation, it is just an error that can occur while reading the log file (which rsocsim does to show the output to the user in the r-console). I have to handle that error in the package so that users are not bothered with unhelpful error messages.

The second warning ("can't open transition history file.") is a warning from socsim itself. The transition history file is not necessary for most use cases - Only if you restart a simulation where you want to keep track of moves between groups, it is necessary.

Socsim oversimplified says:

If the simulation includes group transitions, than socsim will write a file with the same path as the population and marriage files but with the suffix .otx. The transition events do not have unique ids as do marriages, but each transition record contains the person id of the protagonist. Consequently it is much more natural to link from the transition history to the population file.

If group transitions are part of the simulation then socsim will write (and may read) a transition history file. In spirit, the otx file is much like the marriage file, the main differences are that the file is linked to only one person and there is no unique identifier for a transition history record.

Maybe we should change the wording to make it more obvious that this is most likely no problem?

polizzan commented 1 year ago

Hi Tom,

Thanks so much for your very helpful reply!

Regarding the second warning message, would it be accurate to instead have rsocsim indicate that "no prior transitions are assumed"? If this could be in the form of regular output in the r-console, rather than a warning message, this might be less concerning for the user?

This is just a suggestion. I am very happy to hear that the warning messages don't indicate any errors with the simulation.

Many thanks and best wishes, Antonino