• 沒有找到結果。

精準醫學數據研究

N/A
N/A
Protected

Academic year: 2022

Share "精準醫學數據研究"

Copied!
169
0
0

加載中.... (立即查看全文)

全文

(1)

精準醫學數據研究

馮已榕

ijfeng@g-mail.nsysu.edu.tw

(2)

2020 生醫形象影片-未來的我們(中文版)

https://www.youtube.com/watch?v=Yz2lheXkuxM&feature=youtu.be

(3)

Decision Making

• How many decisions does an adult make per day? 35’000/day

• How many food-related decisions does an adult make per day? 226.7/day Brian Wansink, Mindless Eating: The 200 Daily Food Decisions We Overlook, 2007

• How many medical decisions does an doctor make per day? 158/day Jeffrey R. Darst MD, Deciding without Data, 2010

(4)

Decision Making

• How many decisions does an adult make per day? 35’000/day

• How many food-related decisions does an adult make per day? 226.7/day Brian Wansink, Mindless Eating: The 200 Daily Food Decisions We Overlook, 2007

• How many medical decisions does an doctor make per day? 158/day Jeffrey R. Darst MD, Deciding without Data, 2010

(5)

Decision Making

• How many decisions does an adult make per day? 35’000/day

• How many food-related decisions does an adult make per day? 226.7/day Brian Wansink, Mindless Eating: The 200 Daily Food Decisions We Overlook, 2007

• How many medical decisions does an doctor make per day? 158/day Jeffrey R. Darst MD, Deciding without Data, 2010

(6)

Medical Decision Making

• How many decisions does an adult make per day? 35’000/day

• How many food-related decisions does an adult make per day? 226.7/day Brian Wansink, Mindless Eating: The 200 Daily Food Decisions We Overlook, 2007

• How many medical decisions does an doctor make per day? pediatric cardiologists 158/day

Jeffrey R. Darst MD, Deciding without Data, 2010

(7)

什麼是醫學(medicine)?

Predict Disgnose Treat Monitor

(8)

Predict Disgnose Treat Monitor

如何預防?

危險因子 保護因子

(9)

Predict Disgnose Treat Monitor

如何診斷?

• 症狀

• 身體檢查 {性別、年齡、身高、體 重、心跳、血壓…}

• 病史

• 家族史

• 病理中心檢驗數據 {血液常規檢查 (白血球、紅血球、血色素…)、生化 檢查(糖化血色素、膽固醇…)、血清 學檢查…}

• 醫療影像{x-ray 、CT 、MRI…}

(10)

如何診斷?

• 症狀 - 腹部疼痛,有時甚至會感到胸 部或右肩胛骨疼痛,無論如何改變姿 勢都無法減輕疼痛。

• 身體檢查 – 大於40歲 女性

肥胖者(BMI>30)

• 病史

• 家族史-有膽結石家族

• 病理中心檢驗數據

• 醫療影像 - 腹部X光檢查、電腦斷層掃 描或腹部超音波

膽結石

“年度前廿大疾病衛教:認識膽結石”

https://802.mnd.gov.tw/ListP0003102.ShowItemListState.do?StateEvent=InitEvent&QueryRecord.ArticleId=2016-09-

02%2009:55:01#:~:text=%E7%94%B1%E6%96%BC%E8%82%A5%E8%83%96%E6%98%AF%E8%86%BD%E7%B5%90%E7%9F%B3,%E6%96%BC%E9%

A0%90%E9%98%B2%E8%86%BD%E7%B5%90%E7%9F%B3%E5%BD%A2%E6%88%90%E3%80%82

(11)

如何診斷?

• 症狀 -尿多、口渴、飢餓、疲勞、視力模糊、體重減輕或

傷口不易癒合

吃多、喝多、尿多 + 體重減少 (三多㇐少)

• 身體檢查- 40歲以上? 肥胖?

• 病史

• 家族史- ?

• 病理中心檢驗數據 –

1. 隨機血漿糖值(無論空腹與否的任意時間測得的血糖 值)≧200(單位:mg/dl, 毫克/分公升)

2. 空腹8小時後血糖 ≧126 mg/dl。

3. 空腹口服75公克葡萄糖後測試(此檢查稱為葡萄糖耐 受試驗),在2小時的血糖值≧ 200 mg/dl。

4. 糖化血色素 (HbA1C) ≧6.5%。

• 醫療影像

第2型糖尿病

(12)

如何診斷?

• 症狀-

發燒(≧38℃)

急性呼吸道感染或嗅、味覺異常。

• 身體檢查

• 病史

• 家族史

• 病理中心檢驗數據 –

