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.

eps

eps for JacobianMat

Details

This function uses JacobianMat to calculate the first derivative.

Value

dICRF length(theta) x sum(ncat) matrix

Examples

res1=dicrf_num( paramS1, -1:1 )
res2=dirf( paramS1, -1:1, print=0, plot=0 )$dICRF
Print(max(abs(res1-res2)))



# second derivative of log P

param=paramS1
param[c(1,4),"p1"]=1

locP=which(param$type=="P")
locG=which(param$type=="G")

thmin=-4
thmax=4
npoints=121
theta=seq(thmin,thmax,length=npoints)
pres=fitG2P_ls( param[locP,], plot=1, thmin=thmin, thmax=thmax
                , npoints=npoints )
param[locG,]=pres$paramG
param[locG,"name"]=paste(param$name[locP],"g", sep="")

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 negagive exept for the 1st category of 3PLM
matplot(theta,res1[,-4], type="l"
        , main="2nd deriv. of logP: all but 1st of 3PLM")

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




[Package lazy.irt version 0.1.3 Index]