Generative Functions

A generative function is a function or set of functions that can be used to generate a data sample. Generative function are very useful as a way to Monte Carlo a data set and then test if one’s analysis can recover things about the generating function correctly.

For this lab we will create a generating function for one of the first four labs we have done. As a reminder those have been a Gaussian distribution, a linear relationship with unknown errors, an exponential relationship with unknown errors and a power-law relationship with Poisson errors.

Choose one and then try to create data like the data that was given in the lab. For this you will need to use results that you achieved in the lab when fitting the data. You may need to also make choices about the nature of the errors on the data. Generate the same amount of data as was given. Then perform your analysis again and see what you get. Create a loop over your analysis so that you can generate 100 different data sets and get your fit parameters and save them. Look at your residuals and see if they are the same as from the actual data. Do you have a good generative function? What is the range of results you would expect for your generative function? Is your error model correct? or need improvement?