1.臨床檢體(如鼻咽或咽喉擦拭液、痰液或下呼吸 道抽取液等)分離並鑑定出新型冠狀病毒。

2.臨床檢體新型冠狀病毒分子生物學核酸檢測陽 性。

醫療影像

放射線診斷顯示有肺炎。

COVID-19

(武漢肺炎)

(13)

Predict Disgnose Treat Monitor

如何治療?

膽結石 膽囊切除手術

第2型糖尿病

糖尿病指的是人體內的胰臟不能製造足夠的胰島素,導致葡 萄糖無法充分進入細胞內,血糖濃度就會升高形成糖尿病。

財團法人蘭陽仁愛醫院– 糖尿病

胰島素/

降血糖藥物

COVID-19 呼吸器

(14)

Predict Disgnose Treat Monitor

如何追蹤?

• 症狀

• 身體檢查 {性別、年齡、身高、體重、心跳、血壓…}

• 病史

• 家族史

• 病理中心檢驗數據 {血液常規檢查(白血球、紅血球、血色素…)、生化檢查(糖化

血色素、膽固醇…)、血清學檢查…}

• 醫療影像{x-ray 、CT 、MRI…}

(15)

Medical Decision Making

哪㇐種膽固醇類藥物比其他藥物更能防範心臟病的發作呢?

診斷癌症最可靠的檢測方法是什麼?

減輕膝痛的最佳方式是什麼呢?

病患導向結果分析機構(Patient-centered outcomes research institute) 比較效果研究 (comparative effectiveness research) : 比較療法間「相對 健康影響、臨床效用及適用性」

(16)

傳統研究方式

(17)

Koch‘s postulates

描述疾病(通常是傳染病)與病原菌之間因果關係的條件

“菌群培養大師:1905年第五屆諾貝爾生理學醫學奬得主Robert Koch的研究工作回顧”

https://pansci.asia/archives/47780

德國醫師/生理學家Robert Koch。

Image courtesy of Nobelprize.org

1. 病體身上可以找到大量致病病原菌,而在健康活體上找不 到這些病原菌。

2. 這些病原菌可以從病體身上分離出,而且可以在適當的培 養基上生⾧。

3. 培養出的病原菌可以造成原本健康的活體患病。

4. 從這些因為接種了培養出的病原菌而患病的病體身上,可 以再次分離出和原先培養㇐樣的病原菌菌種。

(18)

test group control group With

outcome

Without outcome

With outcome

Without outcome

(19)

Sample

population Study

Sample Randomized allocation

Allocated to test group

Allocated to control

group

With outcome

Without outcome

With outcome

Without outcome

Randomized controlled trial

Starting Point TIME

“Study design VII. Randomised controlled trials”, Kate Ann Levin, 2007

(20)

“吃雞蛋”是否與”IQ”相關?

(21)

IQ>130 IQ ≤130 每星期吃三

顆以上雞蛋

每星期吃三 顆以下雞蛋

每星期吃三 顆以上雞蛋

每星期吃三 顆以下雞蛋

“吃雞蛋”是否與”IQ”相關?

(22)

“性別”是否與”膽結石”相關?

“年齡”是否與”膽結石”相關?

“肥胖”是否與”膽結石”相關?

“標靶藥物”是否與”癌症治癒”相關?

膽結石 膽結石

女生

男生

女生

男生

(23)

Multivariable thinking 多元思考

Ref: Developing Multivariable Thinking, Roxy Peck

(24)

Does Taking Your Time in College Pay Off?

-- 2016 AP Statistics Exam

“A newspaper in Germany reported that the more semesters need to complete an academic program at the university, the greater the starting salary in the first year of a job. The report was based on a study that used a random sample of 24 people who had recently completed an academic program. Information was collected on the number of semesters each person in the sample needed to complete the program and the starting salary, in thousands of euros, for the first year of a job.”

a. Does the scatterplot support the newspaper report about number of semesters and starting salary?

(25)

“An independent researcher received the data from the newspaper and conducted a new analysis by separating the data into three groups based on the major of each person. A revised scatterplot identifying the major of each person is shown below.”

c. Based on the people in the sample, describe the relationship between starting salary and number of semesters for the business majors.

e. Based on the analysis conducted by the independent researcher, how could the newspaper report be modified to give a better description of the relationship between the number of semesters and the starting salary for the people in the sample?

Multivariable thinking

(26)

Confounding Variables A Concern in Observational Studies

and Poorly Designed Experiments

(27)

Confounding Variables A Concern in Observational Studies and Poorly Designed Experiments

There is a strong positive relationship between number of televisions per

