keyfct.grad.hz {mrds} | R Documentation |
The gradient of the hazard-rate key function
Description
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
Usage
keyfct.grad.hz(distance, key.scale, key.shape, shape = FALSE)
Arguments
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 |
Details
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.
Value
matrix of derivatives of the hazard rate key function w.r.t. the scale parameter and the shape parameter.