Hi Att288,
Thank you for the question. The purpose of the "Neglikelihood" function is to simply calculate the negative likelihood value, given a specific theta value. This "Neglikelihood" function will be later used in an optimization routine to find the optimal correlation strength (theta) such that the corresponding "Neglikelihood" value is maximized. Notice that in Section 6, an "argmax" operator is applied to the "Neglikelihood" formula (which appears in the code snippet line 28). In other words, the optimal theta we are looking for is the theta that maximizes the "Neglikelihood" formula.
Hope that clarifies your doubts.
Best regards,
Shuai