2020/8/18

Installation and Basic R commands

The R Project for Statistical Computing software is available with multiple operating systems such as Windows, MacOS.

It may be downloaded here:

https://www.r-project.org

After installation, try declare values with '=' or '<-' and see the average result with 'mean' function.

> x<-c(1,2,3,4,5)

> mean(x)

[1] 3

> y<-c(2,3,4,5,6,7,8)

> mean(y)

[1] 5

> z=c(5,6,7)

> mean(z)

[1] 6

Result:

To remove the above warning messages, open terminal and type:

defaults write org.R-project.R force.LANG en_US.UTF-8

Reference:

[記宅] 在 Mac 上安裝 R 語言 (R Studio, R) 新手介紹

Related Information:

R programming language - load and save data

How to save and run an R Script

2020/8/1

Hypothesis Testing 假設檢定名詞

hypothesis testing 假設檢定/假說檢定

null hypothesis 虛無假設 H0
alternative hypothesis 對立假設 H1/Ha

analysis ovariances (ANOVA) 變異數分析

E.g. 3 groups with one-way ANOVA
H0: μ1 = μ2 = μ3
H1: μ1 ≠ μ2 ≠ μ3

ANOVA的重點,是求F值:

F =MST/MSE = Mean Square Treatment/Mean Square Error

再和Critical Value CV=f(df1,df2)比較,CV可查f分佈表求得,當F值大於CV時,則拒絕H0

F值表示組間變異(variability between groups)較組內變異(variability within groups)多F倍,因此當F值越大,機率上組間的差異就越大,所以當F值增加至大於CV值時,組間有顯著異。

當F > CV時,組間有顯著差異,但不知道差異是在哪些組之間,因此需要事後檢定(post hoc test)

接著求p value,即在
可針對不同的α值查表求fα(df1,df2),例如f0.05(df1,df2)和f0.01(df1,df2)等數值,即可粗略地得知p值所落在的範圍


p value:
<0 ---="" .05="" br=""><0 ---="" .01="" br=""><0 ---="" .001="" br="">
<0 ---="" .05="" br=""><0 ---="" .01="" br=""><0 ---="" .001="" br="">p<0.05 ---  *     statistically significant
<0 ---="" .05="" br=""><0 ---="" .01="" br=""><0 ---="" .001="" br="">p<0.01 ---  **    statistically highly significant
<0 ---="" .05="" br=""><0 ---="" .01="" br=""><0 ---="" .001="" br="">p<0.001 --- *** statistically extremely significant
<0 ---="" .05="" br=""><0 ---="" .01="" br=""><0 ---="" .001="" br="">
test statistic 檢定統計量

significance level / level of significance 顯著水準 (通常α = 0.05)
- H0發生的機率、拒絕H0的機率、Type I error的機率(不太可能發生)

References

顯著水準 - 基礎統計名詞介紹網頁
Statistical significance (Wikipedia)
Foundations of ANOVA – Assumptions and Hypotheses for One-Way ANOVA (12-3) (Research By Design YouTube)
Mathematical statistics with applications in R, Ramachandran & Tsokos, 2nd edition (2015), p501,

Finding the P-value in One-Way ANOVA (YouTube)

p值的迷思:顯著與非常顯著 研究生2.0