# How to run a Epanechnikov (parabolic) decay in QGIS 3.6 field calculator

Does anyone know how you would implement a Epanechnikov (parabolic) decay to a field in QGIS field calculator. I am trying to apply varying distance decay functions in order to assess the best suitability.

I have run a Gaussian decay using but I am struggling to find any sources on how you would apply a parabolic decay ("Distance" is the field I am running this on).

My Gaussian decay example

``````exp(-("Distance" * "Distance")/(2 * (10000 * 10000 )))
``````
• Are you asking for the equation for an Epanechnikov decay function or the procedure for implementing it in QGIS? – Jeffrey Evans May 15 '19 at 17:39
• @JeffreyEvans I guess I am looking for both. Math is not my strong point - I can find examples of the kernel function online but I do not know how to translate that to a decay function as I have for the Gaussian decay example – AWGIS May 15 '19 at 17:45

Your formula is correct and valid in QGIS, and will yield a Gaussian kernel:

However, the field you are trying to calculate needs more digits, since the exp decay you defined is very "slow" (the squared Distance is divided by 200.000.000). Depending on the magnitude of your `Distance` values you will need to allocate more decimal digits when you define the field:

With the made-up examples above, I had to use at least 6 "precision" digits to notice any difference between a Distance of 4 and one of 100.

For an actual Epanechnikov kernel:

``````3/4 * (1- ("Distance"/ maximum("Distance")) ^ 2 )
``````

where `"Distance"/ maximum("Distance")` is the normalized Distance, i.e. the Distance value of each feature, divided by the maximum value of all instances of the layer.

• Thank you for your quick response - the distance decay example I have given is a Gaussian decay function but not the parabolic function I was looking for. I really appreciate the advice regarding the precision value though! – AWGIS May 15 '19 at 16:58
• What about 3/4 * (1- ("Distance"/ maximum("Distance")) ^ 2 ) ? See updated answer. – RafDouglas May 15 '19 at 20:29