## SKG
## March 27, 2020
## Trying to test likelihood for imputed trees missing the root node
## Monday morning:
## Take orig likelihood for each cluster and divide it by [w+(1 - p+) + w-(1- p_)] where
## w+ = x/n, w- = 1 - w+
devtools::load_all()
inf_params <- c("beta_0" = -1, "beta_1" = 0)
smear_pos_prob <- .5
max_size <- 50
K <- 5000
obs_clusters <- simulate_outbreak(K = K,
inf_params = inf_params,
smear_pos_prob = smear_pos_prob,
max_size = max_size,
start_at_outsider = TRUE)
cluster_summ <- summarize_clusters(obs_clusters)
## imputed_clusters <- impute_root(cluster_summ,
## B = 10,
## prob_pos = .5)
n_trials <- 1000
cluster_summary <- cluster_summ
t <- proc.time()[3]
sampled_trees <- tree_sampler(cluster_summary,
B = n_trials,
impute_generator = TRUE)
print(proc.time()[3] - t)
par <- c("beta_0" = 0, "beta_1" = 0)
best_pars <- optim(par, fn = loglike_fast,
data = cluster_summary,
sampled_trees_summary = sampled_trees,
cond_on_generator = TRUE,
is_truncated = FALSE,
return_neg = TRUE,
hessian = TRUE)
best_pars$par
sqrt(diag(solve(best_pars$hessian)))
## Next
## Write up two likelihood approaches
## Is truncated geom wrong? sampling etc
## Try some more fiddling
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.