dc_grad {dcurver} | R Documentation |
Provides the gradient for use in estimation.
dc_grad(x, phi)
x |
A vector of observations. |
phi |
phi Davidian curve parameters. A maximum of 10 parameters is allowed. |
Woods & Lin (2009) provide the gradient (Equations 17 and 18). Note that the gradient is not defined for phi = 0.0.
Woods, C. M., & Lin, N. (2009). Item response theory with estimation of the latent density using Davidian curves. Applied Psychological Measurement, 33(2), 102-117. doi: 10.1177/0146621608319512
# The loglikelihood of a univariate Davidian curve is given by, dc_LL <- function(phi, dat) { sum(log(ddc(dat, phi))) } # dc_grad can be used for obtaining the gradient of this loglikelihood as follows: dc_LL_GR <- function(phi, dat) { colSums(dc_grad(dat, phi)) } # This can be verified by numerical approximation. # For instance, using numDeriv package: ## Not run: phi <- c(-5, 2.5, 10) d <- runif(10, -5, 5) dc_LL_GR(phi, d) numDeriv::grad(dc_LL, x = phi, dat = d) phi <- c(-5, 0, 10) dc_LL_GR(phi, d) ## End(Not run)