SLWRMemo
をテンプレートにして作成
[
トップ
] [
新規
|
一覧
|
単語検索
|
最終更新
|
ヘルプ
]
開始行:
[[Rのメモ]]
Stefan Th. Gries (2010) Statistics for Linguistics with R...
**Chapter 3 [#je208ec0]
-主な関数
--table() :例)table(FILLER)
--prop.table() : 指定したカラムの因子を集計し相対頻度(%...
--cumsum(): ベクトルを1つ1つ足して累積頻度を出す 例:c...
-plot()
--plot(a): a の値を y 、ベクトルの数値の出現順を x にとっ...
--plot(a, b): a と b のバイプロット
--引数 type=b (both の意味):点と線でグラフを描画
--引数 type=l (line) :点はなし。線のみ
--引数 xlab=" ", ylab=" ": 軸の名前をつける
--引数 main=" ":全体のタイトルをつける
--引数 xlim, ylim:軸の数値の範囲を指定
-grid(): 全体に表中に薄いグリッド線を描く
-pie()
-barplot()
-text()
-pareto.chart() : library "qcc" より「パレート図」といわ...
-hist()
1.2 Measures of central tendency
-which.max()
-max()
-median()
-mean()
-geometric mean: 幾何学的平均、相乗平均ともいう
--http://www.kwansei.ac.jp/hs/z90010/sugakuc/toukei/daihy...
1.3 Measures of dispersion
-relative entropy: mode に対して与える dispersion measure
--2つの確率分布の差の尺度、Kullback–Leibler diverg...
-interquartile range/ quartiles: median に対して使う disp...
-standard deviation/ variance / quartiles: 平均値のとれる...
**Chapter 1 [#x707dde3]
-p.5: Table 1 をカイ2乗検定してみる:
> TenseAspect <-matrix(c(12,7,19,6,13,19,18,20,38),3,3)
> TenseAspect
[,1] [,2] [,3]
[1,] 12 6 18
[2,] 7 13 20
[3,] 19 19 38
> chisq.test(TenseAspect)
Pearson's Chi-squared test
data: TenseAspect
X-squared = 3.8, df = 4, p-value = 0.4337
-p.7: Partial eta-squared とは Effect size の種類の1つ、...
Partial η2 (Partial eta-squared): Partial eta-squared de...
the "proportion of total variation attributable to the f...
partialling out (excluding) other factors from the total...
(Pierce, Block & Aguinis, 2004, p. 918). Partial eta squ...
Cohen (1992) suggests effect sizes for various indexes, ...
(where 0.1 is a small effect, 0.25 is a medium effect an...
He also offers a conversion table (see Cohen, 1988, p. 2...
constitutes a small effect, 0.0588 a medium effect and 0...
η2 are comparable to r2 when df of the numerator equals ...
accounted for), these guidelines may overestimate the si...
(0.1 is a small effect, 0.3 a medium effect and 0.5 a la...
squared would be the squareroot of these, i.e. 01 is a s...
large effect, and these should also be applicable to eta...
1, eta-squared is comparable to R-squared (Levine & Hull...
-p.24: ''Occam's razor'' (or Ockham's razor), often expre...
-p.34: the probability p to lose 60 times or moer just by...
--計算は以下のようにしているはず:
> 1-pbinom(40,100,0.5,lower.tail=FALSE)
[1] 0.02844397
-p.45: Figure 11 の図に近いものを作る
> curve(dnorm(x,mean=0,sd=1),from=-4,to=4)
> abline(v=qnorm(0.05, lower.tail=TRUE))
> abline(v=qnorm(0.95, lower.tail=TRUE))
◆ Figure 11 -別解
par(mfrow=c(1,2)) #画面分割
plot(dnorm, -4, 4, type="l", xlab="x", ylab="y") #...
xvals <- seq(-4, -2, length=10) #塗りつぶし範囲を...
dvals <- dnorm(xvals) #x軸に対応するy軸座標を入力
polygon(c(xvals,rev(xvals)), c(rep(0,10),rev(dvals)),col...
plot(dnorm, -4, 4, type="l", xlab="x", ylab="y") #...
xvals <- seq(2, 4, length=10) #右側の裾野を塗りつ...
dvals <- dnorm(xvals)
polygon(c(xvals,rev(xvals)), c(rep(0,10),rev(dvals)),col...
◆ 2項分布グラフ
plot(dbinom(1:100, 100, 0.5), type="s", xlab="100回コイ...
xvals = seq(58, 100, length=43) #x座標を準備
dvals = dbinom(xvals, 100, 0.5) #x座標に対応する、2項分...
j = 1 #ループを作成の下準備
for (i in xvals) {
y = dvals[j] #xに対応するy座標を準備する。
polygon(c(i, i+1, i+1, i), c(0, 0, dvals[j], dvals[j]), ...
j = j+1 #Rでは[ 変数++ ]が動かないので注意だ!(笑)
}
-token set:
--研究デザインの用語ではあまり聞いたことがない。プログラ...
--Schematic token set: 変数の名称による変数間の分類整理
--Concrete token set: その変数を具体的な刺激(stimuli)に...
◆ Figure 28. (p. 110)のレシピ
UHM <- read.table(file="c:/_sflwr/_inputfiles/03-1_uh(m)...
female <- mean(subset(UHM, SEX=="female")$LENGTH) #力技...
male <- mean(subset(UHM, SEX=="male")$LENGTH) #もう少し...
silence <- mean(subset(UHM, FILLER=="silence")$LENGTH) #...
uh <- mean(subset(UHM, FILLER=="uh")$LENGTH)
uhm <- mean(subset(UHM, FILLER=="uhm")$LENGTH)
dialog <- mean(subset(UHM, GENRE=="dialog")$LENGTH)
monolog <- mean(subset(UHM, GENRE=="monolog")$LENGTH)
figure <- c(female, male, silence, uh, uhm, dialog, mono...
plot(figure, xaxt="n", xlim=c(0.5, 7.5), ylim=c(840, 960...
#細かい数値はFigure28に近づけるため。なくても描けます。t...
label <- c("female", "male", "silence", "uh", "uhm", "di...
text(c(1:7), figure, as.character(label)) #labelで用意し...
#蛇足ながらこのあたりがエレガントでないと思う所以
average <- mean(UHM$LENGTH) #線は全体の平均で引くので、...
abline(h=average) #横線を引きます
grid() #グリッドを引きます。本ではなぜかX軸を粗めに取っ...
**質問・コメント [#re54ec56]
- 2項分布の裾野を塗りつぶすための別解を載せてみました。 -...
- Figure 28 は出せるかい? -- [[tono]] &new{2011-05-23 (...
- Figure28出してみました。あまりエレガントなやり方ではな...
- いつの間にか2人で更新するというメッセージが(笑)!他の...
- よく見たらグリッドが入っていたのでこちらも入れてみまし...
終了行:
[[Rのメモ]]
Stefan Th. Gries (2010) Statistics for Linguistics with R...
**Chapter 3 [#je208ec0]
-主な関数
--table() :例)table(FILLER)
--prop.table() : 指定したカラムの因子を集計し相対頻度(%...
--cumsum(): ベクトルを1つ1つ足して累積頻度を出す 例:c...
-plot()
--plot(a): a の値を y 、ベクトルの数値の出現順を x にとっ...
--plot(a, b): a と b のバイプロット
--引数 type=b (both の意味):点と線でグラフを描画
--引数 type=l (line) :点はなし。線のみ
--引数 xlab=" ", ylab=" ": 軸の名前をつける
--引数 main=" ":全体のタイトルをつける
--引数 xlim, ylim:軸の数値の範囲を指定
-grid(): 全体に表中に薄いグリッド線を描く
-pie()
-barplot()
-text()
-pareto.chart() : library "qcc" より「パレート図」といわ...
-hist()
1.2 Measures of central tendency
-which.max()
-max()
-median()
-mean()
-geometric mean: 幾何学的平均、相乗平均ともいう
--http://www.kwansei.ac.jp/hs/z90010/sugakuc/toukei/daihy...
1.3 Measures of dispersion
-relative entropy: mode に対して与える dispersion measure
--2つの確率分布の差の尺度、Kullback–Leibler diverg...
-interquartile range/ quartiles: median に対して使う disp...
-standard deviation/ variance / quartiles: 平均値のとれる...
**Chapter 1 [#x707dde3]
-p.5: Table 1 をカイ2乗検定してみる:
> TenseAspect <-matrix(c(12,7,19,6,13,19,18,20,38),3,3)
> TenseAspect
[,1] [,2] [,3]
[1,] 12 6 18
[2,] 7 13 20
[3,] 19 19 38
> chisq.test(TenseAspect)
Pearson's Chi-squared test
data: TenseAspect
X-squared = 3.8, df = 4, p-value = 0.4337
-p.7: Partial eta-squared とは Effect size の種類の1つ、...
Partial η2 (Partial eta-squared): Partial eta-squared de...
the "proportion of total variation attributable to the f...
partialling out (excluding) other factors from the total...
(Pierce, Block & Aguinis, 2004, p. 918). Partial eta squ...
Cohen (1992) suggests effect sizes for various indexes, ...
(where 0.1 is a small effect, 0.25 is a medium effect an...
He also offers a conversion table (see Cohen, 1988, p. 2...
constitutes a small effect, 0.0588 a medium effect and 0...
η2 are comparable to r2 when df of the numerator equals ...
accounted for), these guidelines may overestimate the si...
(0.1 is a small effect, 0.3 a medium effect and 0.5 a la...
squared would be the squareroot of these, i.e. 01 is a s...
large effect, and these should also be applicable to eta...
1, eta-squared is comparable to R-squared (Levine & Hull...
-p.24: ''Occam's razor'' (or Ockham's razor), often expre...
-p.34: the probability p to lose 60 times or moer just by...
--計算は以下のようにしているはず:
> 1-pbinom(40,100,0.5,lower.tail=FALSE)
[1] 0.02844397
-p.45: Figure 11 の図に近いものを作る
> curve(dnorm(x,mean=0,sd=1),from=-4,to=4)
> abline(v=qnorm(0.05, lower.tail=TRUE))
> abline(v=qnorm(0.95, lower.tail=TRUE))
◆ Figure 11 -別解
par(mfrow=c(1,2)) #画面分割
plot(dnorm, -4, 4, type="l", xlab="x", ylab="y") #...
xvals <- seq(-4, -2, length=10) #塗りつぶし範囲を...
dvals <- dnorm(xvals) #x軸に対応するy軸座標を入力
polygon(c(xvals,rev(xvals)), c(rep(0,10),rev(dvals)),col...
plot(dnorm, -4, 4, type="l", xlab="x", ylab="y") #...
xvals <- seq(2, 4, length=10) #右側の裾野を塗りつ...
dvals <- dnorm(xvals)
polygon(c(xvals,rev(xvals)), c(rep(0,10),rev(dvals)),col...
◆ 2項分布グラフ
plot(dbinom(1:100, 100, 0.5), type="s", xlab="100回コイ...
xvals = seq(58, 100, length=43) #x座標を準備
dvals = dbinom(xvals, 100, 0.5) #x座標に対応する、2項分...
j = 1 #ループを作成の下準備
for (i in xvals) {
y = dvals[j] #xに対応するy座標を準備する。
polygon(c(i, i+1, i+1, i), c(0, 0, dvals[j], dvals[j]), ...
j = j+1 #Rでは[ 変数++ ]が動かないので注意だ!(笑)
}
-token set:
--研究デザインの用語ではあまり聞いたことがない。プログラ...
--Schematic token set: 変数の名称による変数間の分類整理
--Concrete token set: その変数を具体的な刺激(stimuli)に...
◆ Figure 28. (p. 110)のレシピ
UHM <- read.table(file="c:/_sflwr/_inputfiles/03-1_uh(m)...
female <- mean(subset(UHM, SEX=="female")$LENGTH) #力技...
male <- mean(subset(UHM, SEX=="male")$LENGTH) #もう少し...
silence <- mean(subset(UHM, FILLER=="silence")$LENGTH) #...
uh <- mean(subset(UHM, FILLER=="uh")$LENGTH)
uhm <- mean(subset(UHM, FILLER=="uhm")$LENGTH)
dialog <- mean(subset(UHM, GENRE=="dialog")$LENGTH)
monolog <- mean(subset(UHM, GENRE=="monolog")$LENGTH)
figure <- c(female, male, silence, uh, uhm, dialog, mono...
plot(figure, xaxt="n", xlim=c(0.5, 7.5), ylim=c(840, 960...
#細かい数値はFigure28に近づけるため。なくても描けます。t...
label <- c("female", "male", "silence", "uh", "uhm", "di...
text(c(1:7), figure, as.character(label)) #labelで用意し...
#蛇足ながらこのあたりがエレガントでないと思う所以
average <- mean(UHM$LENGTH) #線は全体の平均で引くので、...
abline(h=average) #横線を引きます
grid() #グリッドを引きます。本ではなぜかX軸を粗めに取っ...
**質問・コメント [#re54ec56]
- 2項分布の裾野を塗りつぶすための別解を載せてみました。 -...
- Figure 28 は出せるかい? -- [[tono]] &new{2011-05-23 (...
- Figure28出してみました。あまりエレガントなやり方ではな...
- いつの間にか2人で更新するというメッセージが(笑)!他の...
- よく見たらグリッドが入っていたのでこちらも入れてみまし...
ページ名: