naywinaung blog,statistics Data transform in regression

Data transform in regression

Regression မှာ Data Transform ဘာကြောင့် လုပ်သင့်သလဲ၊ ဘယ်လိုလုပ်မလဲ

Regression analysis မှာ assumption တွေဖြစ်တဲ့ linearity, homoscedasticity, normality of residuals စတဲ့ အချက်တွေကို ပိုကောင်းစေဖို့အတွက် data တွေ ကို transform လုပ်ကြရပါတယ်။ များသောအားဖြင့် data အမျိုးအစားတွေကို ကြည့်ပြီး နည်းလမ်း ၁၁ ခုနဲ့ transform လုပ်ကြပါတယ်။ အများစု က linear regression မှာ အသုံးဝင်ပါတယ်။ တချို့ ကို generalized linear models မှာလည်း သုံးလို့ ရပါတယ်။

1. Log Transformation (log(x) ဒါမှမဟုတ် log(y)) 
   အသုံးအများဆုံး တစ်ခုဖြစ်ပါတယ်။ Data က right-skewed (ညာဘက် အရမ်း ဆန့်ထွက်နေရင်)၊ ဒါမှမဟုတ် multiplicative relationship ရှိရင် (ဥပမာ ဝင်ငွေ နဲ့ သုံးစွဲမှု) သုံးလေ့ရှိပါတယ်။ ရလဒ်က ပိုပြီး linear ဖြစ်လာပြီး variance တည်ငြိမ်လာပါတယ်။ ဥပမာ အိမ်ဈေး ခန့်မှန်းရင် price ကို log ယူလိုက်ရင် အဆင်ပြေလေ့ရှိပါတယ်။ Zero ဒါမှမဟုတ် negative values ပါနေရင်
အသုံးမပြုသင့်ပါ။

2. Square Root Transformation (√x ဒါမှမဟုတ် √y) 
   Count data လို အပေါင်း တန်ဖိုး တွေ မှာ variance က mean နဲ့ အချိုးကျ တိုးနေရင် (Poisson-like) သုံးပါတယ်။ Log ထက် အနည်းငယ် သက်သာ ပြီး zero ပါရင်လည်း အဆင်ပြေပါတယ်။ ဥပမာ ရောဂါ ကို စစ်ဆေး အရေအတွက် မျိုးပေါ့။ Skewness အရမ်း ပြင်းရင် (log က ပိုကောင်း) မသုံးသင့်ပါ။

3. Square / Power Transformation (x² ဒါမှမဟုတ် x³) 
   ဆက်နွယ်မှု က curved ဖြစ်နေရင် (ဥပမာ diminishing returns) သုံးပါတယ်။ Polynomial regression မှာ အဓိက အသုံးပြုကြပါတယ်။ ညာဘက် ဆန့်ထွက်နေတဲ့ data ကို ပိုပြီး ညီမျှ လာအောင် လုပ်ပေးနိုင်ပါတယ်။ Overfitting မဖြစ်အောင် degree နည်းနည်း ပဲ သုံးရပါမယ်။

4. Reciprocal Transformation (1/x ဒါမှမဟုတ် 1/y) 
   ဆက်နွယ်မှု က hyperbolic ပုံစံ ဖြစ်နေရင် (တစ်ခု တိုးလာရင် တစ်ခု အရမ်း လျော့ကျသွားတာ) သုံးပါတယ်။ ဥပမာ အလုပ်သမား အရေအတွက် နဲ့ ထုတ်လုပ်မှု ကြား ဆက်နွယ်မှု မျိုး။ Variance ကြီးတဲ့ data မှာ လည်း အဆင်ပြေပါတယ်။Zero ပါနေရင် (division by zero) မသုံးသင့်ပါ။

5. Box-Cox Transformation 
   အကောင်းဆုံး power ကို အလိုအလျောက် ရှာပေးတဲ့ နည်း (λ တန်ဖိုး ရှာ)ဖြစ်ပါတယ်။ y^λ လို ပုံစံမျိုးပါ။ Positive data တွေမှာ အရမ်း အသုံးဝင်ပါတယ်။ Normality နဲ့ homoscedasticity ကို တပြိုင်နက် ပြင်ပေးနိုင်ပါတယ်။ (λ=0 ဆို log ဖြစ်သွားပါတယ်။)။ Negative values ပါနေရင် မသုံးသင့်ပါ။

6. Yeo-Johnson Transformation
   Box-Cox ရဲ့ အဆင့်မြှင့် ဗားရှင်းတစ်ခုဖြစ်ပါတယ်။ Negative values ပါရင်တောင် သုံးလို့ ရပါတယ်။ ခေတ်မီ ဆော့ဖ်ဝဲတွေ မှာ ပါဝင်ပါတယ်။

7. Normalization / Standardization (z-score ဒါမှမဟုတ် min-max scaling) 
   regression မှာ အရေးကြီးတယ်။ အထူးသဖြင့် regularized models (Ridge, Lasso) ဒါမှမဟုတ် gradient descent သုံးတဲ့ အခါ လိုအပ်ပါတယ်။ တန်ဖိုး အတိုင်းအတာ မတူတဲ့ feature တွေ ကို တူညီအောင် လုပ်ပေးနိုင်ပါတယ်။

8. Polynomial Features (x → x, x², x³ စသဖြင့် ဖန်တီးခြင်း) 
   Non-linear relationship ကို linear model နဲ့ ဖမ်းချင်ရင် သုံးပါတယ်။ ဥပမာ quadratic regression မှာ x² ထည့်တာမျိုး။ ဒါက feature engineering တစ်မျိုးပါပဲ။

