[[Rのメモ]]

Stefan Th. Gries (2010) Statistics for Linguistics with R (de Gruyter) の授業メモです。投野と金田君で適宜メモっています。

**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 describes
 the "proportion of total variation attributable to the factor,
 partialling out (excluding) other factors from the total nonerror variation"
 (Pierce, Block & Aguinis, 2004, p. 918). Partial eta squared is often higher than eta squared.

 Cohen (1992) suggests effect sizes for various indexes, including &#402;
 (where 0.1 is a small effect, 0.25 is a medium effect and 0.4 is a large effect).
 He also offers a conversion table (see Cohen, 1988, p. 283) for eta squared (η2) where 0.0099
 constitutes a small effect, 0.0588 a medium effect and 0.1379 a large effect. Though, considering that  
 η2 are comparable to r2 when df of the numerator equals 1 (both measures proportion of variance  
 accounted for), these guidelines may overestimate the size of the effect. If going by the r guidelines  
 (0.1 is a small effect, 0.3 a medium effect and 0.5 a large effect) then the equivalent guidelines for eta-
 squared would be the squareroot of these, i.e. 01 is a small effect, 0.09 a medium effect and 0.25 a 
 large effect, and these should also be applicable to eta-squared. When the df of the numerator exceeds 
 1, eta-squared is comparable to R-squared (Levine & Hullett, 2002).

-p.24: ''Occam's razor'' (or Ockham's razor), often expressed in Latin as the '''lex parsimoniae''', translating to ''law of parsimony'', ''law of economy'' or ''law of succinctness'', is a principle that generally recommends selecting the competing hypothesis that makes the fewest new assumptions, when the hypotheses are equal in other respects. For instance, they must both sufficiently explain available data in the first place. --Wikipedia

-p.34: the probability p to lose 60 times or moer just by chance is 0.02844397, 2.8%
--計算は以下のようにしているはず:

 > 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="gray")     #塗りつぶし
 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="gray")

◆ 2項分布グラフ
 plot(dbinom(1:100, 100, 0.5), type="s", xlab="100回コインを投げて表の出る回数 (回)", ylab="確率(%)")	#2項分布グラフを描く
 xvals = seq(58, 100, length=43)	#x座標を準備
 dvals = dbinom(xvals, 100, 0.5)	#x座標に対応する、2項分布のy座標を準備
 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]), col="orange", border="NA")	 #1マスずつ長方形に塗りつぶしていく
 j = j+1					#Rでは[ 変数++ ]が動かないので注意だ!(笑)
 }


**質問・コメント [#re54ec56]
- 2項分布の裾野を塗りつぶすための別解を載せてみました。 -- [[kanetaku]] &new{2011-04-20 (水) 23:00:40};

#comment


トップ   新規 一覧 単語検索 最終更新   ヘルプ   最終更新のRSS