paviaishu16 / Multiplate-reader-data-analyser

0 stars 0 forks source link

Fitting growth models and goodness of fit #21

Closed paviaishu16 closed 4 weeks ago

paviaishu16 commented 1 month ago

Using Numpy and Scipy, one could fit the growth curve to different models. In this model we are expecting to fit the curve to Richards and Gompertz model. We can use the growth parameters obtained for this task.

Steps to Fit a Growth Model and Check Goodness of Fit:

gevhaz commented 1 month ago

What should the output of this task be @paviaishu16?

R-squared, RMSE, AIC and plots for each well?

paviaishu16 commented 1 month ago

Let us just consider this as a steps for the next issues! Fitting the model is the first part which is gompertz and richards model and get the plots with the predicted and actual data. And goodness of fit is the second part from which is decided by AIC

paviaishu16 commented 1 month ago

As a next step we also identify the BIC, Bayesian Information Criterion.

def calculate_bic(n, k, sse):

    # Calculate log likelihood from Sum of Squared Errors (SSE)
    log_likelihood = -n / 2 * (np.log(2 * np.pi * (sse / n)) + 1)

    # BIC formula
    bic = k * np.log(n) - 2 * log_likelihood
    return bic

sse is the sum of squared errors (the one that we get from the gompertz and richards curve fitting) n is the number of observation (in this case it would 146 I think i.e., number of rows) k is the number of parameters in the model ( 4 for richards and 3 for gompertz)

paviaishu16 commented 1 month ago

Next step is to identify the best model: The best model is the one with lowest AIC/BIC value

gevhaz commented 1 month ago

@paviaishu16 what if one has lower AIC and the other has lower BIC?

paviaishu16 commented 1 month ago

Do we have a situation like that? We have to give higher priority to BIC value in that case. However, it shouldn't be possible to have such a case where AIC is lower and BIC is high or the way around