household and life expectancy for countries in the world.

(28)

新研究工具

(29)

2016年韓國棋王李世乭代表人類出戰Google DeepMind開發的AlphaGo

【纪录片】AlphaGo世紀對決 2017_剪接

(30)

2015 AlphaGo 5:0 歐洲圍棋冠軍 樊麾 二段

2016 AlphaGo 4:1 世界冠軍韓國 職業棋士李世乭 九段

1950

圖靈測試(Turing test) 判斷機器是否能夠思考的 實驗

Timeline of artificial intelligence

Artificial intelligence is the field of computer science that is associated with the concept of machines “think like humans” to perform tasks such as learning, problem-solving, planning, reasoning and identifying patterns.

(31)

人工智慧 :

計算機模仿人類思考進而模擬人類的能力 /行為。

許峰雄

生於台灣基隆

1980年畢業於臺灣大學電機系

1989年獲得美國卡內基美隆大學電腦科學博士學位

傳統規則式專家系統(rule-based expert system)

輸入了人類的200多萬局棋譜

計算出每一步棋後面的12步變化 最強的人類只能計算10步

專家系統是一個知識庫(Knowledge-based),設計 用來解決特定領域(Specific domain)的問題

深藍(Deep Blue) 專門分析西洋棋

(32)

分辨貓或是狗 專家系統 :

狗是汪汪叫,貓是喵喵叫 狗比較大隻,貓比較小隻

鼻子形狀 腳印

(33)

資料結構化:

身高 體重 性別 毛髮顏色 花紋有無 叫聲 鼻子形狀

飼養者每月平均花費 每年上動物醫院院次數 每年上動物美容院次數

特徵提取

(feature extraction) : 選入幫助模型進行 決策(提高分類/預 測準確度)的變項

機器學習 (Machine Learning)

經過資料觀察,特徵萃取,模型建立的過程得到可以歸納/學習出有用規則的模型

ID H W label

001 8 8 DOG

002 40 50 DOG :

999 9 8 CAT

(34)

深度學習 (Deep Learning)

(35)

電腦看到什麼 - 電腦視覺(Computer vision)

亞伯拉罕·林肯,第十六任美國總統 224 X 300 像素 (pixel)

12 X 17 像素 (pixel) 1個像素 (pixel)

(36)

Image recognition: Pixel → edge → texton → motif → part →object

(37)

英國蹲獵犬 (English Setter) 標準貴賓犬

(Standard Poodle) 波士頓㹴

(Boston Terrier) 迷你雪納瑞

(Miniature Schnauzer) 萬能㹴

(Airedale Terrier)

(38)

李宏毅 Hung-Yi Lee

(39)

深度學習 學到什麼 ?

(40)

李宏毅 Hung-Yi Lee

(41)

吉娃娃 OR 瑪芬

(42)

New tool + Big data  New finding

(43)

蘋果派

南瓜派 檸檬派 (ley lime pie)

胡桃派

櫻桃派

America's favorite pies

More data → New finding

(44)

斐斯托斯圓盤 Phaistos Disc

2.54 cm

5D optical data storage 360TB, 189 °C 保存138億年

More data → better finding ?

定位紀錄,心跳,心電圖 汽車防盜系統

(45)

王聖捷 Tricia Wang

• 知道智慧型手機的族群

• 不知道智慧型手機的族群

貴, 一摔就壞, 重

(46)

Know your data

know your question

(47)

SlimFast Shake 代餐奶昔 藜麥、紅藜

燕麥棒 蛋白棒

脫脂牛奶 鷹嘴豆泥

Ref: NYTimes.com

https://www.nytimes.com/interactive/2016/07/05/u pshot/is-sushi-healthy-what-about-granola-where- americans-and-nutritionists-

disagree.html#:~:text=No%20food%20elicited%20a%2 0greater,30%20percent%20of%20nutritionists%20did.

(48)

Ref: NYTimes.com

https://www.nytimes.com/interactive/2016/07/05/u pshot/is-sushi-healthy-what-about-granola-where- americans-and-nutritionists-

disagree.html#:~:text=No%20food%20elicited%20a%2 0greater,30%20percent%20of%20nutritionists%20did.

SlimFast Shake 代餐奶昔 藜麥、紅藜

燕麥棒 蛋白棒

脫脂牛奶 鷹嘴豆泥

Variables:

• Percentage o f nutritionists saying a food is healthy.

• Percentage o f all

Americans saying a food is healthy.

• Food

(49)

• What do you notice?

• What do you wonder?

• What kind of headline would you write for this graph?

Ref: NYTimes.com

