tr = ape::rtree(3)
model = glinv_gauss(tr, x0=c(0,0), X=matrix(rnorm(6),2,3))
par = unlist(
list(
list('Phi' = c(1,0,0,1), # Parameters for node #1, a tip
'w' = c(-1,1),
'V' = c(1,0,1)), # Lower triangular part of a 2D identity matrix
list('Phi' = c(2,0,0,2), # For node #2, a tip
'w' = c(-2,2),
'V' = c(2,0,2)),
list('Phi' = c(3,0,0,3), # For node #3, a tip
'w' = c(-3,3),
'V' = c(3,0,3)),
list('Phi' = c(4,0,0,4), # For node #5. Node #4 skipped as it is the root
'w' = c(-4,4),
'V' = c(4,0,4))
))
print(par)
lik(model, par)
grad(model, par)
hess(model, par)
Run the code above in your browser using DataLab