knitr::opts_chunk$set(
  collapse = TRUE,
  comment = "#>", 
  fig.align = "center",
  eval = TRUE
)
library(zazou)
library(ape)
set.seed(42)

Parameters

tree <- read.tree(text = "(((A:1,B:1):1,C:2):1,(D:1,E:1):2);")
true_shifts <- c(0, -3, 0, 0, 0, 0, -2, 0)
alphaOU <- 1
lambda <- 0.1
(true_zscores <- incidence_matrix(tree) %*% true_shifts)

Simulations

observed_zscores <- simu_zscores(tree = tree, shifts = true_shifts, 
                                 alphaOU = 1, graph = TRUE)
observed_zscores

Comparisons

L-BFGS-B algorithm

mthd1 <- estimate_shifts(zscores = observed_zscores, 
                         lambda = lambda, tree = tree, alphaOU = alphaOU, 
                         method = "L-BFGS-B")
mthd1
plot(mthd1)

Shooting algorithm

mthd2 <- estimate_shifts(zscores = observed_zscores, 
                         lambda = lambda, tree = tree, alphaOU = alphaOU, 
                         method = "lasso")
mthd2
plot(mthd2)

Results

Shifts

true_shifts
mthd1$shifts_est
mthd2$shifts_est

Z-scores

t(true_zscores)
mthd1$zscores_est
mthd2$zscores_est

Objective

mthd1$objective_value
mthd2$objective_value

Other informations

mthd1$optim_info
mthd2$optim_info


abichat/zazou documentation built on Sept. 8, 2021, 6:53 a.m.