https://www.nytimes.com/interactive/2016/07/05/upshot/is-sushi-healthy-what-about-granola- where-americans-and-nutritionists-

disagree.html#:~:text=No%20food%20elicited%20a%20greater,30%20percent%20of%20nutritionists

%20did.

(50)

SlimFast Shake 代餐奶昔: 4克脂肪,1克飽和脂肪,

30克碳水化合物,4克纖維,22克糖,10克蛋白質

(51)

從建立資料整理邏輯開始

打好精準醫學研究根基

(52)

Genome Sequencing and Big Data in Health Care Health Care Database and Data Standardization Health Industry Development

Drive progress

Precision Medicine 2030

(53)
(54)

DATA Model Result

John P. A. Ioannidis, PLoS Med. 2005 Aug

醫學假設 ✔ 實驗證實 ? 現實生活

Garbage In Garbage Out

?

(55)

http://remomd.com/technology/disruptions-in-health-healthcare-information-technology-in-a-limited-resource-community.html

就醫流程

掛號 候診

調閱病歷

看診

檢查(放射, 抽血檢驗) 住院

手術 繳錢

藥局領藥

離開

(56)

病歷號 住院日

(yyyy/mm/dd) 出生年月日

(yyyy/mm/dd) 診斷碼1 診斷碼2 診斷碼3 診斷碼4 1 1234567 2020/06/12 1960/05/01 高血壓 腦血管疾

心臟疾病 子宮頸惡

性腫瘤 2 1234578 2020/06/31 1955/11/24 高血壓 糖尿病 氣喘

3 2546871 2020/07/01 2008/02/09 糖尿病 心臟疾病

病歷號 住院日

(yyyy/mm/dd) 出生年月日

(yyyy/mm/dd) 藥碼1 藥碼2 藥碼3 藥碼4 1 1234567 2020/06/12 1960/05/01 B01 B05 B05 A03 2 1234578 2020/06/31 1955/11/24 A03 B05 A04 M04 3 2546871 2020/07/01 2008/02/09 A03 M04 A04 R06

病歷號 年齡 性別 婚姻狀況 教育程度

1234567 60 鰥寡 小學

1234578 64 新婚 10年

2546871 99 已婚 大專以上

入院護理紀錄

入院醫生診斷

入院醫生處置

(57)
(58)

變項類型

(59)

• 連續 [量] : 小數點有意義的數字

Ex.,血清總膽固醇濃度(mg / dl), 溫度(攝氏), BMI(kg/m

2

)…

• 序數: 有順序上的關係 , 但沒有數學上倍數的關係

Ex.,[冠軍, 亞軍, 季軍] [低年級, 中年級, 高年級] 疼痛指數 滿意度 [很滿意, 滿意, 尚可, 不滿意, 很不滿意]

• 類別 [質]: 沒有大小關係

• 時間 (天) – 開始治療後到死亡, 診斷後到復發 ….

二項 : 只有兩個類別

Ex., [死亡/存活] [男/女][有/沒有 糖尿病]

[有/沒有 抽菸]

非二項 : 兩個以上類別

Ex., 血型[A型, B型, AB型, O型]

種族 [高加索人, 非洲人, 亞洲人]

(60)

資料整理

(61)

資料整理

病歷號 住院日

(yyyy/mm/dd) 出生年月日

(yyyy/mm/dd) 年齡 性別 婚姻狀況 教育程度 診斷碼1 診斷碼2 診斷碼3 診斷碼4 1 1234567 2020/06/12 1960/05/01 60 鰥寡 小學 高血壓 腦血管疾

心臟疾病 子宮頸惡

性腫瘤 2 1234578 2020/06/31 1955/11/24 64 新婚 10年 高血壓 糖尿病 氣喘

3 2546871 2020/07/01 2008/02/09 99 已婚 大專以上 糖尿病 心臟疾病

(62)

病歷號 住院日

(yyyy/mm/dd) 出生年月日

(yyyy/mm/dd) 年齡 性別 婚姻狀況 教育程度 診斷碼1 診斷碼2 診斷碼3 診斷碼4 1 1234567 2020/06/12 1960/05/01 60 鰥寡 小學 高血壓 腦血管疾

心臟疾病 子宮頸惡

性腫瘤 2 1234578 2020/06/31 1955/11/24 64 新婚 10年 高血壓 糖尿病 氣喘

3 2546871 2020/07/01 2008/02/09 32 已婚 大專以上 糖尿病 心臟疾病

1. 數值是否符合㇐般(醫學)認知?

未婚 已婚 鰥寡 離婚 其他

小學 國中 高中 大專以上

其他 12?

(63)

資料整理

