dc_grad: Gradient of the log-likelihood of univariate Davidian curves

Description Usage Arguments Details References Examples

View source: R/RcppExports.R

Description

Provides the gradient for use in estimation.

Usage

1
dc_grad(x, phi)

Arguments

x

A vector of observations.

phi

phi Davidian curve parameters. A maximum of 10 parameters is allowed.

Details

Woods & Lin (2009) provide the gradient (Equations 17 and 18). Note that the gradient is not defined for phi = 0.0.

References

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

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
# 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)

dcurver documentation built on Nov. 8, 2020, 4:34 p.m.