Lobatto quadrature

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.

The pracma package provides a quadl function. It's manual page describes how to use including a working example:

library(pracma)
options(digits=15)
f <- function(x) x * cos(0.1*exp(x)) * sin(0.1*pi*exp(x))
quadl(f, 0, 4)
#> [1] 1.2821290743501
integrate(f, 0, 4)
#> 1.2821290743501 with absolute error < 4.1e-06

Created on 2022-09-26 with reprex v2.0.2
Does this help? If not: What have you tried so far?

@rstub thank you that helped!

This topic was automatically closed 42 days after the last reply. New replies are no longer allowed.

If you have a query related to it or one of the replies, start a new topic and refer back with a link.