我正在尝试使用R中的diversitree
包进行分析。
我正在尝试使用多种不同的模型组合来分析蔷薇科的系统发育,以便从我在MuSSE
中进行的不同分析中解析出输出的显着性水平。然而,我发现某些字符组合会导致R显然崩溃 - 它变得无法响应,并且通常需要大约一分钟的分析永远不会完成。
代码以及有问题的行如下:
setwd("MyWd")
require(diversitree)
mytree = read.nexus("BEAST_Rosales_final.nex")
nopoly = multi2di(mytree, random=TRUE)
pruned = drop.tip(nopoly, "Pseudolmedea")
pruned = drop.tip(pruned, "Zizyphus")
nopoly = multi2di(mytree, random=TRUE)
chardata = read.csv("Chapter_2_BiSSE.csv", header=TRUE)
statesD = chardata$D
statesW = chardata$W
statesR = chardata$R
statesS = chardata$S
statesDW = chardata$DW
statesDR = chardata$DR
statesDS = chardata$DS
statesWR = chardata$WR
statesWS = chardata$WS
statesRS = chardata$RS
statesDWR = chardata$DWR
statesDWS = chardata$DWS
statesDRS = chardata$DRS
statesWRS = chardata$WRS
statesDWRS = chardata$DWRS
names(statesD) = chardata$Genus
names(statesW) = chardata$Genus
names(statesR) = chardata$Genus
names(statesS) = chardata$Genus
names(statesDW) = chardata$Genus
names(statesDR) = chardata$Genus
names(statesDS) = chardata$Genus
names(statesWR) = chardata$Genus
names(statesWS) = chardata$Genus
names(statesRS) = chardata$Genus
names(statesDWR) = chardata$Genus
names(statesDWS) = chardata$Genus
names(statesDRS) = chardata$Genus
names(statesWRS) = chardata$Genus
names(statesDWRS) = chardata$Genus
likD = make.bisse(pruned, statesD)
likW = make.bisse(pruned, statesW)
likR = make.bisse(pruned, statesR)
likS = make.bisse(pruned, statesS)
likDW = make.bisse(pruned, statesDW)
likDR = make.bisse(pruned, statesDR)
likDS = make.bisse(pruned, statesDS)
likWR = make.bisse(pruned, statesWR)
likWS = make.bisse(pruned, statesWS)
likRS = make.bisse(pruned, statesRS)
likDWR = make.bisse(pruned, statesDWR)
likDWS = make.bisse(pruned, statesDWS)
likDRS = make.bisse(pruned, statesDRS)
likWRS = make.bisse(pruned, statesWRS)
likDWRS = make.bisse(pruned, statesDWRS)
lik0 = constrain(likDWRS, lambda1 ~ lambda0, mu1 ~ mu0, q10 ~ q01)
startp = starting.point.bisse(pruned)
fit0 = find.mle(lik0, startp[argnames(lik0)]) #not problematic
fitD = find.mle(likD, startp[argnames(likD)]) #not problematic
fitW = find.mle(likW, startp[argnames(likW)]) #not problematic
fitR = find.mle(likR, startp[argnames(likR)]) #not problematic
fitS = find.mle(likS, startp[argnames(likS)]) #not problematic
fitDW = find.mle(likDW, startp[argnames(likDW)]) #not problematic
fitDR = find.mle(likDR, startp[argnames(likDR)]) #not problematic
fitDS = find.mle(likDS, startp[argnames(likDS)]) #problematic!
fitWR = find.mle(likWR, startp[argnames(likWR)]) #not problematic
fitWS = find.mle(likWS, startp[argnames(likWS)]) #problematic!
fitRS = find.mle(likRS, startp[argnames(likRS)]) #not problematic
fitDWR = find.mle(likDWR, startp[argnames(likDWR)]) #not problematic
fitDWS = find.mle(likDWS, startp[argnames(likDWS)]) #problematic!
fitDRS = find.mle(likDRS, startp[argnames(likDRS)]) #problematic!
fitWRS = find.mle(likWRS, startp[argnames(likWRS)]) #problematic!
fitDWRS = find.mle(likDWRS, startp[argnames(likDWRS)]) #problematic!
summary(fit0)
summary(fitD)
summary(fitW)
summary(fitR)
summary(fitS)
summary(fitDW)
summary(fitDR)
summary(fitDS)
summary(fitWR)
summary(fitWS)
summary(fitRS)
summary(fitDWR)
summary(fitDWS)
summary(fitDRS)
summary(fitWRS)
summary(fitDWRS)
AIC(fit0, fitD, fitW, fitR, fitS, fitDW, fitDR, fitDS, fitWR, fitWS, fitRS, fitDWR, fitDWS, fitDRS, fitWRS, fitDWRS)
注意到负责此问题的线路。我观察到我的253个终端提示,所有导致问题的行只有大约50个提示有一个字符状态,而另外200个有另一个状态。我编码为状态0或状态1的状态无关紧要。
有人能告诉我什么问题吗?