Loading [MathJax]/extensions/TeX/AMSsymbols.js
TMB Documentation
v1.9.11
Main Page
Related Pages
Modules
+
Namespaces
Namespace List
+
Namespace Members
+
All
a
b
c
d
e
f
g
h
i
j
k
l
m
n
o
p
q
r
s
t
u
v
w
+
Functions
a
b
c
d
e
f
g
h
i
j
k
l
m
n
o
p
q
r
s
t
u
v
w
Enumerations
+
Classes
Class List
Class Hierarchy
+
Class Members
+
All
a
b
c
d
e
f
g
h
i
j
k
l
m
n
o
p
r
s
t
u
v
w
x
y
+
Functions
a
b
c
d
e
f
g
h
i
j
l
m
n
o
p
r
s
t
u
v
w
x
y
+
Variables
a
b
c
d
e
f
g
h
i
k
l
m
n
o
p
r
s
t
u
v
w
x
Typedefs
Enumerations
Enumerator
+
Files
File List
+
File Members
+
All
a
b
c
d
g
i
l
m
n
o
p
q
r
s
t
v
+
Functions
a
b
c
d
i
l
m
n
o
p
q
r
s
+
Macros
a
d
g
n
p
r
s
t
v
Examples
•
All
Classes
Namespaces
Files
Functions
Variables
Typedefs
Enumerations
Enumerator
Macros
Modules
Pages
lr_test.cpp
// Illustrate map feature of TMB to perform likelihood ratio tests on a ragged array dataset.
#include <
TMB.hpp
>
template
<
class
Type>
Type objective_function<Type>::operator() ()
{
DATA_VECTOR
(obs);
DATA_FACTOR
(group);
PARAMETER_VECTOR
(mu);
PARAMETER_VECTOR
(sd);
Type res=0;
for
(
int
i=0;i<obs.size();i++){
res -=
dnorm
(obs[i],mu[group[i]],sd[group[i]],
true
);
}
return
res;
}
License:
GPL v2