-
Notifications
You must be signed in to change notification settings - Fork 0
/
kkr.R
30 lines (20 loc) · 1.04 KB
/
kkr.R
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
library(TMB)
compile("kkr.cpp", framework="TMBad")#, flags="-g -O0")
dyn.load(dynlib("kkr"))
load("kkr.RData")
#
dat$mode<-0 # dense
obj <- MakeADFun(dat, par, DLL="kkr", map=list(logsdF=as.factor(rep(0,length(par$logsdF)))), silent=FALSE)
print(paste("Dense jnll:", obj$fn()))
dat$mode<-1 # generator
obj <- MakeADFun(dat, par, DLL="kkr", map=list(logsdF=as.factor(rep(0,length(par$logsdF)))), silent=FALSE)
print(paste("Generator jnll:", obj$fn()))
dat$mode<-2 # hand written
obj <- MakeADFun(dat, par, DLL="kkr", map=list(logsdF=as.factor(rep(0,length(par$logsdF)))), silent=FALSE)
print(paste("Hand written jnll:", obj$fn()))
dat$mode<-2 # hand written
obj <- MakeADFun(dat, par, random=c("logN", "logF", "missing"), DLL="kkr", map=list(logsdF=as.factor(rep(0,length(par$logsdF)))), silent=FALSE)
print(paste("Hand written nll:", obj$fn()))
#dat$mode<-1 # generator
#obj <- MakeADFun(dat, par, random=c("logN", "logF", "missing"), DLL="kkr", map=list(logsdF=as.factor(rep(0,length(par$logsdF)))), silent=FALSE)
#print(paste("Generator nll:", obj$fn()))