Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Discrepancy in calculation of cumulative migration probability #13

Open
ariloytynoja opened this issue Apr 17, 2024 · 1 comment
Open

Comments

@ariloytynoja
Copy link

Hello,

I'm confused about the correct way of computing M(t).

In MSMC_IM.py, they are computed using the right boundaries and then outputted in the file *.MSMC_IM.estimates.txt:

CumulativeDF = MSMC_IM_funcs.cumulative_Symmigproportion(right_boundaries, m_List)

However, in plot_utils.py, they are computed using the left boundaries as only those are included in *.MSMC_IM.estimates.txt:

time_boundaries,IM_N1s,IM_N2s,m_t_s = read_from_MSMC_IM(args.Input)
if args.samegrid:
    t = time_boundaries
    CDF_t = cumulative_Symmigproportion(time_boundaries, m_t_s)

CDF_t = cumulative_Symmigproportion(time_boundaries, m_t_s)

As the first left boundary is zero, a consequence of the latter is that integ = 2 * m[0] * 0 is always zero and the first time period is ignored:

integ = 2 * m[0] * time_boundaries[0]

Confusingly, the plotting function in MSMC_IM.py is different from that in plot_utils.py, and erroneous at least if xlog is used and the first x-value (log(0)) is not defined:

plot(left_boundaries, CumulativeDF, label='Infer: CDF', c='orange')

There are now three ways of plotting M(t):

  • in plot_utils.py for making plots from the *.estimates.txt data but recomputing the M values
  • in MSMC_IM.py for plots in *.fittingdetails.xlog.pdf
  • user-made plots using the M values in *.estimates.txt

I personally would plot M(t) with the column 'M' from *.MSMC_IM.estimates.txt and the right boundaries. One could add zeros in the vectors to start it from the corner. However, this differs from the plots generated by MSMC-IM.

Can you please tell your opinion on which one of these is the right way to do the plotting?

Best regards,

Ari

@wangke16
Copy link
Owner

wangke16 commented May 9, 2024 via email

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants