次のテキストファイル company325.txt を用意しました。
#下位因子
V11 <- 自信, NA ,1
V10 <- 自信, s10, NA
V9 <- 自信, s9, NA
V8 <- 自信, s8, NA
V7 <- 自信, s7, NA
V6 <- 自信, s6, NA
V5 <- 自信, s5, NA
V4 <- 自信, s4, NA
V3 <- 自信, s3, NA
V2 <- 自信, s2, NA
V1 <- 自信, s1, NA
#一般因子
V11 <- 仲間関係, NA, 1
V10 <- 仲間関係, r1, NA
V9 <- 仲間関係, r2, NA
V8 <- 身体外見, NA, 1
V7 <- 身体外見, l1, NA
V6 <- 身体外見, l2, NA
V5 <- 身体外見, l3, NA
V4 <- 身体能力, NA, 1
V3 <- 身体能力, a1, NA
V2 <- 身体能力, a2, NA
V1 <- 身体能力, a3, NA
#因子の分散
仲間関係 <-> 仲間関係, d1, NA
身体外見 <-> 身体外見, d2, NA
身体能力 <-> 身体能力, d3, NA
自信 <-> 自信, d4, NA
#因子の間の相関
仲間関係 <-> 身体外見, cor1
身体能力 <-> 仲間関係, cor2
身体外見 <-> 身体能力, cor3
V11 <- 自信, NA ,1
V10 <- 自信, s10, NA
V9 <- 自信, s9, NA
V8 <- 自信, s8, NA
V7 <- 自信, s7, NA
V6 <- 自信, s6, NA
V5 <- 自信, s5, NA
V4 <- 自信, s4, NA
V3 <- 自信, s3, NA
V2 <- 自信, s2, NA
V1 <- 自信, s1, NA
#一般因子
V11 <- 仲間関係, NA, 1
V10 <- 仲間関係, r1, NA
V9 <- 仲間関係, r2, NA
V8 <- 身体外見, NA, 1
V7 <- 身体外見, l1, NA
V6 <- 身体外見, l2, NA
V5 <- 身体外見, l3, NA
V4 <- 身体能力, NA, 1
V3 <- 身体能力, a1, NA
V2 <- 身体能力, a2, NA
V1 <- 身体能力, a3, NA
#因子の分散
仲間関係 <-> 仲間関係, d1, NA
身体外見 <-> 身体外見, d2, NA
身体能力 <-> 身体能力, d3, NA
自信 <-> 自信, d4, NA
#因子の間の相関
仲間関係 <-> 身体外見, cor1
身体能力 <-> 仲間関係, cor2
身体外見 <-> 身体能力, cor3
そして、次のスクリプトを実行しました。
ccompany325.mdl <- specifyModel("model/company325.txt")
summary(company325.sem <- sem(company325.mdl, S = cor.company, N = 100, standardized = TRUE))
stdCoef(company325.sem)
pathDiagram(company325.sem, edge.labels = "values",standardize = TRUE,
node.font = c("IPAGothic",12), edge.font = c("IPAMincho",10),
rank.direction = "TB", ignore.double = FALSE,
same.rank = c("仲間関係,身体外見,身体能力", "自信"))
summary(company325.sem <- sem(company325.mdl, S = cor.company, N = 100, standardized = TRUE))
stdCoef(company325.sem)
pathDiagram(company325.sem, edge.labels = "values",standardize = TRUE,
node.font = c("IPAGothic",12), edge.font = c("IPAMincho",10),
rank.direction = "TB", ignore.double = FALSE,
same.rank = c("仲間関係,身体外見,身体能力", "自信"))
company325.dotファイルは出力のママだと、下位因子が一般因子が同じ並びになるので、赤い箇所の矢印の向きを反転し、dir=back を書き加えてみました。ついでにラベルを書き加えてタイトルまでおごってしまいます。
digraph "company325.sem" {
rankdir=TB;
size="8,8";
node [fontname="IPAGothic" fontsize=12 shape=box];
edge [fontname="IPAMincho" fontsize=10];
center=1;
{rank=same "仲間関係" "身体外見" "身体能力"}
"仲間関係" [shape=ellipse]
"身体外見" [shape=ellipse]
"身体能力" [shape=ellipse]
"自信" [shape=ellipse]
"V11" -> "自信" [label="0.63" dir=back];
"V10" -> "自信" [label="0.29" dir=back];
"V9" -> "自信" [label="0.21" dir=back];
"V8" -> "自信" [label="0.51" dir=back];
"V7" -> "自信" [label="0.6" dir=back];
"V6" -> "自信" [label="-0.03" dir=back];
"V5" -> "自信" [label="0.02" dir=back];
"V4" -> "自信" [label="0.38" dir=back];
"V3" -> "自信" [label="0.64" dir=back];
"V2" -> "自信" [label="0.5" dir=back];
"V1" -> "自信" [label="0.2" dir=back];
"仲間関係" -> "V11" [label="0.55"];
"仲間関係" -> "V10" [label="0.82"];
"仲間関係" -> "V9" [label="0.61"];
"身体外見" -> "V8" [label="0.72"];
"身体外見" -> "V7" [label="0.54"];
"身体外見" -> "V6" [label="0.72"];
"身体外見" -> "V5" [label="0.89"];
"身体能力" -> "V4" [label="0.78"];
"身体能力" -> "V3" [label="0.45"];
"身体能力" -> "V2" [label="0.61"];
"身体能力" -> "V1" [label="0.66"];
"仲間関係" -> "仲間関係" [label="1" dir=both];
"身体外見" -> "身体外見" [label="1" dir=both];
"身体能力" -> "身体能力" [label="1" dir=both];
"自信" -> "自信" [label="1" dir=both];
"仲間関係" -> "身体外見" [label="0.69" dir=both];
"身体能力" -> "仲間関係" [label="0.4" dir=both];
"身体外見" -> "身体能力" [label="0.32" dir=both];
"V11" -> "V11" [label="0.3" dir=both];
"V10" -> "V10" [label="0.24" dir=both];
"V9" -> "V9" [label="0.58" dir=both];
"V8" -> "V8" [label="0.22" dir=both];
"V7" -> "V7" [label="0.35" dir=both];
"V6" -> "V6" [label="0.48" dir=both];
"V5" -> "V5" [label="0.21" dir=both];
"V4" -> "V4" [label="0.24" dir=both];
"V3" -> "V3" [label="0.38" dir=both];
"V2" -> "V2" [label="0.38" dir=both];
"V1" -> "V1" [label="0.52" dir=both];
fontname = "IPAGothic" ;
fontsize = 15;
label = "階層因子分析による結果";
labelloc = "t"
}
rankdir=TB;
size="8,8";
node [fontname="IPAGothic" fontsize=12 shape=box];
edge [fontname="IPAMincho" fontsize=10];
center=1;
{rank=same "仲間関係" "身体外見" "身体能力"}
"仲間関係" [shape=ellipse]
"身体外見" [shape=ellipse]
"身体能力" [shape=ellipse]
"自信" [shape=ellipse]
"V11" -> "自信" [label="0.63" dir=back];
"V10" -> "自信" [label="0.29" dir=back];
"V9" -> "自信" [label="0.21" dir=back];
"V8" -> "自信" [label="0.51" dir=back];
"V7" -> "自信" [label="0.6" dir=back];
"V6" -> "自信" [label="-0.03" dir=back];
"V5" -> "自信" [label="0.02" dir=back];
"V4" -> "自信" [label="0.38" dir=back];
"V3" -> "自信" [label="0.64" dir=back];
"V2" -> "自信" [label="0.5" dir=back];
"V1" -> "自信" [label="0.2" dir=back];
"仲間関係" -> "V11" [label="0.55"];
"仲間関係" -> "V10" [label="0.82"];
"仲間関係" -> "V9" [label="0.61"];
"身体外見" -> "V8" [label="0.72"];
"身体外見" -> "V7" [label="0.54"];
"身体外見" -> "V6" [label="0.72"];
"身体外見" -> "V5" [label="0.89"];
"身体能力" -> "V4" [label="0.78"];
"身体能力" -> "V3" [label="0.45"];
"身体能力" -> "V2" [label="0.61"];
"身体能力" -> "V1" [label="0.66"];
"仲間関係" -> "仲間関係" [label="1" dir=both];
"身体外見" -> "身体外見" [label="1" dir=both];
"身体能力" -> "身体能力" [label="1" dir=both];
"自信" -> "自信" [label="1" dir=both];
"仲間関係" -> "身体外見" [label="0.69" dir=both];
"身体能力" -> "仲間関係" [label="0.4" dir=both];
"身体外見" -> "身体能力" [label="0.32" dir=both];
"V11" -> "V11" [label="0.3" dir=both];
"V10" -> "V10" [label="0.24" dir=both];
"V9" -> "V9" [label="0.58" dir=both];
"V8" -> "V8" [label="0.22" dir=both];
"V7" -> "V7" [label="0.35" dir=both];
"V6" -> "V6" [label="0.48" dir=both];
"V5" -> "V5" [label="0.21" dir=both];
"V4" -> "V4" [label="0.24" dir=both];
"V3" -> "V3" [label="0.38" dir=both];
"V2" -> "V2" [label="0.38" dir=both];
"V1" -> "V1" [label="0.52" dir=both];
fontname = "IPAGothic" ;
fontsize = 15;
label = "階層因子分析による結果";
labelloc = "t"
}
dot -Tpdf < company325.dot > company325.pdf
で、こんなふうな絵が描けました。
0 件のコメント:
コメントを投稿