病歷號 住院日

(yyyy/mm/dd) 出生年月日

(yyyy/mm/dd) 年齡 性別 婚姻狀況 教育程度 診斷碼1 診斷碼2 診斷碼3 診斷碼4 1 1234567 2020/06/12 1960/05/01 60 鰥寡 小學 高血壓 腦血管疾

心臟疾病 子宮頸惡

性腫瘤

2 1234578 2020/06/31 1955/11/24 64 已婚 國中 高血壓 糖尿病 氣喘

3 2546871 2020/07/01 1988/02/09 32 已婚 大專以上 糖尿病 心臟疾病

病歷號 住院日

(yyyy/mm/dd) 出生年月日

(yyyy/mm/dd) 年齡 性別 婚姻狀況 教育程度 診斷碼1 診斷碼2 診斷碼3 診斷碼4 1 1234567 2020/06/12 1960/05/01 60 鰥寡 小學 高血壓 腦血管疾

心臟疾病 子宮頸惡

性腫瘤 2 1234578 2020/06/31 1955/11/24 64 新婚 10年 高血壓 糖尿病 氣喘

3 2546871 2020/07/01 2008/02/09 32 已婚 大專以上 糖尿病 心臟疾病

Raw data

Step 1 除錯

(64)

資料整理

病歷號 住院日

(yyyy/mm/dd) 出生年月日

(yyyy/mm/dd) 年齡 性別 婚姻狀況 教育程度 診斷碼1 診斷碼2 診斷碼3 診斷碼4 1 1234567 2020/06/12 1960/05/01 60 鰥寡 小學 高血壓 腦血管疾

心臟疾病

2 1234578 2020/06/31 1955/11/24 64 已婚 國中 高血壓 糖尿病 氣喘

3 2546871 2020/07/01 1988/02/09 32 已婚 大專以上 糖尿病 心臟疾病

病歷號 住院日

(yyyy/mm/dd) 出生年月日

(yyyy/mm/dd) 年齡 性別 婚姻狀

教育程

高血壓 腦血管

疾病 糖尿病 心臟疾

氣喘

1 123456

7 2020/06/12 1960/05/01 60 鰥寡 小學 1 1 0 1 0

2 123457

8 2020/06/31 1955/11/24 64 已婚 國中 1 0 1 0 1

3 254687

1 2020/07/01 1988/02/09 32 已婚 大專以

0 0 1 1 0

Step2 : 整理架構

(65)

資料整理

病歷號 住院日

(yyyy/mm/dd) 出生年月日

(yyyy/mm/dd) 年齡 性別 婚姻狀

教育程

高血壓 腦血管

疾病 糖尿病 心臟疾

氣喘

1 123456

7 2020/06/12 1960/05/01 60 1 3 1 1 1 0 1 0

2 123457

8 2020/06/31 1955/11/24 64 1 2 2 1 0 1 0 1

3 254687

1 2020/07/01 1988/02/09 32 2 2 4 0 0 1 1 0

Step3 : coding book 1,未婚

2,已婚 3,鰥寡 4,離婚 5,其他

1,小學 2,國中 3,高中 4,大專以上

5,其他 1,男

2,女

0,無 1,有

(66)

資料結構邏輯

露比任務:培養孩子邏輯思考的程式尋寶記

(67)

字串、數字、布林值(booleans)

字串 : 只要能被包括在引號裡的符 號都算是字串, 他可能包含了字母、

數字、空白, 或是其他電腦鍵打得 出來的符號, 像是”Ruby”.

數字 : 像是1、2、3, 或是 4.1217.

布林值(booleans) : 他只有「真」

(True) 或是「假」(False)兩種表達 方式

(68)

資料結構 (data structure)

資料結構 (data structure) : 資料有許多型態. 像是字串、數字與布林值.當手上有非常多資料時, 把他們排列的 有條有理, 會大大的提升使用效率. 我們將這個方法稱之為「資料結構」 (data structure).

(69)
(70)
(71)
(72)

水果 橘色 1

2

3

4

5

6

(73)

水果 橘色

1 + -

2 - -

3 - +

4 + +

5 + -

6 - -

(74)

水果 橘色 水果 且 橘色

1 + -

2 - -

3 - +

4 + +

5 + -

6 - -

True / False

(75)

水果 橘色 水果 且 橘色

1 + - False

2 - - False

3 - + False

4 + + True

5 + - False

6 - - False

True / False

(76)

水果 橘色 水果 或 橘色

1 + -

2 - -

3 - +

4 + +

5 + -

6 - -

True / False

(77)

水果 橘色 水果 或 橘色

1 + - True

