文章分類提示:
- 問題: 當你想要問問題時,請使用這個類別
[問題類型]:
經驗諮詢(我覺得我的t檢定是不是出問題了...)
[軟體熟悉度]:
使用者(已經有用R 做過不少作品)
[問題敘述]:
目前在處理一份問卷分析,受試者目前依性別分為兩個Group(兩組人數不同),
題目作答類型為五點計分,其中有兩題的t檢定跑出來的結果t值都是-2.0,但
是兩個p值差很多,一個有顯著,另一個則沒有,還有它df的算法我也不太懂...
[程式範例]:
======================================================================
第八題的兩組作答資料為:
> gb8
[1] 4 3 2 2 4 3 4 3 3 2 3 4 2 1 4 2 3 4 2 3 1 2 3 3 4 3 2 2 2 3 2 2 3 3 2 2 1 3 4 4 3 3 4 3 4 3 3 2 3 4 3 3 2 4 4 4 3 3 3 4 2 4 3 2 2 2 3 2 3
[70] 3 3 2 3 3 3 4 2 3 4 3 4 3 3 3 3 3 3 2 3 3 4 3 3 3 4 2 3 2 4 2 3 3 3 4 4 4 3 2 3 3 3 3 3 2 3 3 3 3 3 3 3 3 2 3 3 3 1 4 2 3 3 3 3 3 3 2 2 3
[139] 4 2 2 3 2 1 2 3 2 3 2 4 2 2 3 3 2 3 3 3 4 2 4 1 3 3 3 1 3 3 3 3 2 3 2 3 3 4 3 3 4 3 3 3 3 4 3 2 3 3 3 3 2 4 3 3 3 3 3 3 2 3 3 3 3 2 2 3 4
[208] 3 3 2 2 2 1 1 4 2 3 4 2 3 2 3 4 3 2 3 3 4 3 2 3 3 3 4 2 2 3 2 3 3 3 4 4 3 3 3 3 1 2 3 3 3 3 4 4 3 3 3 3 3 3 3 4 2 3 3 3 4 3 2 3 3 3 3 3 3
[277] 3 2 3 3 3 3 3 3 3 3 4 2 2 3 3 4 3 3 3 3 4 3 3 2 4 3 2 2 2 3 3 4 3 4 3 2 1 1 3 3 3 1 3 3 3 3 2 3 3 3 2 3 4 4 4 4 3 3 4 4 3 2 1 3 3 4 3 3 3
[346] 3 3 3 3 2 4 4 3 3 3 4 3 3 3 3 3 2 3 3 1 3 3 3 3 3 3 3 3 2 2 3 4 3 2 3 4 3 3 3 2 3 3 3 3 3 3 3 3 2 3 4 3 4 2 4 4 3 2 3 3 3 3 2 3 2 2 4 2 3
[415] 3 4 4 4 3 3 3 3 3 2 4 3 4 3 3 3 4 4 4 3 3 3 2 3 3 3 2
> sb8
[1] 3 2 2 3 3 3 3 3 3 3 3 3 2 3 4 3 4 2 3 3 4 4 2 3 4 3 3 3 2 2 2 3 3 4 2 4 3 3 3 3 3 2 3 4 3 3 4 4 4 3 3 3 2 3 4 3 3 4 3 4 3 4 3 2 3 3 3 3 3
[70] 3 3 2 3 3 3 2 3 3 3 4 3 3 3
t檢定的結果為(兩組變異數有顯著差異)
> t.test(gb8,sb8,var.equal = FALSE)
Welch Two Sample t-test
data: gb8 and sb8
t = -2, df = 100, p-value = 0.1
alternative hypothesis: true difference in means is not equal to 0
95 percent confidence interval:
-0.2691 0.0259
sample estimates:
mean of x mean of y
2.90 3.02
=========================================================================
第9題的兩組資料為
> gb9
[1] 4 3 2 2 3 3 4 3 3 2 3 4 2 1 3 2 4 4 2 3 2 3 3 3 3 2 3 2 2 3 2 3 3 3 2 1 1 3 3 4 3 3 3 3 4 3 3 2 3 3 3 3 3 4 3 4 3 3 3 2 2 4 3 2 2 2 2 4 2
[70] 3 3 2 3 2 3 4 2 3 3 3 4 3 3 3 3 3 3 2 3 3 4 3 3 3 4 2 3 2 3 3 3 3 2 4 4 4 2 3 3 3 3 3 3 2 3 3 3 3 3 3 3 3 3 2 3 3 1 4 2 3 3 3 3 3 3 2 2 3
[139] 4 2 2 3 2 2 2 2 3 4 3 4 2 2 3 3 2 3 3 3 4 2 4 1 3 2 2 2 3 3 3 2 2 3 2 3 3 4 3 3 4 3 3 3 3 4 4 2 3 3 3 3 2 3 3 3 2 3 3 3 2 3 4 3 3 2 2 3 3
[208] 3 3 2 2 2 3 2 3 2 3 3 2 3 2 3 3 3 3 3 3 4 3 2 3 3 3 4 3 3 2 2 3 3 3 4 4 3 3 3 3 2 3 3 3 2 3 4 4 4 2 4 2 3 3 2 4 3 3 3 2 4 3 3 4 3 3 3 2 2
[277] 3 2 2 3 3 3 3 3 3 3 3 3 2 3 3 4 3 3 2 3 4 3 2 3 4 3 2 3 2 3 3 4 3 3 3 2 1 2 3 3 3 1 3 3 3 2 2 3 3 3 2 3 4 4 4 4 3 3 4 3 3 2 3 3 3 4 3 3 4
[346] 3 3 3 3 2 3 4 3 3 4 2 3 3 3 3 3 2 3 3 1 2 3 2 3 3 3 3 3 2 2 3 4 3 3 3 3 3 3 3 2 3 3 3 3 3 3 3 3 3 3 3 3 4 2 3 4 2 2 3 3 2 3 2 3 2 2 4 3 3
[415] 3 4 3 4 3 3 3 3 3 3 3 3 4 3 3 3 4 4 3 3 3 3 2 3 3 3 2
> sb9
[1] 3 2 3 2 3 3 3 3 4 3 2 3 3 3 4 3 4 2 3 3 4 4 2 3 3 3 4 3 2 3 3 3 3 4 3 4 3 3 3 3 3 3 3 4 3 3 4 3 2 3 3 3 2 2 4 3 3 4 3 4 3 4 2 2 3 3 3 3 3
[70] 3 3 3 3 3 3 2 3 3 3 4 3 3 3
t檢定結果為
> t.test(gb9,sb9,var.equal = FALSE)
Welch Two Sample t-test
data: gb9 and sb9
t = -2, df = 100, p-value = 0.02
alternative hypothesis: true difference in means is not equal to 0
95 percent confidence interval:
-0.3043 -0.0265
sample estimates:
mean of x mean of y
2.87 3.04
=======================================================================
想請問一下,我該如何解釋這樣的結果,一般狀況下p值不是由t值和df值推出來的嗎?
另,那個df=100又是如何算出來的呢?
[環境敘述]:
R version 3.2.0 (2015-04-16)
Platform: x86_64-apple-darwin13.4.0 (64-bit)
Running under: OS X 10.9.5 (Mavericks)
locale:
[1] zh_TW.UTF-8/zh_TW.UTF-8/zh_TW.UTF-8/C/zh_TW.UTF-8/zh_TW.UTF-8
attached base packages:
[1] stats graphics grDevices utils datasets methods base
other attached packages:
[1] epicalc_2.15.1.0 nnet_7.3-9 MASS_7.3-40 survival_2.38-1 foreign_0.8-63 gplots_2.16.0 plyr_1.8.2 reshape2_1.4.1
[9] xlsx_0.5.7 xlsxjars_0.6.1 rJava_0.9-6 ggplot2_1.0.1 questionr_0.4.3
loaded via a namespace (and not attached):
[1] Rcpp_0.11.5 highr_0.5 bitops_1.0-6 class_7.3-12 tools_3.2.0 digest_0.6.8 gtable_0.1.2
[8] shiny_0.11.1 proto_0.3-10 e1071_1.6-4 stringr_0.6.2 gtools_3.4.2 caTools_1.17.1 classInt_0.1-22
[15] grid_3.2.0 R6_2.0.1 RJSONIO_1.3-0 gdata_2.16.1 scales_0.2.4 htmltools_0.2.6 splines_3.2.0
[22] mime_0.3 xtable_1.7-4 colorspace_1.2-6 httpuv_1.3.2 KernSmooth_2.23-14 munsell_0.4.2
>
[關鍵字]: t-test
選擇性,也許未來有用