dicrf_num {lazy.irt}R Documentation

Numerical Derivatives of ICRF w.r.t. theta

Description

Numerical Derivatives of ICRF w.r.t. theta

Usage

dicrf_num(param, theta, log = 0, second = 0, eps = 1e-06)

Arguments

param

Item Parameter Data Frame

theta

Discrete theta values

log

= 1 to calculate log derivatives.

second

= 1 to calculate second derivatives

eps

eps for JacobianMat

Details

This function uses lazy.mat::JacobianMat to calculate the first derivative. Except for the second derivatives, the analytic functions are available in dirf.

Value

dICRF length(theta) x sum(ncat) matrix

Examples

res1 <- dicrf_num( paramS1, -3:3 )
res2 <- dirf( paramS1, -3:3, print=0, plot=0 )$dICRF
Print(apply(abs(res1-res2),2,max))

# second derivative of P
res3 <- dicrf_num( paramS1, -3:3, second=1 )


## Not run: 

thmin <- -4
thmax <- 4
npoints <- 121
theta <- seq(thmin,thmax,length=npoints)

param <- paramA1[1:7,]


log <- 1
res1 <- dicrf_num( param, theta, log=log, second=1 )

# all
matplot(theta,res1, type="l", main="2nd deriv. of logP")

# 0-th category: all negative
fromP <- get_range(param$ncat )[,1]
matplot(theta,res1[,fromP], type="l", main="2nd deriv. of logP: 0-th cat")

# all negative except for the 1st category of 3PLM
matplot(theta,res1[,-c(4,8)], type="l"
        , main="2nd deriv. of logP: all but 1st of 3PLM")

# 1st category of 3PLM
matplot(theta,res1[,c(4,8)], type="l", main="2nd deriv. of logP: 1st of 3PLM")


## End(Not run)


[Package lazy.irt version 0.1.6 ]