statistical computing 00

Post on 20-Mar-2017

76 Views

Category:

Science

2 Downloads

Preview:

Click to see full reader

TRANSCRIPT

統計軟體實作與應用Statistical Computing

徐峻賢中央研究院語言學研究所大腦與語言實驗室

a brief introduction of myself

• neurolinguistic studies of word recognition

• a database of Mandarin Chinese characters/words

• human perception in detecting F0 changes

• nonlinearity of brain waves and speech sounds

Cognitive Psychology

Neuroscience

Linguistics Machine Learning

Core Abilitie

s

a brief introduction of myself

Computation Skills

1. Scripting in MATLAB, R, Python, UNIX, C.2. Human Event-Related Potential (ERP) recording and analyses using Scan.3. Source analysis and time-frequency analyses of EEG/MEG data using MNE

toolbox and Freesurfer.4. EEG/MEG data analyses using fieldtrip toolbox5. Conducting psychological experiments using Psychophysics Toolbox6. Analyze/synthesize spoken sounds using Praat and STRAIGHT toolbox.7. Machine Learning: GLM, SVM, & deep learning8. Text Mining: LSA & word2vector

a brief introduction of myself

課程目標• 將統計理論應用於資料分析。比如:

• 機率 >> 產生模擬數據• 推論統計 >> 假設檢定 (Null Hypothesis

Significant test)

• 使用計算工具執行分析• R & SPSS

• 不太可靠的大綱 ... ( 依據大家掌握 computing 的狀況做調整 )

• 機率 ( 隨機抽樣、中央極限定理 )

• 描述統計 ( 類別量尺、連續量尺 )

• 推論統計 (ttest, ANOVA, regression, chi-square)

• The number of analytics jobs available for R and SPSS across time

• source: Muenchen @ http://r4stats.com/articles/popularity/

• The number of analytics jobs for the more popular software (2/2014).

• source: Muenchen @ http://r4stats.com/articles/popularity/

• 不太可靠的大綱之 bonus hours:

• basics of machine learning

• word to vector

A BCount 15251 15251

Average 100 100Standard Deviation 20 20

Median 100.35 100.9210 Percentile 73.89 73.95

90 Percentile 125.61 124.72

Descriptive statistics for two synthetic data sets

Prediction of time reference rating

There is an early and automatic semantic stimulus analysis which might be related to preference formation.

• Text Mining: word frequency• http://tidytextmining.com/sentiment.html

• Text Mining: sentiment analysis• http://tidytextmining.com/sentiment.html

• Pestian et al. (2011): Suicide Note Classification Using Natural Language Processing: A Content Analysis

• Data: Sixty-six notes were divided into two groups: 33 completers and 33 elicitors.

• 抓取首頁新聞,分為 time,title,catagory,url 儲存• source: https://www.jerrynest.com/big-data-workshop-r-crawler/

library(rvest)surl = "http://www.appledaily.com.tw/realtimenews/section/new/"apple = read_html(surl,encoding="UTF-8")apple %>% iconv(from = 'UTF-8', to = 'UTF-8')rddt = apple %>% html_nodes('.rtddt')time = rddt %>% html_nodes('time') %>% html_text()title = rddt %>% html_nodes('h1') %>% html_text() %>% iconv(from = 'UTF-8', to = 'UTF-8')category = rddt %>% html_nodes('h2') %>% html_text() %>% iconv(from = 'UTF-8', to = 'UTF-8')domain = "http://www.appledaily.com.tw"url = rddt %>% html_nodes('a') %>% html_attr('href')url = paste0(domain, url) news = data.frame(time=time, title=title, category=category, url=url)

news = data.frame(time=time, title=title, category=category, url=url)

R 統計軟體發展歷史• R 統計軟體最初是由 Ross Ihaka 及 Robert

Gentleman 兩人以統計分析及繪圖為目的,仿 S 語言的架構為基礎而發展出來的統計軟體,可視為改進版本的 S 語言。大部分的 S語言程式碼可直接或稍做修改後就在 R 上面執行• R 屬於 GNU 計畫中的一個項目,目前是由

R Development Core Team 維護及發展• 目前 R 最新的版本為 3.1.1 版

(2014.07.10)

=wizard

“R” 使用者就像巫師,他們使用統計學家研發的咒語,或者自行開發的指令。 R 使用者不用付錢請統計學家工作,而且累積足夠的經驗之後,使用者會釋放無限的力量,改變統計分析的環境 ( 就像鄧布利多那樣 ) 。

R 的特色及功能• 有效的資料處理及存取能力• 方便的矩陣操作與運算能力• 簡單且發展完善的程式語言環境 (S 語言 )

– open source, 開放原始碼• 活躍的咨詢社群• 強迫使用者理解統計分析的步驟• 免費

R 的缺點• 圖形化界面較簡單 ( 相較於 SPSS, Excel…)• 需要較長的學習時間• 沒有公司 / 企業支援 ( 不能客訴 ) ,使用者必須自行克服問題 ( 容易有挫折感 )• 常常在不知不覺中犯錯

– 要反覆檢查指令、輸出結果• help 訊息幫助不大

• R 的主要操作界面• 兩種視窗 :

– Document (scripts) – Console

最後,確認程式無誤並且存入語法檔,將來可以使用

• R 程式 IDE (Integrated development environment) 編輯器 : RStudio

• 回家作業:

• 安裝 R主程式 以及 Rstudio (Desktop Free version)

• 瀏覽一下 R 相關資源:• R bloggers• RPubs• 吳漢銘教授的教學資源:

• http://www.hmwu.idv.tw/index.php/r-software

學習目標• 初學者:

• 讀入外部資料,直接使用別人寫好的packages/functions

• 讀入外部資料作資料處理 /轉換 /彙整• 入門:

• 讀入外部資料,並作資料處理 /轉換,再使用現有的packages/functions 計算

• 修改他人所寫的 packages/functions ,以適用於自己的資料分析任務• 大師:

• 依照自己的特殊需求寫出全新的程式

如何使用計算工具?• 和撰寫論文一樣:

– 研究動機與文獻探討• 從 R 社群找過去的 Q&A; 尋找可用的 package

– 方法• 演算程序 (e.g., 公式、參數、 ANOVA)

– 材料• 讀取外部資料、自製模擬資料

– 程序• 轉換資料、各種想像不到的細節…

– 結果與結論

top related