2 - - False

3 - + True

4 + + True

5 + - True

6 - - False

True / False

(78)

水果 橘色 水果 且 不是橘色

1 + -

2 - -

3 - +

4 + +

5 + -

6 - -

True / False

(79)

水果 橘色 水果 且 不是橘色

1 + - True

2 - - False

3 - + False

4 + + False

5 + - True

6 - - False

True / False

(80)

水果 橘色 水果 且 橘色 水果 或 橘色 水果 且 不是橘 色

1 + - False True True

2 - - False False False

3 - + False True False

4 + + True True False

5 + - False True True

6 - - False False False

True / False True / False True / False

(81)

重複

迴圈 (loop)

開始 種植 種植 種植 種植 種植 種植 結束

開始 種植 結束

(82)

選擇 「如果…,就…」(if-then)

開始 種植 種植 種植 跳過 種植 種植 結束

重複

開始 種植 跳過 結束

(83)

選擇 「如果…,就…」(if-then)

(84)

選擇 「如果…,否則…」(if-else)

重複到鏟子

開始 如果有蟲 噴藥 否則 種植 結束

(85)
(86)

重複到鏟子

開始 如果沒有 蟲 種植 否則 噴藥 結束

(87)

統計分析軟體

Statistical Analysis Software

(88)

SPSS

Microsoft Excel

(89)
(90)
(91)
(92)
(93)
(94)

I. Getting R

A. Downloading and Installing R 32-bit/ 64-bit (on Windows/ on Mac) B. R environment

C. R version

 How to check

 How to update • supported by

Ross Ihaka and Robert Gentleman

(95)
(96)
(97)
(98)
(99)

安裝

(100)
(101)

R should be installed in a directory with no spaces in the name

(102)
(103)

click Finish to confirm this installation

(104)
(105)

更改為英文介面

(106)

R console 控制台 – 執行R指令

(107)
(108)
(109)

選取指令

(110)

I. Getting Rstudio II. Getting Rstudio

A. Downloading and Installing Rstudio B. Rstudio tools

C. Rstudio environment

(111)
(112)
(113)
(114)

×2

(115)

I. Getting Rstudio II. Getting Rstudio

A.Downloading and Installing Rstudio 

B.Rstudio environment and basic operation

C. Rstudio tools

(116)

1. Code editor: 撰寫程式碼

2. R Console: 執行程式碼

3. Workspace and History

4. Files/ Plots/ Packages

(117)

File >> New File >> R script 1. 開啟新 R script 檔案

(118)

3-2. 執行程式碼

2-1 Mac 2-2 Windows & Linux Command + Enter Ctrl + Enter 3.執行程式碼

3-1 選取程式碼

• Environment:目前變數的數值

• History:在 Consloe 執行過程式碼的歷史記錄。

2. 撰寫程式

(119)

4. 儲存程式碼

1

2

3. 檔名確認

(120)

File >> Open File

5. 開啟舊 R script 檔案

(121)

Coding Exercises: 1. 開啟新檔 2. 撰寫程式 3. 執行程式 4. 儲存程式 5. 開啟舊檔

(122)

Ways to Get Help in R

• help(sum)

• ?sum

(123)

I. Getting Rstudio II. Getting Rstudio

A.Downloading and Installing Rstudio 

B. Rstudio environment and basic operation 

C. Rstudio tools

(124)

Tools >> Global Operations

(125)

Tools >> Global Operations

• General - Basic

(126)
(127)

• 開啟時是否恢復workspace資料 關閉軟體  再開啟  存有紀錄

• 是否儲存目前 workspace 資料設定

(128)

Tools >> Global Operations

• Code – Display

(129)

Tools >> Global Operations

• Code – Saving

• 儲存繁體中文 encoding 方式

(130)

Tools >> Global Operations Appearance

Tools >> Global Operations 1. General

2. Code

3. Appearance

(131)

實作 Practice

(132)

Acute Inflammations Data Set

J.Czerniak, H.Zarzycki, Application of rough sets in the presumptive diagnosis of urinary system diseases, Artifical Inteligence and Security in Computing Systems, ACS'2002 9th International Conference Proceedings, Kluwer Academic Publishers,2003, pp. 41-51

急性膀胱炎

Inflammation of urinary bladder 腎盂腎炎Nephritis of renal pelvis origin

常發生在女性

突然高燒,體溫常超過40°C

高燒伴隨顫抖、雙邊或單側的腰椎異常疼痛

排尿疼痛

可能不規律的發生噁心、嘔吐、腹部疼痛

突發性腹部疼痛

常見排尿困難、排尿疼痛、頻尿

