0
$\begingroup$

Define $K_h$ as$$ K_h(x) = \dfrac{1}{h}K\bigg(\dfrac{x}{h}\bigg), $$ where $K$ is the Gaussian function$$ K(x) = \frac{1}{\sqrt{2\pi}}e^{-\frac{1}{2}x^2}. $$

Define the function $T(x,y)$ by$$ T(x,y) = ((K_h*K_g - K_g)*(K_h*K_g - K_g))(x-y). $$

This expression arises in the context of bootstrapping for kernel density estimation. How can this expression be evaluated in Mathematica?

$\endgroup$
1
  • 1
    $\begingroup$ Try: k[x_] = 1/Sqrt[2 Pi] Exp[-x^2/2]; kh[x_] = 1/h K[x/h]; kg[x_] = 1/g K[x/g]; T[x_, y_] = ((kh[x] kg[x] - kg[x]) (kf[x] kg[x] - kg[x])) (x - y); T[x, y] $\endgroup$ Apr 6, 2021 at 16:18

1 Answer 1

1
$\begingroup$
Clear["Global`*"]

k[h_, x_] = PDF[NormalDistribution[0, h], x]

(* E^(-(x^2/(2 h^2)))/(h Sqrt[2 π]) *)

Assuming that the first part takes the argument x - y rather than being distributed across x - y

t[x_, y_] = ((k[h, #]*k[g, #] - k[g, #])^2) &[x - y] // Simplify

(* (E^(-(((g^2 + h^2) (x - y)^2)/(
  g^2 h^2))) (-1 + 
   E^((x - y)^2/(2 h^2)) h Sqrt[2 π])^2)/(4 g^2 h^2 π^2) *)
$\endgroup$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.