2020/9/21

R Programming Language - Run R Script

To run R script, install RStudio.

Add a new R script file and save it as a *.R file.


The code in the new script file can be:

a = 1

b = 2

a+b

When executing the script file, move the cursor to the first line of the script.

Press the run button, one line is run and the cursor is moved to the next line.

In the above example, press the run button three time for the three lines as below:



Related Information:

Installation and basic R commands

R programming language - load and save data

2020/9/3

R programming language - load and save data

This article explains the commands to load and save R data.

Firstly, declare data x:

    x = c(1,2,3,4,5,6)

Get the local path: getwd()

    path = getwd()

Change path:

    pathnew = file.path(path,"Desktop")

Set the local path: setwd()

    setwd(pathnew)

Save

    filename = file.path(pathnew,"test.RData")

    save(x,file=filename)

Clear workplace

    rm(list=ls())

Load

    filename = file.path(getwd(),"test.RData")

    load(filename)

    > x

    [1] 1 2 3 4 5 6

Related Information:

How to save and run an R Script

Installation and basic R commands

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

2020/4/18

brain 腦

central nervous system (CNS) 中樞神經系統

cerebrum 大腦
cerebellum 小腦
brainstem/brain stem 腦幹
- midbrain 中腦
- pons 橋腦
- medulla oblongata 延腦

thalamus 視丘/丘腦


skull 頭顱/顱骨/頭骨/腦殼
scalp 頭皮
cortex 皮質

grey matter/gray matter 灰質
white matter 白質

cerebral cortex 大腦皮質

cerebral spinal fluid (CSF) 腦脊髓液

gyrus 回/腦回/腦迴
sulcus 溝
lobe 葉

frontal lobe 額葉
parietal 頂葉
occipital lobe 枕葉
temporal lobe 顳葉

central sulcus 中央溝


Cerebrum lobes.svg
By vectorized by Jkwchui - http://training.seer.cancer.gov/module_anatomy/unit5_3_nerve_org1_cns.htmlCC BY-SA 3.0Link

meninges 腦膜
meningeal veins 腦膜靜脈

1604 Types of Cortical Areas-02.jpg

Diagram from Wikipedia by OpenStax College - Anatomy & Physiology, Connexions Web site. http://cnx.org/content/col11496/1.6/, Jun 19, 2013., CC BY 3.0, Link


參考資訊

腦脊髓液(cerebral spinal fliud, CSF)
Specialized Instruments Brain Areas
Human Brain (Wikipedia)人腦(維基百科)
腦(小小整理網站)