體溫升高,但常不超過38°C

排出尿液混濁,有時會有血尿

(133)

資料整理

{共120個觀察值, 6個變項, 其中㇐個連續型變項, 5個類別變項}

Temperature

體溫 Nausea

噁心 Lumbar pain

腰椎痛 Urine pushing

排尿困難 Micturition pains 排尿疼痛

Burning of urethra 尿道灼熱, 搔癢

35,5 no yes no no no

35,9 no no yes yes yes

35,9 no yes no no no

36,0 no no yes yes yes

36,0 no yes no no no

(134)

Coding book 譯碼簿

變項編號 變項英文名稱 變項中文名稱 單位

V1 Temperature 體溫 °C 連續變項

V2 nausea 噁心 0:無(no)

1:有(yes)

V3 Lumbar pain 腰椎痛 0:無(no)

1:有(yes)

V4 Urine pushing 排尿困難 0:無(no)

1:有(yes)

V5 Micturition pains 排尿疼痛 0:無(no)

1:有(yes) V6 Burning of urethra 尿道灼熱, 搔癢 0:無(no)

1:有(yes)

Alt+Enter : 下㇐行

(135)

資料整理

Temperature

體溫 Nausea

噁心 Lumbar pain

腰椎痛 Urine pushing

排尿困難 Micturition pains

排尿疼痛 Burning of urethra 尿道灼熱, 搔癢

35,5 no yes no no no

35,9 no no yes yes yes

35,9 no yes no no no

36,0 no no yes yes yes

36,0 no yes no no no

,  .

yes  1

no  0

{共120個觀察值, 6個變項, 其中㇐個連續型變項, 5個類別變項}

(136)

AND、OR、NOT

Temperature

體溫 Nausea

噁心 Lumbar pain

腰椎痛 Urine pushing

排尿困難 Micturition pains

排尿疼痛 Burning of urethra 尿道灼熱, 搔癢

35,5 no yes no no no

35,9 no no yes yes yes

35,9 no yes no no no

36,0 no no yes yes yes

36,0 no yes no no no

急性膀胱炎

Inflammation of urinary bladder 腎盂腎炎Nephritis of renal pelvis origin

常發生在女性

突然高燒,體溫常超過40°C

高燒伴隨顫抖、雙邊或單側的腰椎異常疼痛

排尿疼痛

可能不規律的發生噁心、嘔吐、腹部疼痛

突發性腹部疼痛

常見排尿困難、排尿疼痛、頻尿

體溫升高,但常不超過38°C

排出尿液混濁,有時會有血尿

Cystitis_1

排尿困難且排尿疼痛 Cystitis_2

排尿困難或排尿疼痛或尿道灼熱

(137)
(138)
(139)

Save file

(140)

Add comment

(141)

Set working directory. Read data.

(142)

No. of variables. No. of observations.

Column?

Row?

變項 variables

觀察值observations

(143)

No. of variables. No. of observations.

(144)

Creating new variables.[ifelse()] [AND、OR、NOT]

ifelse(test_expression, x, y)

> a = c(5,7,2,9)

> ifelse(a %% 2 == 0,"even","odd")

[1] "odd" "odd" "even" "odd"

(145)

Cystitis_1

排尿困難且排尿疼痛

(146)
(147)

Urine.pushing

=="yes" Micturition.pain s =="yes"

練習

(148)

