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
transform.cpp
// Gamma distributed random effects using copulas.
#include <
TMB.hpp
>
template
<
class
Type>
Type objective_function<Type>::operator() ()
{
DATA_VECTOR
(y);
PARAMETER
(phi);
PARAMETER
(shape);
PARAMETER
(scale);
PARAMETER
(sd);
PARAMETER_VECTOR
(u);
Type res=0;
res += density::AR1(phi)(u);
vector<Type>
unif =
pnorm
(u);
vector<Type>
x =
qgamma
(unif,shape,scale);
res -=
dnorm
(y,x,sd,
true
).sum();
return
res;
}
License:
GPL v2