Skip to content

Commit

Permalink
update rmarkdown vignette
Browse files Browse the repository at this point in the history
  • Loading branch information
sdgamboa committed Sep 10, 2023
1 parent 74ac24b commit 4768638
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions vignettes/articles/phytools.Rmd
Original file line number Diff line number Diff line change
Expand Up @@ -164,6 +164,7 @@ Add internal nodes (if any):

```{r add internal nodes}
temp <- tree
temp$edge.length[which(temp$edge.length == 0)] <- head(sort(unique(temp$edge.length)))[2]
node_labels <- unique(temp$node.label)
node_labels <- node_labels[node_labels != '']
node_labels <- unlist(strsplit(node_labels, '\\+'))
Expand All @@ -186,19 +187,20 @@ for(i in seq_along(nodes)){

Let's fit a model of evolution

```{r}
```{r fit model}
missing_tips <- temp$tip.label[!(temp$tip.label %in% rownames(mat))]
values <- rep(1/ncol(mat), ncol(mat))
mat2 <- matrix(rep(values, length(missing_tips)), ncol = ncol(mat), byrow = TRUE)
rownames(mat2) <- missing_tips
colnames(mat2) <- colnames(mat)
mat3 <- rbind(mat, mat2)
mat3 <- mat3[temp$tip.label,]
system.time(
fit <- fitMk(
# extended Mk (hidden markov) model (used for discrete traits)
tree = temp,
x = mat,
x = mat3,
model = 'ARD', # all rates different
pi = "fitzjohn", # pror distribution at the root this seems to have a significant effect in the root
logscale = TRUE,
Expand Down

0 comments on commit 4768638

Please sign in to comment.