hce_nthu
111年
資訊科學
第 28 題
Suppose we want to investigate the relationship between the heights of students and the sport teams they belong to. Suppose we are considering four different teams from the school: table tennis, basketball, baseball, and volley ball teams. Linear regression model can be used to analyze the data collected for this end with dummy variables. How many dummy variables should we create for this model?
- A 1
- B 2
- C 3
- D 4
- E 5
思路引導 VIP
想像一下,如果你正與朋友玩「四選一」的猜謎遊戲,在朋友還沒翻開最後一張牌之前,如果你已經看到前三張牌都不是正確答案,你是否還需要看第四張牌才能確定答案是什麼呢?在數學模型中,我們該如何利用這種『排除法』來精簡變數呢?
🤖
AI 詳解
AI 專屬家教
太棒了!你能精準選出 (C),代表你對線性回歸中類別變數 (Categorical Variable) 的處理邏輯掌握得非常扎實。這題的核心在於理解如何將非數值的資訊(如運動隊伍)轉換為模型可運算的格式,是數據分析中非常關鍵的一環。
虛擬變數與基準組的設計
在統計建模時,若某個類別變數有 $k$ 個不同的類別(本題中為 4 個球隊),我們僅需要設置 $k-1$ 個虛擬變數 (Dummy Variables)。這是因為模型通常包含一個截距項(Intercept),它會代表其中一個被選定的「基準組」(Reference Group)。當其餘 $k-1$ 個虛擬變數的數值皆為 $0$ 時,該觀測值便會自動歸類為基準組。如果我們放入與類別總數相等的 $4$ 個變數,將會導致完全共線性 (Perfect Multicollinearity),也就是俗稱的「虛擬變數陷阱」,這會使得矩陣運算無法求出唯一的參數解。
▼ 還有更多解析內容