商業數量方法 Summer 2013 授課教師 : 統計系余清祥日期 :2013 年 7 月 1 日第一週 : 資料與基本分析課程下載 : http://csyue.nccu.edu.tw
基本資料分析的目的 資料偵錯 資料輸入錯誤 尋找可能的離群值 初步探索資料的特性 資料的集中 散佈趨勢 驗證已知的結果 是否與已知的結果相同?
Types of Data( 資料類型 ) Numerical data Qualitative Data Types Quantitative Levels of Nominal Ordinal Interval Ratio Measurement Discrete Discrete or continuous
資料類型將直接影響分析方法的選取, 並非所有資料都適合常見的統計方法, 任意使用分析方法可能會得出令人啼笑皆非的結果 已知 A > B, B > C 是否代表 A > C? 甲城市乙城市丙城市 A 候選人 1 2 3 B 候選人 2 3 1 C 候選人 3 1 2 註 :1 代表最喜歡,3 代表最不喜歡
Nominal( 名義 ) Data are labels or names used to identify an attribute of the element.( 數字只供標示之用, 無大小的差異!) A nonnumeric label or a numeric code may be used.
Nominal Example: Students of a university are classified by the school in which they are enrolled using a nonnumeric label such as Business, Humanities, Education, and so on. Alternatively, a numeric code could be used for the school variable (e.g. 1 denotes Business, 2 denotes Humanities, 3 denotes Education, and so on).
Ordinal( 順序 ) The data have the properties of nominal data and the order or rank of the data is meaningful.( 任兩數字可比較大小, 但相對差異不見得可相加或相乘!) A nonnumeric label or a numeric code may be used.
Ordinal Example Students of a university are classified by their class standing using a nonnumeric label such as Freshman, Sophomore, Junior, or Senior. Alternatively, a numeric code could be used for the class standing variable (e.g. 1 denotes Freshman, 2 denotes Sophomore, and so on).
Interval The data have the properties of ordinal data and the interval between observations is expressed in terms of a fixed unit of measure. ( 數字間的差異可比較, 但不見得有絕對的 0!) Interval data are always numeric.
Interval Example: Melissa has an SAT score of 1205, while Kevin has an SAT score of 1090. Melissa scored 115 points more than Kevin.
Ratio The data have all the properties of interval data and the ratio of two values is meaningful. ( 這就是日常生活中使用的數字, 有絕對的 0 以及大小順序的差異!) Variables such as distance, height, weight, and time use the ratio scale. This scale must contain a zero value that indicates that nothing exists for the variable at the zero point.
Ratio Example: Melissa s college record shows 36 credit hours earned, while Kevin s record shows 72 credit hours earned. Kevin has twice as many credit hours earned as Melissa.
資料類型範例 ( 氣象局 ): Nominal: 天氣晴朗程度 晴 多雲 陰天 ; 衛星雲圖 色調表示密度不同的雲雨區 ( 雨量表示圖也類似 ) Ordinal: 颱風強度 輕度 ( 每秒 17.2 至 32.6 公尺 ) 中度 ( 或每秒 32.7 至 50.9 公 ) 強烈 ( 每秒 51.0 公尺以上 ); 豪雨分級 大雨 (50 公釐 ) 豪雨 (130 公釐 ) 大豪雨 (200 公釐 ) 超大豪雨 (350 公釐 )
資料類型範例 ( 續 ) Interval: 水庫水位 例如 : 翡翠水庫嚴重下限 120 公尺 最高水位 170 公尺 ; 地震強度 5 及地震比 4 級地震多一級, 但強度為 10 倍 Ratio: 雨量多寡 ( 公釐 ); 風力強度 ( 公尺 / 秒 )
Qualitative and Quantitative Data Data can be further classified as being qualitative or quantitative. The statistical analysis that is appropriate depends on whether the data for the variable are qualitative or quantitative. In general, there are more alternatives for statistical analysis when the data are quantitative.
Qualitative Data Qualitative data are labels or names used to identify an attribute of each element. Qualitative data use either the nominal or ordinal scale of measurement. Qualitative data can be either numeric or nonnumeric. The statistical analysis for qualitative data are rather limited.
Quantitative Data Quantitative data indicate either how many or how much. Quantitative data that measure how many are discrete. Quantitative data that measure how much are continuous because there is no separation between the possible values for the data.. Quantitative data are always numeric. Ordinary arithmetic operations are meaningful only with quantitative data.
問卷資料範例 : 請問您本次購買的機車是 什麼廠牌 汽缸大小 c.c. 請問您打算幾年後換購新機車? 1. 1 年以下 2. 1~2 年 3. 3~4 年 4. 5 年以上 5. 其他 ( 請說明 ) 請問您對本郵局的滿意程度為何? 1. 不滿意 2. 普通 3. 滿意 請問您對本郵局的滿意程度為何? 1. 非常不滿意 2. 不滿意 3. 普通 4. 滿意 5. 非常滿意
資料蒐集的方式 一般將資料蒐集分類成 : 1. 實驗設計 (Experimental Design) 包括臨床試驗 (Clinical Trials), 需要較精密計畫, 一般分成實驗 對照組, 較適合用於推論因果關係的研究 2. 抽樣調查 (Sampling Survey) 設計問卷, 藉由調查取得資訊 目標 : 藉由蒐集的資料推得訊息
另一種常見的資料來源分類, 是依據資料產生分成 : 1. 實驗設計 (Experimental Design) 2. 觀察研究 (Observational Study) 兩者的差異在於資料蒐集者的參與, 蒐集資料並不影響觀察研究, 像是研究股市 利率 房地產價格, 與實驗設計控制變因獲得觀察值不同 註 : 參考 Wikipedia 及臨床實驗講義
實驗組 處理 ; 處方 對照組 安慰劑 (Placebo) 單盲與雙盲實驗 : 單盲 : 只有受試者不知道自己的處方 雙盲 : 醫生與受試者都不知道處方的分配方式
若以時間來區分, 資料可分成 : 1. 縱向資料 (Longitudinal Data) 2. 橫向資料 (Cross-sectional Data) 縱向資料又稱為長期追蹤 (Panel) 資料, 研究對象為固定個體, 研究的特色在於可觀察相同個體因時間而有的變動, 也稱為世代 (Cohort) 資料 橫向資料固定一個時間點, 對當時的母體蒐集資料, 在不同時間點獲得的資料不見得可互相比較, 註 : 國內外較知名的縱向資料包括 華人家庭動態研究 與 PSID(Panel Study of Income Dynamics )
基本資料分析的可能項目 確定資料屬性 ( 計質或計量 ) 資料如何分析及整理 (e.g., 圖表 ) 計質資料先決定總共有幾類 比例 ; 計量資料可考慮計算集中 散佈趨勢 根據問題驗證資料特性 若為迴歸分析, 考慮變數間的關聯 問題 : 為什麼需要確定資料為常態分配, 或是有可能的離群值?
集中趨勢量數 平均數 (Mean; 期望值 ) 算術平均數 (Average); 加權平均數 (Weighted Average); 其他 ( 幾何平均數 調合平均數 ) 中位數 (Median): 一半的數值比中位數大, 一半的數值比中位數小 眾數 (Mode): 出現次數最多的數值
集中趨勢量數 ( 範例 ) 員工薪資為 25, 30, 30, 30, 35, 43, 70, 80, 85 中位數是 35 25, 30, 30, 30, 35, 43, 70, 80, 85, 90 中位數是 35 + 43 = 39 2 員工薪資為 25, 30, 30, 30, 35, 43, 70, 80, 85 眾數是 30 25, 30, 30, 35, 38, 43, 43, 80, 85 眾數是 30 及 43( 眾數不唯一 )
差異量數 全距 (Range): 最大與最小數值之差 (Range = Max-Min) 四分位差 (Quartile Deviation): 四分位數 (Quartile;Q 1 ): 3/4 的數值比大 Q 1, 1/4 的數值比 Q 1 小 四分位差 = Q 3 Q 1 變異數 (Variance; σ 2 ) 與標準差 (Standard Deviation;σ)
問卷分析範例 以表格 圖形展示資料更有效果! 長條圖 (Bar Chart) 選項人數百分比現代化連鎖餐飲店有什麼吸引你的地方 1 簡便快速 153 38.25 其它 5.75% 2 食物 89 22.25 3 環境因素 135 33.75 4 其它 23 5.75 N= 400 環境因素 33.75% 食物 22.25% 簡便快速 38.25% 0.00% 10.00% 20.00% 30.00% 40.00% 50.00% 60.00% 70.00%
平均數與中位數 左偏 (Left-skewed): 當少數觀察明顯值較一般觀察值小時 ( 如下圖 ), 平均數將被這些觀察值拉下, 但中位數較不受影響, 此時中位數大於平均數 同理, 少數觀察值較大時則稱為右偏 (Right-skewed) 50 Histogram of Data 40 Frequency 30 20 10 0-4 -3-2 -1 Data 0 1 2
如何藉由統計獲取資訊? 如果想瞭解民國 94 年指定考試各科的特性, 可以藉助哪些工具? 例如 : 那一科的分數最不平均, 像是哪一科大多數人都考得不好, 只有少數人分數分高 平均數明顯大於中位數, 稱為右偏 (skewed to the right); 反之, 若平均數明顯小於中位數, 稱為右偏 (skewed to the left) 平均數等於中位數, 則為兩側對稱
Frequency 0 5000 10000 15000 國文 Frequency 0 2000 4000 6000 8000 英文 Frequency 0 1000 2000 3000 4000 5000 數學甲 0 20 40 60 80 0 20 40 60 80 100 0 20 40 60 80 100 x1 x2 x3 數學乙 化學 物理 Frequency 0 2000 6000 10000 Frequency 0 1000 2000 3000 4000 Frequency 0 1000 3000 5000 0 20 40 60 80 100 0 20 40 60 80 100 0 20 40 60 80 100 x4 x5 x6 生物 歷史 地理 Frequency 0 500 1500 2500 3500 Frequency 0 1000 3000 5000 Frequency 0 2000 4000 6000 0 20 40 60 80 100 0 20 40 60 80 0 20 40 60 80 x7 x8 x9