# Comparing bug prediction methods by logistic growth and Gompertz curve in Nspire

Analysis can be performed on a sample set of data with cumulative bug counts collected over 12 days to obtain parameters to fit in models for future prediction. Column A and B are data, with the standard Nspire logistic regression function executed on column C and D to obtain the parameters a,b,c. Column E is the function value of the logistic function but not the one built-in with Nspire, instead the parameters are obtained separately using the Nelder-Mead program from the previous post. There are other models besides logistic regression for prediction, one being an sigmoid function called Gompertz function and is applied to the same data set to obtain the parameters for comparison with the more common logistic function. Since the parameters are obtained in a similar fashion as the logistic function, i.e. by minimizing the sum of errors, the Nelder-Mead program can be reused. After obtaining the parameters, the function values on the data set are calculated and shown in Column F.

The application of the Nelder-Mead program to obtain the parameters of the logistic regression is shown below. Firstly the logi function is declared, and the sum of squared error is declared in the numfunc_logi function which in turn will be passed to the nm function in order to obtain the minimum by the Nelder-Mead algorithm. As shown below the results are exactly the same with the Nspire built-in logistic regression function (a=64.003, b=9.0317, c=0.33644, albeit the Nspire formula named a,b,c differently). The application of the Nelder-Mead program to obtain the parameters of the Gompertz function is similar. The number of bugs, data fit for both functions are plotted in the below graph alongside with the logistic regression curve. Hard to tell which of the two functions is better? Turns out there is some guess better than others. As the calculation of Ru value below shown, the Gompertz function provided a little better fit in this bug prediction case. To calculate, obtain the one-var stats from the bugs data (only the sum of squares of deviation, stat.SSX is needed), and then plug in other values accordingly. Similar to the R coefficient in regression analysis, the larger value is, the better the prediction. And in this case, 0.9248 from Gompertz outperformed 0.9107 from logistic. Eduguesstimate is what I’d call this conclusion 😉