-
Notifications
You must be signed in to change notification settings - Fork 11
Expand file tree
/
Copy pathsim-code.R
More file actions
47 lines (34 loc) · 1.18 KB
/
Copy pathsim-code.R
File metadata and controls
47 lines (34 loc) · 1.18 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
require(phytools)
source("Rphylip.R")
## sim code for Rproml
X<-read.protein("chloroplast.aa")
X
tree<-Rproml(X,speedier=TRUE,global=FALSE)
plot(tree,type="unrooted",no.margin=TRUE,edge.width=2,cex=0.8)
## sim code for Rtreedist
trees<-pbtree(n=26,tip.label=LETTERS,nsim=7)
trees2<-pbtree(n=26,tip.label=LETTERS,nsim=17)
D<-Rtreedist(trees,trees2=trees2,method="symmetric",quiet=TRUE)
D<-Rtreedist(trees,method="symmetric")
D<-Rtreedist(trees,method="branch.score")
system.time(Rtreedist(trees,method="symmetric"))
system.time(multiRF(trees))
## sim code for Rthreshml
tree<-pbtree(n=100)
V<-matrix(c(1,0,0.8,0,
0,2,0,1.2,
0.8,0,1,0,
0,1.2,0,1),4,4)
X<-sim.corrs(tree,V)
th<-setNames(c(0,Inf),LETTERS[1:2])
X<-data.frame(X[,1],X[,2],sapply(X[,3],threshState,th),sapply(X[,4],threshState,th))
names(X)<-paste("v",1:ncol(X),sep="")
fit<-Rthreshml(tree,X,proposal=0.1)
## sim code for Rcontrast
tree<-pbtree(n=26,scale=1,tip.label=LETTERS)
vcv<-matrix(c(1,1.2,0,1.2,2,0,0,0,3),3,3)
X<-sim.corrs(tree,vcv)
rr<-Rcontrast(tree,X)
n<-round(runif(length(tree$tip.label),1,4))
X<-cbind(sampleFrom(X[,1],xvar=0.1,n=n),sampleFrom(X[,2],xvar=0.1,n=n),sampleFrom(X[,3],xvar=0.1,n=n))
qq<-Rcontrast(tree,X)