View source: R/keyfct.grad.hz.R
keyfct.grad.hz | R Documentation |
The key function contains two parameters, the scale and the shape, and so the gradient is two-dimensional. Current implementation assumes that scaled dist is x/scale, not x/width
keyfct.grad.hz(distance, key.scale, key.shape, shape = FALSE)
distance |
perpendicular distance vector |
key.scale |
vector of scale values |
key.shape |
vector of shape values |
shape |
is the gradient parameter the shape parameter? Defaults to FALSE |
d key / d scale = (shape * exp(-(1/ (x/scale) ^ shape)) / ((x/scale) ^ shape ) * scale) d key / d shape = - ((log(x / scale) * exp(-(1/ (x/scale) ^ shape))) / (x/scale) ^ shape)
When distance = 0, the gradients are also zero. However, the equation below will result in NaN and (-)Inf due to operations such as log(0) or division by zero. We correct for this in line 33.
matrix of derivatives of the hazard rate key function w.r.t. the scale parameter and the shape parameter.
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.