def plot_3d_comp_multinom(model, data, vmin=None, vmax=None, resid_range=None, fig_num=None, pop_ids=None, residual='Anscombe', adjust=True): """ Multinomial comparison between 3d model and data. model: 3-dimensional model SFS data: 3-dimensional data SFS vmin, vmax: Minimum and maximum values plotted for sfs are vmin and vmax respectively. resid_range: Residual plot saturates at +- resid_range. fig_num: Clear and use figure fig_num for display. If None, an new figure window is created. pop_ids: If not None, override pop_ids stored in Spectrum. residual: 'Anscombe' for Anscombe residuals, which are more normally distributed for Poisson sampling. 'linear' for the linear residuals, which can be less biased. adjust: Should method use automatic 'subplots_adjust'? For advanced manipulation of plots, it may be useful to make this False. This comparison is multinomial in that it rescales the model to optimally fit the data. """ model = Inference.optimally_scaled_sfs(model, data) plot_3d_comp_Poisson(model, data, vmin=vmin, vmax=vmax, resid_range=resid_range, fig_num=fig_num, pop_ids=pop_ids, residual=residual, adjust=adjust)
def plot_1d_comp_multinom(model, data, fig_num=None, residual='Anscombe', plot_masked=False): """ Mulitnomial comparison between 1d model and data. model: 1-dimensional model SFS data: 1-dimensional data SFS fig_num: Clear and use figure fig_num for display. If None, an new figure window is created. residual: 'Anscombe' for Anscombe residuals, which are more normally distributed for Poisson sampling. 'linear' for the linear residuals, which can be less biased. plot_masked: Additionally plots (in open circles) results for points in the model or data that were masked. This comparison is multinomial in that it rescales the model to optimally fit the data. """ model = Inference.optimally_scaled_sfs(model, data) plot_1d_comp_Poisson(model, data, fig_num, residual, plot_masked)
def plot_1d_comp_multinom(model, data, fig_num=None, residual='Anscombe', plot_masked=False): """ Mulitnomial comparison between 1d model and data. model: 1-dimensional model SFS data: 1-dimensional data SFS fig_num: Clear and use figure fig_num for display. If None, an new figure window is created. residual: 'Anscombe' for Anscombe residuals, which are more normally distributed for Poisson sampling. 'linear' for the linear residuals, which can be less biased. plot_masked: Additionally plots (in open circles) results for points in the model or data that were masked. This comparison is multinomial in that it rescales the model to optimally fit the data. """ model = Inference.optimally_scaled_sfs(model, data) plot_1d_comp_Poisson(model, data, fig_num, residual, plot_masked)
maxiter=50) print('Optimized parameters', str(repr(popt))) model = func_ex(popt[0], ns, pts_l) ll_opt = dadi.Inference.ll_multinom(model, pop) print('Optimized log-likelihood:', str(ll_opt)) print('Theta0_2:', str(theta0)) ##Print out the scaled SFS and the Anscombe Poisson residuals print("==============================================") print(Inference.optimally_scaled_sfs(model, pop)) rescaled = Inference.optimally_scaled_sfs(model, pop) print(Inference.Anscombe_Poisson_residual(rescaled,pop)) dadi.Plotting.plot_1d_comp_multinom(model,pop) print("==============================================") ####Neutral Fit######### ########################### print("NEUTRAL MODEL") params = [1]