Hey guys, currently taking a course in finance called computational methods - basically working with R. We are currently seeing Value at Risk and Expected Shortfall and need to apply the lobatto quadrature with the quadl command on some dataset. I do not know how to apply it properly, would highly appreciate some feedback on this. Please see exact task below.

For the whole sample of SMI losses (data), calculate 97.5%-ES considering the Lobatto quadrature (quadl command) and the code for Studentâ€™s quantile, for Studentâ€™s t with 3 and 5 degrees of freedom. Take into account the mean and standard deviation of the SMI losses when calculating ES.