I'm looking for a way to calculate:

$$(f\ast g)(x) = \int_{\mathbb{R}^d}f(y)g(x-y)dy$$

in R. I have solved this problem using Monte-Carlo integration. However, this is numerically heavy, so I was hoping to apply the Convolution Theorem,

$$f\ast g = \mathcal{F}^{-1}[\mathcal{F}[f]\cdot\mathcal{F}[g]],$$

to speed up the calculations. However, I am having trouble wrapping my head around how to do this, even after reading the documentation.

Whenever I compute the above using FFT it doesn't seem to resemble what I got in my Monte-Carlo approach. I'm fairly certain it's due to the index and sampling, so if anyone could provide some insights on how to accomplish it would be much appreciated. Specifically on how to relate function evaluation and FFT indices to retrieve the desired convolution.

Thank you in advance. :-)

To provide some insight on what I'm trying to accomplish:

I want to make a smooth approximation of the empirical copula. Given a sample $U_{(i,j)}, i \in\{1,\dots,n\},j \in\{1,\dots,d\}$ of Uniform $[0,1]$ variables I define the empirical copula:

$$C_n((u_1, \dots u_d)) \triangleq \frac{1}{n}\sum_{i=1}^n \prod_{j=1}^d \mathbf{1}_{(U_{(i,j)},1]}(u_j)$$

I have made a constructor for this:

Empirical_Copula = function(U){  
  Cn = function(u){
    Prods = apply(U, 1, function(x){all(x <= u)})

The empirical copula is obviously discontinuous, so my idea is to "mollify" it using the function:

$$\begin{aligned} \phi(x) &= c_d \exp\left(\frac{-1}{1-||x||^2}\right)\mathbf{1}_{||x||<1}(x)\\ \phi_\varepsilon(x) &= \frac{1}{\varepsilon^d}\phi\left(\frac{x}{\varepsilon}\right) \end{aligned}$$

Where $\varepsilon\in(0,1)$ and $c_d$ is a number such that $\int_{\mathbb{R}^d} \phi(x) dx = 1$.

It is shown here (page 5: Theorem 3 and page 6: Theorem 5) that for $f\in L^p$ we have $f\ast \phi_\varepsilon \to f$ in $L^p$ as $\varepsilon\to 0$ and for $f\in L^1_{loc}$ we have $f\ast \varphi_\varepsilon \in C^\infty$. My goal is to approximate "the true" copula $C$ by a smooth function, i.e.

$$C \approx C_n \approx C_n \ast \phi_\varepsilon \in C^\infty.$$

My hope is that once implemented then I can sample from $C_n\ast \phi_\varepsilon$. I'm currently just playing around to see if this yields anything, so if my approach is off just let me know, or if there are good alternatives.

  • $\begingroup$ Could you please show us an example of the calculation you are performing? $\endgroup$ – whuber Jun 1 '19 at 16:24

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.