Mac で新しく更新された R と Traminer を使用してシーケンス データを分析していますが、seqtree と seqtreedisplay で回帰木を実行するのに問題があります。TraMineR に付属の biofam データを使用すると、R は単純なツリーと回帰ツリーを含む 3 つのエラー メッセージを表示します。
library(TraMineR)
library(TraMineRextras)
data(biofam)
bio.seq <- seqdef(biofam, 10:25, weights=bio$wp00tbgs, xtstep = 2)
## Create Ward clusters using an OM distance matrix
properties <- matrix(c(# left, married, child, divorced
0, 0, 0, 0, # parent
1, 0, 0, 0, # left
0, 1, .5, 0,# married
1, 1, 0, 0, # left+married
0, 0, 1, 0, # child
1, 0, 1, 0, # left+child
1, 1, 1, 0, # left+married+child
.5, 1, .5, 1 #divorced
), 8, 4, byrow=TRUE)
sm <- as.matrix(dist(properties))
indel <- .5 * max(sm)
bio.dist <- seqdist(bio.seq, method="OM", indel=indel, sm=sm, full.matrix=FALSE)
weight <- attr(bio.seq, "weights")
ward <- hclust(bio.dist, method="ward", members=weight)
## Tree display of the cluster solution and growing a regression tree
tree2 <- as.seqtree(ward, seqdata=bio.seq, diss=bio.dist, ncluster=2)
seqtreedisplay(tree2, type="I", border=NA, sortv="from.start", showdepth=TRUE)
treereg <- seqtree(bio.seq ~ sex + plingu02, data=biofam,
diss=bio.dist)
seqtreedisplay(treereg, type="I", border=NA, sortv="from.start")
エラーメッセージは次のとおりです。
> seqtreedisplay(tree2, type="I", border=NA, sortv="from.start", showdepth=TRUE)
sh: dot: command not found
The file /private/var/folders/YY/YYp18zjXELKZUAbIpHvtIk+++TI/-Tmp-
/RtmpVNNMlt/tmpseqtree3745b091371.png does not exist.
> treereg <- seqtree(bio.seq ~ sex + cohort2 + religion + plingu02, data=bio,
diss=bio.dist)
Error in DTNdisstree(dissmatrix = dissmatrix, predictor = predictor, terms = tterms, :
[!] To permute replicate, you should specify integer weights
> seqtreedisplay(treereg, type="I", border=NA, sortv="from.start")
Error in inherits(seqdata, "stslist") : object 'treereg' not found