Given a distance matrix from calcVinEll, calculate a stochastic matrix where one step movement probabilities follow a gamma density.

calcGammaKernel(distMat, shape, rate)



Distance matrix from calcVinEll


Shape parameter of GammaDist distribution


Rate parameter of GammaDist distribution


The distribution and density functions for the gamma kernel are given below: $$ F(x)=\frac{1}{\Gamma(\alpha)}\gamma(\alpha,\beta x) $$ $$ f(x)=\frac{\beta^{\alpha}}{\Gamma(\alpha)}x^{\alpha-1}e^{-\beta x} $$ where \(\Gamma(\alpha)\) is the Gamma function, \(\gamma(\alpha,\beta x)\) is the lower incomplete gamma function, and \(\alpha,\beta\) are the shape and rate parameters, respectively.


# setup distance matrix # two-column matrix with latitude/longitude, in degrees latLong = cbind(runif(n = 5, min = 0, max = 90), runif(n = 5, min = 0, max = 180)) # Vincenty Ellipsoid distance formula distMat = calcVinEll(latLongs = latLong) # calculate gamma distribution over distances # shape and rate are just for example kernMat = calcGammaKernel(distMat = distMat, shape = 1, rate = 1)