(Urine.pushing ==“no“) AND (Micturition.pains ==“no")

(149)

No. of conditional observations.

Cystitis_1

排尿困難且排尿疼痛

49位 膀胱炎 + 71位非膀胱炎 = 120位 (確認是否與總數相符合)

(150)

確認是否Cystitis_1 = “TRUE”時

Urine pushing=1 且 Micturition pains=1 Cystitis_1 = “FALSE”時

Urine pushing=? Micturition pains=?

至少㇐個=0? 49 + 71 =120 check

(151)

• Cystitis_1

排尿困難且排尿疼痛

=AND(D2=1,E2=1)

• Cystitis_2

排尿困難或排尿疼痛或尿道灼熱

=OR(C2=1,D2=1,E2=1)

符合排尿困難或排尿疼痛或尿道灼熱 之膀胱炎與非膀胱炎定義患者各有幾位?

練習

(152)
(153)
(154)

Nephritis_D

若 體溫 ≥ 38°C 且 腰椎疼痛 [Lumber pain]

Nephritis_D 就 等於 1, 否則 Nephritis_D等於 0

= IF(AND(A2>=38,C2=1 ), 1, 0)

(155)
(156)
(157)
(158)

練習

• Cystitis_D

條件1:體溫 < 38°C 且 排尿困難 [Urine pushing]

條件2:排尿困難 [Urine pushing] 且 排尿疼痛 [Micturition pains]

若 符合條件1 或是 條件2 則 Cystitis_D 就 等於 1, 否則 Cystitis_D 等於 0 IF、OR、AND

(159)
(160)
(161)

“Knowledge is the collection of skills and information a person has

acquired through experience. Intelligence is the ability to apply knowledge.”

“Knowledge is wonderful, but it fades as techniques and technologies come and go. Intelligence sustains. Its borders extend beyond any technique or technology, and that makes all the difference.”

Anthony Colangelo

https://alistapart.com/blog/post/knowledge-vs-intelligence/#:~:text=Knowledge%20is%20the%20collection%20of,intelligence%20to%20help%20solve%20problems.

(162)
(163)
(164)

回家作業

E-mail: ijfeng@g-mail.nsysu.edu.tw

Title: [101-1 高中生物科學資優生培育計畫-高雄區_姓名_學號]

答案 [EXCEL]

程式碼 [R]

(165)

Echocardiogram Data Set 心臟超音波資料集

Donor: Steven Salzberg and Dr. Evlin Kinney

變項編號 變項英文名稱 變項中文名稱 單位 解釋

V1 age-at-heart-attack 心臟病發病年齡 year(s) 連續變項 V2 pericardial-

effusion 心包膜積水 0:無(no)

1:有(yes) V3 fractional-

shortening 短縮分率 左心收縮力指標之㇐,數值越高越不正常○

V4 epss epss E-point septal separation ○ 左心收縮力指標之

㇐,數值越高越不正常○

V5 lvdd 左心室舒張末期內

left ventricular end-diastolic dimension○ 舒張 末期心臟大小,數值越大越不正常○

V6 wall-motion-index 室壁運動記分指數 室壁運動異常程度,數值越高越不正常○

(166)

1. 共有 1-1觀察值, 有 1-2 個變項○

我們欲根據心臟超音波研究結果找出有哪些心臟病發患者心臟病發後生存年份短於1年○

研究發現年齡大於65歲老年人, 若 fractional-shortening大於等於0.15 且 EPSS大於等於10且LVDD大於 等於4.5 且 wall-motion-index大於1.0 則患者存活時間短於1年○

2. 有幾位病患 心臟病發病時年齡大於等於65 歲?

3. 有幾位病患 fractional-shortening大於等於0.15?

4. 有幾位病患 EPSS大於等於10?

5. 有幾位病患 LVDD大於等於4.5?

6. 有幾位病患 wall-motion-index大於1.0?

7. 1~5條件皆符合得有幾位?

(167)

研究另外發現年齡小於65歲者, 雖然fractional-shortening小於0.15 ,但是EPSS、LVDD與wall-motion- index 3項其中2項以上符合更為嚴苛的條件時,患者存活時間短於1年○

8. 有幾位病患 心臟病發病時年齡小於65 歲?

9. 有幾位病患 fractional-shortening小於0.15?

10.有幾位病患 EPSS大於等於15?

11.有幾位病患 LVDD大於等於4.5?

12.有幾位病患 wall-motion-index大於2.0?

13. 有幾位病患符合條件9、10 、11中2項以上者?

14.有幾位病患符合條件7 且條件8且條件12者?

15.根據研究所發現特徵,請問共有幾位患者存活時間短於1年 (符合條件6或是條件13) ?

(168)

答案

(169)

參考文獻

相關文件

You are given the wavelength and total energy of a light pulse and asked to find the number of photons it

 develop a better understanding of the design and the features of the English Language curriculum with an emphasis on the senior secondary level;..  gain an insight into the

好了既然 Z[x] 中的 ideal 不一定是 principle ideal 那麼我們就不能學 Proposition 7.2.11 的方法得到 Z[x] 中的 irreducible element 就是 prime element 了..

volume suppressed mass: (TeV) 2 /M P ∼ 10 −4 eV → mm range can be experimentally tested for any number of extra dimensions - Light U(1) gauge bosons: no derivative couplings. =&gt;

We explicitly saw the dimensional reason for the occurrence of the magnetic catalysis on the basis of the scaling argument. However, the precise form of gap depends

incapable to extract any quantities from QCD, nor to tackle the most interesting physics, namely, the spontaneously chiral symmetry breaking and the color confinement.. 

• Formation of massive primordial stars as origin of objects in the early universe. • Supernova explosions might be visible to the most

The difference resulted from the co- existence of two kinds of words in Buddhist scriptures a foreign words in which di- syllabic words are dominant, and most of them are the