BEAST-Fitting / beast

Bayesian Extinction And Stellar Tool
http://beast.readthedocs.io
23 stars 35 forks source link

1D pdfs of derived variables #321

Open ktchrn opened 5 years ago

ktchrn commented 5 years ago

https://github.com/BEAST-Fitting/beast/blob/7b06c434ecaedc58549eefa6588e16152efd3a7d/beast/fitting/pdf1d.py#L9

Correctly computing 1D pdfs of the intrinsic model parameters using a grid is straightforward so long as the required volume elements are available.

Correctly computing 1D pdfs of a parameter that is some function of the intrinsic model parameters using a grid is not quite so straightforward. The mathematical background can be found here.

The short version is that the correction for the distortion of the grid volume elements is pretty non-trivial to compute. It's necessary to have an inverse function which, given values for N-1 of the N intrinsic parameters and a value of the derived parameter, gives the value of the one remaining intrinsic parameter. This function needs to be differentiable with respect to the N-1 intrinsic parameters. It's then necessary to take a N-1 dimensional integral over the determinant of the matrix of derivatives of this function.

If the volume elements don't get distorted that much, neglecting the distortion term won't break things too much. However, some of the derived parameters seem to be substantially non-linear functions of the intrinsic parameters.

Not sure what to do about this one just yet!

karllark commented 5 years ago

Would it be possible to handle this to some extent if we were to improve the overall 1d pPDF creation to include the width of the grid point in the histogram space? Basically, have a set of weights as part of the pdf1d code that handles the case where the grid width is larger than a single histogram bin width.

karllark commented 5 years ago

Could we measure the impact of this issue by making successively finer grids and quantifying how the resulting derived 1d pPDFs change? To speed things up, this could be done with simulations and a physics grid that is a subset of the full BEAST grid.

ktchrn commented 5 years ago

Looking at physics grids of different resolutions and PDF bins of different resolutions would be a way to check, yes. So long as the transformed volume elements are small enough relative to the bin sizes, there doesn't seem to be a problem. The main challenge seems to be how to pick an appropriate bin size given a physics grid and transformation.

Correcting for the overlap between the transformed grid and the PDF bins could reduce the problem somewhat, it's true. This might be more trouble than it's worth, if just increasing the bin size would be sufficient. Lot of grid cell corners to propagate in order to correctly estimate the cell's transformed size.