9. Differencing (time series အတွက် အဓိက သုံးပါတယ်) 
   Trend ဒါမှမဟုတ် seasonality ရှိရင် y_t – y_{t-1} လို လုပ်နိုင်ပါတယ်။ Stationarity ရအောင် လုပ်ပေးပါတယ်။ Time series regression မှာ အသုံးများပါတယ်။

10. Arcsin / Arcsine Transformation (asin(√p)) 
    Proportion ဒါမှမဟုတ် percentage data (0 နဲ့ 1 ကြား) မှာ သုံးပါတယ်။ အထူးသဖြင့် binomial data ရဲ့ variance ကို stabilize လုပ်ပေးနိုင်ပါတယ်။ ဇီဝဗေဒ နဲ့ ဆေးပညာ data မှာ အသုံးပြုတာ များပါတယ်။

11. Logit Transformation (log(p/(1-p))) 
    Logistic regression မှာ အဓိက အသုံးပြုပါတယ်။ Probability ကို log-odds အဖြစ် ပြောင်းပေးပါတယ်။ Binary outcome အတွက် လိုအပ်တဲ့ အဆင့် တစ်ခု ဖြစ်ပါတယ်။ တချို့ က generalized linear model ရဲ့ link function အဖြစ် သတ်မှတ်ပါတယ်။

ဒီ ၁၁ နည်း က အသုံးအများဆုံး နဲ့ အရေးပါဆုံး တွေပဲ ဖြစ်ပါတယ်။ တကယ်လုပ်တဲ့ အခါ ဘယ်ဟာ အကောင်းဆုံး ဆိုတာ residual plot ကြည့်ပြီး ဆုံးဖြတ်ရပါတယ် ။ linearity ရှိလား၊ homoscedasticity ရှိလား၊ normality ရှိလား စစ်ရပါမယ်။ တချို့ အချိန်တွေမှာ Box-Cox ဒါမှမဟုတ် Yeo-Johnson လို automatic method တွေ သုံးရင် ပိုလွယ်ကူပါတယ်။

နပေတိုး


Discover more from naywinaung

Subscribe to get the latest posts sent to your email.

Leave a Reply

Your email address will not be published. Required fields are marked *

Related Post

ဒေတာတွေကို ဘယ်လို Chart အမျိုးအစားနဲ့ ပြမလဲ?ဒေတာတွေကို ဘယ်လို Chart အမျိုးအစားနဲ့ ပြမလဲ?

ဒေတာတွေကို ဘယ်လို Chart အမျိုးအစားနဲ့ ပြမလဲ?ဒေတာတွေကို ရှင်းရှင်းလင်းလင်း ပြသဖို့အတွက် Chart အမျိုးအစား ရွေးချယ်တဲ့အခါ ရည်ရွယ်ချက် (ဘာကို ပြချင်လဲ) ပေါ်မူတည်ပြီး ရွေးချယ်နိုင်ပါတယ်။ အဓိက အမျိုးအစား ၄ မျိုး ရှိပါတယ်။၁။ COMPARISON (နှိုင်းယှဉ်ပြသခြင်း)ဘယ်အချိန်မှာ သုံးမလဲ? – ပစ္စည်းတွေ (သို့) အချိန်ကာလတွေကြား နှိုင်းယှဉ်ပြချင်တဲ့အခါ။(က) Among Items

SDG (Sustainable Development Goals)SDG (Sustainable Development Goals)

SDG (Sustainable Development Goals) တွေနဲ့ ပတ်သက်ပြီး နည်းနည်းပွားကြည့်ကြရအောင်ဗျာ။ SDG ဆိုတာကတော့ ရေရှည်ဖွံ့ဖြိုးတိုးတက်ရေးပန်းတိုင်များ (Sustainable Development Goals) ကို အတိုကောက်ခေါ်တာပါ။ ဒီပန်းတိုင်တွေကို ကုလသမဂ္ဂ (UN) က ၂၀၁၅ ခုနှစ် စက်တင်ဘာလမှာ ကျင်းပခဲ့တဲ့ ရေရှည်ဖွံ့ဖြိုးတိုးတက်ရေး ထိပ်သီးအစည်းအဝေးကနေ ချမှတ်ခဲ့တာ ဖြစ်ပါတယ်။ သူတို့ဟာ ၂၀၃၀ ခုနှစ်အထိ

Chapter 4 မှာ ဘာတွေရေးရမလဲChapter 4 မှာ ဘာတွေရေးရမလဲ

Chapter 4 ဆိုတာ သုတေသနကနေ ရလာတဲ့ အချက်အလက်တွေကို ဇာတ်လမ်းပြောသလို ပြန်ပြောပြတဲ့ အခန်းဖြစ်ပါတယ်။ ဘာတွေတွေ့ခဲ့လဲ၊ အဲဒီတွေ့ရှိချက်တွေက ဘာကိုဆိုလိုလဲဆိုတာကို ရှင်းပြရမှာပါ။ ဒီအခန်းက သိပ်အရေးကြီးပါတယ်။ ဘာလို့လဲဆိုတော့ သုတေသနကနေ ဘာတွေ သင်ယူခဲ့ရလဲဆိုတာကို တခြားသူတွေကို သိစေနိုင်လို့ပါ။ ၁။ နိဒါန်း (Introduction)ဒီအခန်းက ဘာအကြောင်းလဲဆိုတာကို အရင်ဆုံးပြောပြရပါမယ်။ “ဒီအခန်းမှာ ငါတို့ သုတေသနကရလာတဲ့ ရလဒ်တွေကို