×
[PR]上記の広告は3ヶ月以上新規記事投稿のないブログに表示されています。新しい記事を書く事で広告が消えます。
http://shakaichousa.net/mua/
SPSS社公開データ
http://www.spss.co.jp/support/sample.html
SPSSによるカテゴリカルデータ分析の手順
SPSSによる分散分析と多重比較の手順
SPSSでやさしく学ぶ統計解析
など多数
SPSSとAmosによる心理・調査データ解析――因子分析・共分散構造分析まで
http://shakaichousa.net/mua/
実践形式で学ぶSPSSとAmosによる心理・調査データ解析
http://www.tokyo-tosho.co.jp/books/ISBN4-489-00675-6.html
成蹊大新村氏 サンプルデータ
http://sun.econ.seikei.ac.jp/~shinmura/archive.html
Indiana University のデータ群(ページの下のほう)
http://www.indiana.edu/~statmath/stat/all/cfa/index.html
PR
#dat <- Orange
for(i in 1:ncol(dat)) {
x <- paste(colnames(dat)[i], " <- c(", paste( dat[,i], collapse=","), ")", sep="")
print(x)
}
# あまり美しくない出力
xs <- vector()
#dat <- Orange
for(i in 1:ncol(dat)) {
x <- paste(" <- c(", paste( dat[,i], collapse=","), ")", sep="")
xs[i] <- x
}
names(xs) <- colnames(dat)
xd <- data.frame(xs)
print(xd, right=F)
##
# 足立浩平 (2006). 多変量データ解析法――心理・教育・社会系のための入門―― ナカニシヤ出版
# 表2.1 p16
mat <- matrix(c(3.2,3.4,3,3.2,4.2,4,4,3.7,3.6,3.6,3.7,3.4,3.2,3.2,2.7,3.5,3.2,3.2,4.6,4,4.8,4.6,4.3,3.6,3.2,3.7,3.2,3.8,3.7,3.4,3.5,3.5,4.5,3.8,3.9,4.1,3.7,3.5,3.7,3.5,3.6,3.8,2.8,2.5,2.2,2.6,3.1,3.4,3.5,3.4,2.9,3.5,3.9,3.1,2.9,2.8,2.6,2.2,2.1,2.5,3,3.2,3.8,4,3.5,4.2,4.7,2.7,2.2,2.3,2.6,2.6,2.2,2.6,3.2,3.1,3.7,4.1,3.6,4.2,4.7,2.4,2.5,2.4,2.2,3.2,3.3,3.6,2.8,2.4,3.2,4.3,4.7,3.5,4.9,2.3,3.3,3.9,1.4,2.1,3.4,2.9,3.3,1.5,2.1,3.4,4.2,3.5,3.5,1.8,3.3,2.5,1.7,3.6,4.1,4.2,4.1,1.6,2.6,3.5,4.1,3.7,4.2,2.3,3.4,4.7,3.3,4.1,3.4,3.2,4.5,3.7,3.7,4.2,3.9,3.5,3.7,3.3,2.8,3.9,3.8,4.7,1.3,1.5,2.3,3.9,3.6,4.4,3.7,2.5,2.8,2.9,1.8,2.3,1.8,4.2,4.3,4,4.9,3,4.5,4,5,3.5,4.1,3.3,4.3,4.3),
nr=14,
dimnames=list(c("僧侶", "銀行員", "漫画家", "デザイナー", "保母", "大学教授", "医師", "警察官", "新聞記者", "船乗り", "プロスポーツ選手", "作家", "俳優", "スチュワーデス"),
c("立派な", "役立つ", "よい", "大きい", "力がある", "強い", "速い", "騒がしい", "若い", "誠実な", "かたい", "忙しい"))
)
# 表 3.1 p22
ppt <- c(88,52,77,35,60,97,48,66,78)
wrt <- c(70,78,87,40,43,95,62,66,50)
int <- c(65,88,89,43,40,91,83,65,48)
dat <- data.frame(ppt, wrt, int)
mean(dat)
# 表 3.2 p28
ppt <- c(77,60,97,35,66,48,78,52,88)
wrt <- c(18,8,20,8,14,12,10,16,14)
int <- c(45,20,45,22,32,41,24,44,32)
dat <- data.frame(ppt, wrt, int)
mean(dat)
# 表8-1 p76
se <- c(9,2,5,4,6,4,6,6,7,4,5,6,7,4,3,5,4,7,5,5,6,4,3,7,4,5,3,4,6,5,4,3,5,5,2,4,7,5,6,5,3,5,6,5,5,2,5,5,7,6,6,6,7,7,4,7,7,6,6,4,4,6,4,2,5,4,4,5,6,4,6,6,6,5,6,4,7,8,8,4,4,5,6,8,4,5,4,3,4,5,3,3,6,4,5,4,3,4,5,4)
yo <- c(7,3,6,6,5,5,7,6,6,4,6,4,5,5,6,6,5,6,7,5,7,6,6,7,6,6,5,6,5,6,3,3,5,6,5,6,7,7,5,5,4,7,4,7,7,5,9,5,6,5,6,6,6,6,4,6,5,6,5,4,6,4,5,6,6,5,6,4,6,6,5,7,5,6,6,4,5,6,5,5,6,6,6,6,6,7,4,5,6,6,5,3,6,5,7,4,7,7,4,5)
sa <- c(9,5,7,6,7,5,6,7,8,6,6,6,8,6,5,7,8,8,7,7,7,6,5,8,7,5,4,6,9,8,7,6,6,7,5,7,9,5,7,4,6,7,7,5,9,4,6,7,8,6,7,8,8,7,6,8,8,6,7,7,6,5,6,5,6,4,6,7,7,5,7,8,8,6,8,5,7,9,8,3,5,7,7,6,6,7,5,6,6,7,6,6,8,5,6,6,6,5,5,7)
bu <- c(2,8,6,3,6,5,5,4,5,8,4,5,5,7,6,3,4,4,4,5,4,4,7,5,6,4,6,5,5,5,7,9,7,5,5,7,5,3,4,7,9,6,7,4,3,7,4,8,5,7,3,4,4,5,8,3,6,3,6,6,5,7,6,5,6,7,4,6,4,7,5,5,5,6,5,6,6,6,4,6,6,6,6,7,6,4,9,6,5,6,7,7,5,6,4,7,4,6,9,7)
ha <- c(9,1,8,8,6,6,8,8,6,4,6,5,5,5,4,9,8,6,9,4,8,5,4,7,5,8,5,5,8,6,4,3,5,4,5,5,6,8,7,5,4,6,5,9,8,3,9,4,7,4,6,8,8,7,2,7,7,6,5,4,6,4,6,5,7,5,7,6,7,5,5,7,6,6,6,5,5,6,6,5,5,5,4,6,6,8,2,4,6,5,5,3,5,6,6,3,7,7,4,3)
ya <- c(8,3,4,5,5,3,3,7,5,3,4,6,6,4,2,5,5,6,5,4,6,3,3,8,4,5,4,4,6,6,5,4,6,4,3,5,8,5,6,3,3,4,5,6,7,4,4,5,7,6,5,8,6,6,3,8,6,4,5,5,5,3,4,2,6,3,4,8,4,4,6,7,6,2,6,4,7,8,9,3,4,4,4,8,5,6,2,3,4,4,4,3,7,4,6,5,3,3,5,5)
ch <- c(3,7,6,7,6,5,6,6,3,6,5,4,7,7,6,7,5,4,4,6,6,7,8,5,5,4,6,7,5,6,5,7,6,8,6,6,3,5,2,8,6,6,5,5,3,6,4,3,2,5,6,3,4,5,7,2,2,3,3,5,9,5,7,9,5,7,6,4,5,6,4,4,2,8,3,5,3,1,2,6,6,6,3,2,6,5,8,7,9,6,9,7,3,8,3,6,7,7,6,4)
ni <- c(8,3,6,7,6,5,8,7,4,3,7,6,6,5,5,7,6,6,7,8,6,5,2,6,6,7,5,5,6,6,5,3,5,8,5,5,5,5,7,4,4,7,4,6,7,5,8,5,6,4,7,9,7,7,3,7,6,4,7,4,6,4,5,5,6,5,6,4,8,6,6,7,5,5,6,3,6,7,7,5,5,5,5,7,6,9,4,4,6,6,5,4,7,5,5,5,5,4,7,3)
dat <- data.frame(se, yo, sa, bu, ha, ya, ch, ni)
# 表15.1 p150
grp <- rep(c("a", "b"), c(15, 12))
sha <- c(15,11,16,19,18,15,17,12,13,14,16,11,20,15,13,11,10,11,10,10,13,11,15,12,10,12,10)
kyo <- c(14,13,14,21,26,28,19,15,22,26,20,15,21,20,13,15,13,14,10,14,19,10,20,22,11,10,14)
kin <- c(15,17,17,18,21,18,12,18,16,18,18,20,17,19,17,18,16,24,13,22,23,20,20,23,18,19,21)
shi <- c(14,17,26,15,15,12,10,12,10,6,18,15,20,12,16,17,9,16,12,18,24,28,16,13,10,27,19)
dat <- data.frame(grp, sha, kyo, kin, shi)
# 表15.4 p153
grp <- factor(c(1,1,1,1,2,2,2,3,3,3,3,4,4,4,4,4,5,5,5,5))
sak <- c(9,6,6,4,7,1,4,5,5,3,6,8,4,10,5,5,4,5,1,6)
ens <- c(8,8,6,8,10,9,9,4,5,5,5,6,6,5,6,3,6,4,4,4)
tmp <- c(2,5,4,8,5,9,7,9,10,8,7,4,7,6,6,8,3,2,1,4)
mss <- c(6,7,8,8,6,7,5,6,7,5,5,4,4,3,3,5,5,6,5,4)
arg <- c(10,6,5,7,4,7,6,0,7,3,5,5,1,10,2,3,7,5,3,6)
org <- c(7,9,5,6,3,4,6,8,5,5,6,6,5,6,4,5,6,9,7,10)
dat <- data.frame(grp, sak, ens, tmp, mss, arg, org)
吉田寿夫・森 敏昭 (1990). 心理学のためのデータ解析テクニカルブック 北大路書房
# 1要因対応のなし。p. 87
dat <- data.frame(
a = factor(rep(c("a1","a2","a3","a4"),each=8)),
result = c(9,7,8,8,12,11,8,13, 6,5,6,3,6,7,10,9, 10,13,8,13,12,14,14,16, 9,11,13,14,16,12,15,14)
)
dat
# 1要因対応のあり。p. 92
dat <- data.frame(
a1=c(9,7,8,8,12,11,8,13),
a2=c(6,5,6,3,6,7,10,9),
a3=c(10,13,8,13,12,14,14,16),
a4=c(9,11,13,14,16,12,15,14)
)
dat
# 2要因参加者間。p95
dat <- data.frame(
a=factor(rep(c("a1", "a2"), each=20)),
b=factor(rep(c("b1","b2", "b3","b4"), each=5, time=2)),
result = c(3,3,1,3,5, 4,3,4,5,7, 6,6,6,4,8, 5,7,8,7,9, 3,5,2,4,6, 2,6,3,6,4, 3,2,3,6,5, 2,3,3,4,6))
dat
# 2要因混合p. 107
dat <- data.frame(
a=factor(rep(c("a1", "a2"), each=5)),
b1=c(3, 3, 1, 3, 5, 3, 5, 2, 4, 6),
b2=c(4, 3, 4, 5, 7, 2, 6, 3, 6, 4),
b3=c(6, 6, 6, 4, 8, 3, 2, 3, 6, 5),
b4=c(5, 7, 8, 7, 9, 2, 3, 3, 4, 6)
)
dat
# 2要因対応あり。p117
dat <- data.frame(
a1b1=c(3, 3, 1, 3, 5),
a1b2=c(4, 3, 4, 5, 7),
a1b3=c(6, 6, 6, 4, 8),
a1b4=c(5, 7, 8, 7, 9),
a2b1=c(3, 5, 2, 4, 6),
a2b2=c(2, 6, 3, 6, 4),
a2b3=c(3, 2, 3, 6, 5),
a2b4=c(2, 3, 3, 4, 6)
)
dat
# 3要因対応なし p121
dat <- data.frame(
a = rep(c("a1", "a2"), each=24),
b = rep(c("b1", "b2", "b1", "b2"), each=12),
c = rep(c("c1", "c2", "c3", "c1", "c2", "c3","c1", "c2", "c3", "c1", "c2", "c3"), each=4),
val = c(2,6,5,7, 5,7,9,9, 9,10,13,14, 6,6,8,10, 3,6,5,8, 6,7,5,6,
1,2,5,2, 2,1,4,5, 1, 5, 3, 5, 5,3,4, 6, 5,6,6,7, 5,5,9,7)
)
dat
# 3要因混合 (1要因対応あり) p137
dat <- data.frame(
a = rep(c("a1", "a2"), each=8),
b = rep(c("b1", "b2", "b1", "b2"), each=4),
c1 = c(2,6,5,7,6,6,8,10,1,2,5,2,5,3,4,6),
c2 = c(5,7,9,9,3,6,5,8,2,1,4,5,5,6,6,7),
c3 = c(9,10,13,14,6,7,5,6,1,5,3,5,5,5,9,7)
)
# 3要因混合 (2要因対応あり) 。p144
dat <- data.frame(
a=factor(c(rep("a1", 4), rep("a2", 4))),
b1c1=c(2,6,5,7,1,2,5,2), b1c2=c(5,7,9,9,2,1,4,5), b1c3=c(9,10,13,14,1,5,3,5),
b2c1=c(6,6,8,10,5,3,4,6), b2c2=c(3,6,5,8,5,6,6,7), b2c3=c(6,7,5,6,5,5,9,7)
)
dat
# 3要因被験者内 p152
dat <- data.frame(
a1b1c1 = c(2,6,5,7),
a1b1c2 = c(5,7,9,9),
a1b1c3 = c(9,10,13,14),
a1b2c1 = c(6,6,8,10),
a1b2c2 = c(3,6,5,8),
a1b2c3 = c(6,7,5,6),
a2b1c1 = c(1,2,5,2),
a2b1c2 = c(2,1,4,5),
a2b1c3 = c(1,5,3,5),
a2b2c1 = c(5,3,4,6),
a2b2c2 = c(5,6,6,7),
a2b2c2 = c(5,5,9,7)
)
##南風原朝和 (2002). 心理統計学の基礎――統合的理解のために―― 有斐閣
## p. 9 表1-1、逸脱行動と変化量データ。
sex <- factor(rep(c("male", "female"), each=20))
sixth <- c(4,9,14,16,15,14,7,13,18,20,12,6,10,16,12,16,13,12,12,15,3,9,4,8,8,5,5,7,12,11,8,11,13,10,15,10,12,10,8,9)
eighth <- c(8,12,11,20,16,18,7,19,20,14,14,12,16,14,13,17,19,10,19,14,12,9,10,13,13,10,7,18,17,14,12,18,17,20,13,16,13,12,12,13)
cng <- c(4,3,-3,4,1,4,0,6,2,-6,2,6,6,-2,1,1,6,-2,7,-1,9,0,6,5,5,5,2,11,5,3,4,7,4,10,-2,6,1,2,4,4)
dat <- data.frame(sex, sixth, eighth, cng)
dat
# p226 。表8-1。50組の母子の協調性データ。
x1 <- c(12,12,7,17,14,9,10,13,15,12,12,15,11,14,17,17,16,15,15,10,12,9,12,12,19,11,14,15,15,15,16,15,12,10,11,12,15,13,15,12,12,12,13,17,13,11,14,16,12,12) # 母親価値
x2 <- c(2,2,2,3,2,2,3,3,3,1,3,3,2,2,4,2,4,3,4,2,2,1,2,2,4,2,3,2,3,3,2,3,2,2,3,1,2,3,2,2,2,3,3,3,2,3,2,4,2,2) # 通園年数
y <- c(6,11,11,13,13,10,10,15,11,11,16,14,10,13,12,15,16,14,14,8,13,12,12,11,16,9,12,13,13,14,12,15,8,12,11,6,12,15,9,13,9,11,14,12,13,9,11,14,16,8) # 協調性
dat <- data.frame(x1,x2, y)
dat
# p271 表9-1、ねたみ感情の測定データ
dat <- data.frame(
dmn = factor(rep(c("app", "acd", "aff"), each=15)),
att = factor(rep(rep(c("fr", "mid","hst"), each=5), 3)),
envy = c(2,4,3,2,1,7,4,6,5,8,4,3,2,5,2,2,2,1,2,2,3,4,2,1,2,1,3,3,2,1,3,1,1,0,1,4,7,5,6,4,3,2,1,2,1)
)
dat
# 表9-6 ブロック別の妬み感情データ
blc <- factor(1:15)
app <- c(1,2,2,2,2,3,3,4,4,4,5,5,6,7,8)
acd <- c(1,1,1,1,2,2,2,2,2,2,2,3,3,3,4)
aff <- c(0,1,1,1,1,1,2,2,3,3,4,4,5,6,7)
dat <- data.frame(blc,app,acd,aff)
# 縦長
blc <- rep(blc, 3)
fct <- factor(rep(c("app", "acd", "aff"),each=15))
val <- c(app, acd, aff)
dat <- data.frame(blc, fct, val)
# p312. 表9-8、共分散分析のためのデータ
dmn <- factor(rep(c("app", "acd", "aff"), each=15)) # 優越属性
cv <- c(4,9,6,2,1,14,10,13,11,15,8,7,3,12,5,6,10,2,8,5,13,15,9,4,7,1,12,14,11,3,9,4,2,1,6,12,15,13,14,11,10,7,5,8,3) # 共変量
envy <- c(2,4,3,2,1,7,4,6,5,8,4,3,2,5,2,2,2,1,2,2,3,4,2,1,2,1,3,3,2,1,3,1,1,0,1,4,7,5,6,4,3,2,1,2,1) # ねたみ感情
dat <- data.frame(dmn, cv, envy)
## http://www.psychology.emory.edu/clinical/mcdowell/PSYCH560/factorw.htm
dat <- data.frame(
ps=paste("p", 1:27, sep=""),
trt=gl(3, 9, labels=c("a1", "a2", "a3")), # "notreat", "spaced", "massed"
grp=rep(gl(3, 3, labels=c("b1", "b2", "b3")),3), #"washers", "checkers", "seekers"
value=c(5,4,5,4,5,3,3,5,4,5,6,3,4,6,3,12,10,13,10,12,16,11,10,12,13,12,10)
)
dat
# p318 相関行列
mat <- matrix(c(
1.000,0.033,0.315,0.456,0.266,0.607,0.228,0.419,
0.033,1.000,0.637,0.250,0.528,0.195,0.522,0.420,
0.315,0.637,1.000,0.333,0.880,0.237,0.750,0.328,
0.456,0.250,0.333,1.000,0.362,0.432,0.398,0.449,
0.266,0.528,0.880,0.362,1.000,0.252,0.738,0.269,
0.607,0.195,0.237,0.432,0.252,1.000,0.335,0.463,
0.228,0.522,0.750,0.398,0.738,0.335,1.000,0.238,
0.419,0.420,0.328,0.449,0.269,0.463,0.238,1.000),
nrow=8, dimnames=list(c("onw", "yok", "gai", "sin", "sha", "kyo", "sek", "sun"), c("onw", "yok", "gai", "sin", "sha", "kyo", "sek", "sun"))
)
# 表10-8 観測変数間の相関係数 p354
mat <- matrix(c(
1.000,0.160,0.302,0.461,0.299,0.152,0.134,0.182,0.251,0.372,0.157,0.203,
0.160,1.000,0.341,0.400,0.404,0.320,0.403,0.374,0.285,0.100,0.291,-0.014,
0.302,0.341,1.000,0.372,0.552,0.476,0.467,0.572,0.316,0.408,0.393,0.369,
0.461,0.400,0.372,1.000,0.302,0.225,0.256,0.255,0.164,0.236,0.229,0.224,
0.299,0.404,0.552,0.302,1.000,0.708,0.623,0.776,0.361,0.294,0.472,0.342,
0.152,0.320,0.476,0.225,0.708,1.000,0.324,0.769,0.295,0.206,0.351,0.202,
0.134,0.403,0.467,0.256,0.623,0.324,1.000,0.724,0.260,0.071,0.204,0.152,
0.182,0.374,0.572,0.255,0.776,0.769,0.724,1.000,0.284,0.142,0.320,0.189,
0.251,0.285,0.316,0.164,0.361,0.295,0.260,0.284,1.000,0.295,0.290,0.418,
0.372,0.100,0.408,0.236,0.294,0.206,0.071,0.142,0.295,1.000,0.468,0.351,
0.157,0.291,0.393,0.229,0.472,0.351,0.204,0.320,0.290,0.468,1.000,0.385,
0.203,-0.014,0.369,0.224,0.342,0.202,0.152,0.189,0.418,0.351,0.385,1.000),
nr=12,
dimnames = list(paste("y", 1:12, sep=""), paste("y", 1:12, sep=""))
)
mat
## 媒介分析。http://davidakenny.net/dtt/mediate.htm
library(foreign)
dat <- data.frame(read.spss("http://davidakenny.net/dtt/morse_et_al.sav"))
dat
## 信頼区間グラフ
## Masson, M. E. J., & Loftus, G. R. (2003). Using confidence intervals for graphically based data interpretation. Canadian Journal of Experimental Psychology, 57, 203-220.
# http://web.uvic.ca/psyc/masson/ML.pdf
dat <- data.frame(
incong=c(784,853,622,954,634,751,918,894),
cong=c(632,702,598,873,600,729,877,801),
neutral=c(651,689,606,855,595,740,893,822))
dat
# 1要因対応のなし。p. 87
dat <- data.frame(
a = factor(rep(c("a1","a2","a3","a4"),each=8)),
result = c(9,7,8,8,12,11,8,13, 6,5,6,3,6,7,10,9, 10,13,8,13,12,14,14,16, 9,11,13,14,16,12,15,14)
)
dat
# 1要因対応のあり。p. 92
dat <- data.frame(
a1=c(9,7,8,8,12,11,8,13),
a2=c(6,5,6,3,6,7,10,9),
a3=c(10,13,8,13,12,14,14,16),
a4=c(9,11,13,14,16,12,15,14)
)
dat
# 2要因参加者間。p95
dat <- data.frame(
a=factor(rep(c("a1", "a2"), each=20)),
b=factor(rep(c("b1","b2", "b3","b4"), each=5, time=2)),
result = c(3,3,1,3,5, 4,3,4,5,7, 6,6,6,4,8, 5,7,8,7,9, 3,5,2,4,6, 2,6,3,6,4, 3,2,3,6,5, 2,3,3,4,6))
dat
# 2要因混合p. 107
dat <- data.frame(
a=factor(rep(c("a1", "a2"), each=5)),
b1=c(3, 3, 1, 3, 5, 3, 5, 2, 4, 6),
b2=c(4, 3, 4, 5, 7, 2, 6, 3, 6, 4),
b3=c(6, 6, 6, 4, 8, 3, 2, 3, 6, 5),
b4=c(5, 7, 8, 7, 9, 2, 3, 3, 4, 6)
)
dat
# 2要因対応あり。p117
dat <- data.frame(
a1b1=c(3, 3, 1, 3, 5),
a1b2=c(4, 3, 4, 5, 7),
a1b3=c(6, 6, 6, 4, 8),
a1b4=c(5, 7, 8, 7, 9),
a2b1=c(3, 5, 2, 4, 6),
a2b2=c(2, 6, 3, 6, 4),
a2b3=c(3, 2, 3, 6, 5),
a2b4=c(2, 3, 3, 4, 6)
)
dat
# 3要因対応なし p121
dat <- data.frame(
a = rep(c("a1", "a2"), each=24),
b = rep(c("b1", "b2", "b1", "b2"), each=12),
c = rep(c("c1", "c2", "c3", "c1", "c2", "c3","c1", "c2", "c3", "c1", "c2", "c3"), each=4),
val = c(2,6,5,7, 5,7,9,9, 9,10,13,14, 6,6,8,10, 3,6,5,8, 6,7,5,6,
1,2,5,2, 2,1,4,5, 1, 5, 3, 5, 5,3,4, 6, 5,6,6,7, 5,5,9,7)
)
dat
# 3要因混合 (1要因対応あり) p137
dat <- data.frame(
a = rep(c("a1", "a2"), each=8),
b = rep(c("b1", "b2", "b1", "b2"), each=4),
c1 = c(2,6,5,7,6,6,8,10,1,2,5,2,5,3,4,6),
c2 = c(5,7,9,9,3,6,5,8,2,1,4,5,5,6,6,7),
c3 = c(9,10,13,14,6,7,5,6,1,5,3,5,5,5,9,7)
)
# 3要因混合 (2要因対応あり) 。p144
dat <- data.frame(
a=factor(c(rep("a1", 4), rep("a2", 4))),
b1c1=c(2,6,5,7,1,2,5,2), b1c2=c(5,7,9,9,2,1,4,5), b1c3=c(9,10,13,14,1,5,3,5),
b2c1=c(6,6,8,10,5,3,4,6), b2c2=c(3,6,5,8,5,6,6,7), b2c3=c(6,7,5,6,5,5,9,7)
)
dat
# 3要因被験者内 p152
dat <- data.frame(
a1b1c1 = c(2,6,5,7),
a1b1c2 = c(5,7,9,9),
a1b1c3 = c(9,10,13,14),
a1b2c1 = c(6,6,8,10),
a1b2c2 = c(3,6,5,8),
a1b2c3 = c(6,7,5,6),
a2b1c1 = c(1,2,5,2),
a2b1c2 = c(2,1,4,5),
a2b1c3 = c(1,5,3,5),
a2b2c1 = c(5,3,4,6),
a2b2c2 = c(5,6,6,7),
a2b2c2 = c(5,5,9,7)
)
##南風原朝和 (2002). 心理統計学の基礎――統合的理解のために―― 有斐閣
## p. 9 表1-1、逸脱行動と変化量データ。
sex <- factor(rep(c("male", "female"), each=20))
sixth <- c(4,9,14,16,15,14,7,13,18,20,12,6,10,16,12,16,13,12,12,15,3,9,4,8,8,5,5,7,12,11,8,11,13,10,15,10,12,10,8,9)
eighth <- c(8,12,11,20,16,18,7,19,20,14,14,12,16,14,13,17,19,10,19,14,12,9,10,13,13,10,7,18,17,14,12,18,17,20,13,16,13,12,12,13)
cng <- c(4,3,-3,4,1,4,0,6,2,-6,2,6,6,-2,1,1,6,-2,7,-1,9,0,6,5,5,5,2,11,5,3,4,7,4,10,-2,6,1,2,4,4)
dat <- data.frame(sex, sixth, eighth, cng)
dat
# p226 。表8-1。50組の母子の協調性データ。
x1 <- c(12,12,7,17,14,9,10,13,15,12,12,15,11,14,17,17,16,15,15,10,12,9,12,12,19,11,14,15,15,15,16,15,12,10,11,12,15,13,15,12,12,12,13,17,13,11,14,16,12,12) # 母親価値
x2 <- c(2,2,2,3,2,2,3,3,3,1,3,3,2,2,4,2,4,3,4,2,2,1,2,2,4,2,3,2,3,3,2,3,2,2,3,1,2,3,2,2,2,3,3,3,2,3,2,4,2,2) # 通園年数
y <- c(6,11,11,13,13,10,10,15,11,11,16,14,10,13,12,15,16,14,14,8,13,12,12,11,16,9,12,13,13,14,12,15,8,12,11,6,12,15,9,13,9,11,14,12,13,9,11,14,16,8) # 協調性
dat <- data.frame(x1,x2, y)
dat
# p271 表9-1、ねたみ感情の測定データ
dat <- data.frame(
dmn = factor(rep(c("app", "acd", "aff"), each=15)),
att = factor(rep(rep(c("fr", "mid","hst"), each=5), 3)),
envy = c(2,4,3,2,1,7,4,6,5,8,4,3,2,5,2,2,2,1,2,2,3,4,2,1,2,1,3,3,2,1,3,1,1,0,1,4,7,5,6,4,3,2,1,2,1)
)
dat
# 表9-6 ブロック別の妬み感情データ
blc <- factor(1:15)
app <- c(1,2,2,2,2,3,3,4,4,4,5,5,6,7,8)
acd <- c(1,1,1,1,2,2,2,2,2,2,2,3,3,3,4)
aff <- c(0,1,1,1,1,1,2,2,3,3,4,4,5,6,7)
dat <- data.frame(blc,app,acd,aff)
# 縦長
blc <- rep(blc, 3)
fct <- factor(rep(c("app", "acd", "aff"),each=15))
val <- c(app, acd, aff)
dat <- data.frame(blc, fct, val)
# p312. 表9-8、共分散分析のためのデータ
dmn <- factor(rep(c("app", "acd", "aff"), each=15)) # 優越属性
cv <- c(4,9,6,2,1,14,10,13,11,15,8,7,3,12,5,6,10,2,8,5,13,15,9,4,7,1,12,14,11,3,9,4,2,1,6,12,15,13,14,11,10,7,5,8,3) # 共変量
envy <- c(2,4,3,2,1,7,4,6,5,8,4,3,2,5,2,2,2,1,2,2,3,4,2,1,2,1,3,3,2,1,3,1,1,0,1,4,7,5,6,4,3,2,1,2,1) # ねたみ感情
dat <- data.frame(dmn, cv, envy)
## http://www.psychology.emory.edu/clinical/mcdowell/PSYCH560/factorw.htm
dat <- data.frame(
ps=paste("p", 1:27, sep=""),
trt=gl(3, 9, labels=c("a1", "a2", "a3")), # "notreat", "spaced", "massed"
grp=rep(gl(3, 3, labels=c("b1", "b2", "b3")),3), #"washers", "checkers", "seekers"
value=c(5,4,5,4,5,3,3,5,4,5,6,3,4,6,3,12,10,13,10,12,16,11,10,12,13,12,10)
)
dat
# p318 相関行列
mat <- matrix(c(
1.000,0.033,0.315,0.456,0.266,0.607,0.228,0.419,
0.033,1.000,0.637,0.250,0.528,0.195,0.522,0.420,
0.315,0.637,1.000,0.333,0.880,0.237,0.750,0.328,
0.456,0.250,0.333,1.000,0.362,0.432,0.398,0.449,
0.266,0.528,0.880,0.362,1.000,0.252,0.738,0.269,
0.607,0.195,0.237,0.432,0.252,1.000,0.335,0.463,
0.228,0.522,0.750,0.398,0.738,0.335,1.000,0.238,
0.419,0.420,0.328,0.449,0.269,0.463,0.238,1.000),
nrow=8, dimnames=list(c("onw", "yok", "gai", "sin", "sha", "kyo", "sek", "sun"), c("onw", "yok", "gai", "sin", "sha", "kyo", "sek", "sun"))
)
# 表10-8 観測変数間の相関係数 p354
mat <- matrix(c(
1.000,0.160,0.302,0.461,0.299,0.152,0.134,0.182,0.251,0.372,0.157,0.203,
0.160,1.000,0.341,0.400,0.404,0.320,0.403,0.374,0.285,0.100,0.291,-0.014,
0.302,0.341,1.000,0.372,0.552,0.476,0.467,0.572,0.316,0.408,0.393,0.369,
0.461,0.400,0.372,1.000,0.302,0.225,0.256,0.255,0.164,0.236,0.229,0.224,
0.299,0.404,0.552,0.302,1.000,0.708,0.623,0.776,0.361,0.294,0.472,0.342,
0.152,0.320,0.476,0.225,0.708,1.000,0.324,0.769,0.295,0.206,0.351,0.202,
0.134,0.403,0.467,0.256,0.623,0.324,1.000,0.724,0.260,0.071,0.204,0.152,
0.182,0.374,0.572,0.255,0.776,0.769,0.724,1.000,0.284,0.142,0.320,0.189,
0.251,0.285,0.316,0.164,0.361,0.295,0.260,0.284,1.000,0.295,0.290,0.418,
0.372,0.100,0.408,0.236,0.294,0.206,0.071,0.142,0.295,1.000,0.468,0.351,
0.157,0.291,0.393,0.229,0.472,0.351,0.204,0.320,0.290,0.468,1.000,0.385,
0.203,-0.014,0.369,0.224,0.342,0.202,0.152,0.189,0.418,0.351,0.385,1.000),
nr=12,
dimnames = list(paste("y", 1:12, sep=""), paste("y", 1:12, sep=""))
)
mat
## 媒介分析。http://davidakenny.net/dtt/mediate.htm
library(foreign)
dat <- data.frame(read.spss("http://davidakenny.net/dtt/morse_et_al.sav"))
dat
## 信頼区間グラフ
## Masson, M. E. J., & Loftus, G. R. (2003). Using confidence intervals for graphically based data interpretation. Canadian Journal of Experimental Psychology, 57, 203-220.
# http://web.uvic.ca/psyc/masson/ML.pdf
dat <- data.frame(
incong=c(784,853,622,954,634,751,918,894),
cong=c(632,702,598,873,600,729,877,801),
neutral=c(651,689,606,855,595,740,893,822))
dat
options(repos="http://cran.md.tsukuba.ac.jp")
install.packages("aspace") # 三角関数
install.packages("BiplotGUI") # バイプロット
install.packages("ca") # 対応分析
install.packages("car") # 分散分析と回帰分析
install.packages("ctv") # CRAN Task View
install.packages("doBy") # カテゴリ別集計
install.packages("foreign") # ファイル読み書き
install.packages("FactoMineR") # 探索的解析いろいろ
install.packages("GPArotation") # 因子分析の回転
install.packages("Hmisc") # カテゴリカルデータ解析 (?)
install.packages("homals") # 等質性分析
install.packages("lavaan") # 構造方程式モデル、潜在変数解析
install.packages("lme4") # マルチレベルモデル
install.packages("MASS") # 相関の生成とか
install.packages("mvnormtest") # 多変量正規分布とか
install.packages("multilevel") # 媒介分析
install.packages("nlme") # マルチレベルモデル
install.packages("polychor") # ポリコリック相関
install.packages("psych") # 因子分析他心理学の解析
install.packages("psychometric")# 心理計量
install.packages("pwr") # 検定力
install.packages("Rcmdr") # Rコマンダー
install.packages("reshape2") # データ整形
install.packages("rgl") # 3Dプロット
install.packages("sem") # 構造方程式モデリング
install.packages("vcd") # カテゴリカルデータ解析
# 読み込まれているパッケージ
search()
# インストールされているパッケージ
library()
# 有用なパッケージをまとめてインストール (CRAN Task View)
library(ctv)
install.views("Psychometrics")
install.views("SocialSciences")
install.views("Multivariate")
# パッケージの更新
options(repos="http://cran.md.tsukuba.ac.jp")
update.packages(ask=F)
# ヘルプ表示法の変更
options(help_type = "text") # テキスト
options(help_type = "html") # html
# Rソースコードの読み込み
# C:\Program Files\R\R-2.12.0\etc の Rprofile.site を書き換える
source("C:/Documents/all.R") # など
install.packages("aspace") # 三角関数
install.packages("BiplotGUI") # バイプロット
install.packages("ca") # 対応分析
install.packages("car") # 分散分析と回帰分析
install.packages("ctv") # CRAN Task View
install.packages("doBy") # カテゴリ別集計
install.packages("foreign") # ファイル読み書き
install.packages("FactoMineR") # 探索的解析いろいろ
install.packages("GPArotation") # 因子分析の回転
install.packages("Hmisc") # カテゴリカルデータ解析 (?)
install.packages("homals") # 等質性分析
install.packages("lavaan") # 構造方程式モデル、潜在変数解析
install.packages("lme4") # マルチレベルモデル
install.packages("MASS") # 相関の生成とか
install.packages("mvnormtest") # 多変量正規分布とか
install.packages("multilevel") # 媒介分析
install.packages("nlme") # マルチレベルモデル
install.packages("polychor") # ポリコリック相関
install.packages("psych") # 因子分析他心理学の解析
install.packages("psychometric")# 心理計量
install.packages("pwr") # 検定力
install.packages("Rcmdr") # Rコマンダー
install.packages("reshape2") # データ整形
install.packages("rgl") # 3Dプロット
install.packages("sem") # 構造方程式モデリング
install.packages("vcd") # カテゴリカルデータ解析
# 読み込まれているパッケージ
search()
# インストールされているパッケージ
library()
# 有用なパッケージをまとめてインストール (CRAN Task View)
library(ctv)
install.views("Psychometrics")
install.views("SocialSciences")
install.views("Multivariate")
# パッケージの更新
options(repos="http://cran.md.tsukuba.ac.jp")
update.packages(ask=F)
# ヘルプ表示法の変更
options(help_type = "text") # テキスト
options(help_type = "html") # html
# Rソースコードの読み込み
# C:\Program Files\R\R-2.12.0\etc の Rprofile.site を書き換える
source("C:/Documents/all.R") # など