At a glance
- A regression draws the one straight line that comes closest to all the points at once, and reports its slope.
- The slope is in the data's own units: maunds of yield per centimetre of rain, taka per year of schooling.
- The standard error says how much that slope would wobble if you drew a fresh sample of the same size.
- Robust (HC1) errors change the standard error and never the coefficient.
- Observations that share a village, a firm or a year share their noise too. Cluster on that.
A regression in plain words
Put rainfall along the bottom and yield up the side, one dot per farm. Ordinary least squares picks the intercept and the slope of the line whose vertical gaps to the dots, squared and added up, are as small as they can be. "Ordinary" because every dot counts the same. The model is yield equals intercept plus slope times rainfall plus noise, and the noise is everything about a farm the line does not know: soil, seed, the farmer.
The slope is the coefficient, and it is a sentence: one more centimetre of rain goes with this much more yield, in the units the columns were typed in. Change rainfall to millimetres and the slope divides by ten while meaning exactly the same thing.
The four assumptions, in plain words
- The relationship is a straight line, or you have transformed the columns until it is. A curve fitted with a line gives a slope that is right nowhere.
- The noise averages zero at every level of rainfall. Nothing hiding in the noise also moves rainfall. If wetter villages also have richer soil, the slope carries the soil's credit and calls it rain.
- The noise is equally spread at every level of rainfall. This is homoskedasticity, and when it fails the failure is called heteroskedasticity.
- One farm's noise says nothing about another farm's. Independence.
The first two decide whether the slope is right. The last two decide whether the standard error is right. Robust errors mend the last two; nothing about the errors can mend the first two.
Worked example: six farms
| Farm | Rain | Yield | Rain minus 130 | Yield minus 16 | Product | Rain deviation squared |
|---|---|---|---|---|---|---|
| 1 | 80 | 14 | -50 | -2 | 100 | 2,500 |
| 2 | 100 | 12 | -30 | -4 | 120 | 900 |
| 3 | 120 | 17 | -10 | 1 | -10 | 100 |
| 4 | 140 | 15 | 10 | -1 | -10 | 100 |
| 5 | 160 | 20 | 30 | 4 | 120 | 900 |
| 6 | 180 | 18 | 50 | 2 | 100 | 2,500 |
| Sum | 420 | 7,000 |
The slope is the sum of the products divided by the sum of the squared rain deviations: 420 divided by 7,000, which is 0.06 maunds per centimetre. The intercept is the mean yield minus the slope times the mean rain: 16 minus 0.06 times 130, which is 16 minus 7.8, which is 8.2. The line is yield equals 8.2 plus 0.06 times rain. In words: across these six farms, ten centimetres more rain went with 0.6 of a maund more per bigha.
Where the standard error comes from
Put each farm's rain into the line and see what it predicts: 13, 14.2, 15.4, 16.6, 17.8 and 19. The gaps between what happened and what the line says are the residuals: 1, -2.2, 1.6, -1.6, 2.2 and -1. Square them and add: 1 plus 4.84 plus 2.56 plus 2.56 plus 4.84 plus 1 is 16.8. Divide by the observations minus the two things estimated, 6 minus 2, to get the noise variance: 4.2. The standard error of the slope is the square root of that divided by the sum of squared rain deviations: the square root of 4.2 over 7,000, which is the square root of 0.0006, which is 0.0245.
The t statistic is the slope over its standard error: 0.06 divided by 0.0245, which is 2.45. A t of about 2.4 says the slope sits two and a half standard errors away from zero. What that is worth depends on how many farms there are. With six, the line for a five per cent two-sided test is 2.78, so these six do not clear it. With thirty or more the line is about 2.04 and the same t clears it. And t says nothing about size: whether 0.06 of a maund per centimetre matters to a farmer is a question about farming, not about statistics.
Heteroskedasticity, and what HC1 does
The classical standard error above used one number, 4.2, for the spread of the noise at every level of rain. Suppose the big, wet farms are also the erratic ones. Then the spread is larger exactly where the rain deviations are largest, which is where the points pull hardest on the slope, and the classical standard error is too small: the slope is less certain than it says.
HC1 (heteroskedasticity-consistent, the first small-sample correction) does not assume one spread. It takes each farm's own squared residual, weights it by that farm's squared rain deviation, adds them up, divides by the squared sum of rain deviations, and multiplies by n over n minus k to make up for small samples. On the six farms: the weighted squares are 2,500, 4,356, 256, 256, 4,356 and 2,500, which add to 14,224. Times 6 over 4 is 21,336. Divide by 7,000 squared, 49,000,000, and take the square root: 0.0209. The t becomes 2.87.
The slope is still 0.06. It has to be: least squares chose it by minimising the gaps and never looked at how the gaps were spread. Robust errors re-estimate how sure you may be, never what you found. Six farms are too few for the robust number to mean much on its own; the point is which number moved.
Clustered errors
Sixty farms in six villages are not sixty independent facts about rain. Farms in one village share the weather, the soil, the same extension officer, so their residuals move together, and the fourth assumption fails by construction. Cluster-robust errors let the residuals correlate however they like inside a village and assume nothing between villages. Cluster at the level where the shock or the treatment varies: a village-level programme means village clusters even when the outcome is measured per farm.
How many clusters
The method wants many clusters, thirty to fifty as a rule of thumb, and with six villages no correction is honest. Say so in the text rather than reporting a clustered error as if it settled the matter.
Where it goes wrong
- Reporting the slope with no units, so nobody can tell whether 0.06 is a lot.
- Reading a large t as a large effect.
- Reaching for robust errors to rescue a slope that is biased by the second assumption. They cannot.
- Clustering at the farm level when the programme was assigned by village.
- Reporting HC1 errors for a sample of twenty as though they were exact.
Checklist
- The units of every coefficient are stated in the sentence that reports it.
- The scatter has been looked at before the line was fitted.
- Something has been said about what might sit in the noise and move the regressor too.
- A test for unequal spread has been run, or robust errors are reported by default.
- If observations share a group, errors are clustered on it and the number of clusters is stated.
- Effect size and t are reported as two different things.
The lab runs OLS with classical, HC1 or clustered errors from the method list and writes the APA table; the workshop's "which test" tool asks whether a regression is what your question needs, and its sample size tool says how many farms would let a slope this size clear the line.
এক নজরে
- রিগ্রেশন সব বিন্দুর সবচেয়ে কাছ দিয়ে যাওয়া একটা সরলরেখা টানে, আর তার ঢাল জানায়।
- ঢাল থাকে তথ্যের নিজের এককে: প্রতি সেন্টিমিটার বৃষ্টিতে কত মণ ফলন, প্রতি বছর পড়াশোনায় কত টাকা।
- স্ট্যান্ডার্ড এরর বলে, একই মাপের নতুন নমুনা নিলে ঢালটা কতটা এদিক-ওদিক হতো।
- রোবাস্ট (HC1) ত্রুটি স্ট্যান্ডার্ড এরর বদলায়, সহগ কখনও নয়।
- একই গ্রাম, একই কোম্পানি বা একই বছরের পর্যবেক্ষণ তাদের গোলমালও ভাগ করে নেয়। সেই দল ধরে ক্লাস্টার করুন।
সহজ কথায় রিগ্রেশন
নিচে বৃষ্টি, পাশে ফলন, প্রতিটি খামারের জন্য একটা বিন্দু। সাধারণ লিস্ট স্কোয়ার (OLS) এমন একটা রেখার শুরুর মান আর ঢাল বেছে নেয়, যার সঙ্গে বিন্দুগুলোর খাড়া ফারাক বর্গ করে যোগ করলে যতটা সম্ভব ছোট হয়। "সাধারণ" কারণ প্রতিটি বিন্দুর ওজন সমান। মডেলটা হলো: ফলন সমান শুরুর মান যোগ ঢাল গুণ বৃষ্টি যোগ গোলমাল। গোলমাল হলো খামারের সেই সব কিছু যা রেখা জানে না: মাটি, বীজ, চাষি নিজে।
ঢালই সহগ, আর সেটা একটা বাক্য: এক সেন্টিমিটার বেশি বৃষ্টির সঙ্গে এতটা বেশি ফলন, যে এককে কলামগুলো লেখা হয়েছে সেই এককে। বৃষ্টি মিলিমিটারে লিখলে ঢাল দশ ভাগ হয়ে যায়, কিন্তু মানে থাকে ঠিক একই।
সহজ কথায় চারটা অনুমান
- সম্পর্কটা সরলরেখা, অথবা কলাম বদলে আপনি সরলরেখা বানিয়েছেন। বাঁকা সম্পর্কে সরলরেখা টানলে ঢাল কোথাও ঠিক হয় না।
- বৃষ্টির প্রতিটি মাত্রায় গোলমালের গড় শূন্য। গোলমালের ভেতরে লুকিয়ে থাকা কিছু যেন বৃষ্টিকেও না নাড়ায়। বেশি বৃষ্টির গ্রামের মাটিও যদি ভালো হয়, তবে মাটির কৃতিত্ব ঢালের ঘাড়ে চাপে আর নাম হয় বৃষ্টির।
- বৃষ্টির প্রতিটি মাত্রায় গোলমাল সমান ছড়ানো। এর নাম homoskedasticity, আর এটা ভাঙলে তার নাম heteroskedasticity।
- এক খামারের গোলমাল অন্য খামারের গোলমাল সম্পর্কে কিছু বলে না। স্বাধীনতা।
প্রথম দুটো ঠিক করে ঢাল সঠিক কি না। শেষ দুটো ঠিক করে স্ট্যান্ডার্ড এরর সঠিক কি না। রোবাস্ট ত্রুটি শেষ দুটো সারায়; ত্রুটি নিয়ে যা-ই করুন, প্রথম দুটো সারে না।
করে দেখানো: ছয়টা খামার
| খামার | বৃষ্টি | ফলন | বৃষ্টি বিয়োগ ১৩০ | ফলন বিয়োগ ১৬ | গুণফল | বৃষ্টির ফারাকের বর্গ |
|---|---|---|---|---|---|---|
| ১ | ৮০ | ১৪ | -৫০ | -২ | ১০০ | ২,৫০০ |
| ২ | ১০০ | ১২ | -৩০ | -৪ | ১২০ | ৯০০ |
| ৩ | ১২০ | ১৭ | -১০ | ১ | -১০ | ১০০ |
| ৪ | ১৪০ | ১৫ | ১০ | -১ | -১০ | ১০০ |
| ৫ | ১৬০ | ২০ | ৩০ | ৪ | ১২০ | ৯০০ |
| ৬ | ১৮০ | ১৮ | ৫০ | ২ | ১০০ | ২,৫০০ |
| যোগ | ৪২০ | ৭,০০০ |
ঢাল হলো গুণফলের যোগ ভাগ বৃষ্টির ফারাকের বর্গের যোগ: ৪২০ ভাগ ৭,০০০, মানে প্রতি সেন্টিমিটারে ০.০৬ মণ। শুরুর মান হলো ফলনের গড় বিয়োগ ঢাল গুণ বৃষ্টির গড়: ১৬ বিয়োগ ০.০৬ গুণ ১৩০, মানে ১৬ বিয়োগ ৭.৮, মানে ৮.২। রেখাটা: ফলন সমান ৮.২ যোগ ০.০৬ গুণ বৃষ্টি। কথায়: এই ছয় খামারে দশ সেন্টিমিটার বেশি বৃষ্টির সঙ্গে বিঘায় ০.৬ মণ বেশি ফলন গেছে।
স্ট্যান্ডার্ড এরর কোথা থেকে আসে
প্রতিটি খামারের বৃষ্টি রেখায় বসিয়ে দেখুন কী বলে: ১৩, ১৪.২, ১৫.৪, ১৬.৬, ১৭.৮ আর ১৯। যা হয়েছে আর রেখা যা বলে, তার ফারাকগুলো: ১, -২.২, ১.৬, -১.৬, ২.২ আর -১। বর্গ করে যোগ করুন: ১ যোগ ৪.৮৪ যোগ ২.৫৬ যোগ ২.৫৬ যোগ ৪.৮৪ যোগ ১ হলো ১৬.৮। পর্যবেক্ষণ থেকে আন্দাজ করা দুটো জিনিস বাদ দিয়ে, ৬ বিয়োগ ২ দিয়ে ভাগ করলে গোলমালের ভেদ: ৪.২। ঢালের স্ট্যান্ডার্ড এরর হলো সেটাকে বৃষ্টির ফারাকের বর্গের যোগ দিয়ে ভাগ করে বর্গমূল: ৪.২ ভাগ ৭,০০০-এর বর্গমূল, মানে ০.০০০৬-এর বর্গমূল, মানে ০.০২৪৫।
t হলো ঢাল ভাগ তার স্ট্যান্ডার্ড এরর: ০.০৬ ভাগ ০.০২৪৫, মানে ২.৪৫। মোটামুটি ২.৪ মানের t বলে, ঢালটা শূন্য থেকে আড়াই স্ট্যান্ডার্ড এরর দূরে। তার দাম কত, তা নির্ভর করে খামার কটা তার ওপর। ছয়টায় দুই দিকের পাঁচ শতাংশ পরীক্ষার সীমা ২.৭৮, তাই এই ছয়টা সীমা পার হয় না। তিরিশ বা তার বেশি হলে সীমা মোটামুটি ২.০৪, আর একই t পার হয়ে যায়। আর t মাপের কথা কিছুই বলে না: প্রতি সেন্টিমিটারে ০.০৬ মণ চাষির কাছে কিছু মানে কি না, সেটা চাষের প্রশ্ন, পরিসংখ্যানের নয়।
Heteroskedasticity, আর HC1 কী করে
ওপরের সাধারণ স্ট্যান্ডার্ড এরর বৃষ্টির সব মাত্রায় গোলমালের ছড়ানোর জন্য একটাই সংখ্যা ধরেছে, ৪.২। ধরুন বড় আর ভেজা খামারগুলোই বেশি খামখেয়ালি। তাহলে ছড়ানো বেশি ঠিক সেখানে যেখানে বৃষ্টির ফারাক সবচেয়ে বড়, মানে যে বিন্দুগুলো ঢালকে সবচেয়ে জোরে টানে, আর সাধারণ স্ট্যান্ডার্ড এরর হয় খুব ছোট: ঢাল যতটা নিশ্চিত বলছে, ততটা নয়।
HC1 (heteroskedasticity-consistent, ছোট নমুনার প্রথম সংশোধনসহ) একটা ছড়ানো ধরে নেয় না। প্রতিটি খামারের নিজের ফারাকের বর্গ নেয়, সেই খামারের বৃষ্টির ফারাকের বর্গ দিয়ে ওজন দেয়, যোগ করে, বৃষ্টির ফারাকের বর্গের যোগের বর্গ দিয়ে ভাগ করে, আর ছোট নমুনা পুষিয়ে নিতে n ভাগ n বিয়োগ k দিয়ে গুণ করে। ছয় খামারে: ওজন দেওয়া বর্গগুলো ২,৫০০, ৪,৩৫৬, ২৫৬, ২৫৬, ৪,৩৫৬ আর ২,৫০০, যোগ ১৪,২২৪। ৬ ভাগ ৪ দিয়ে গুণ করলে ২১,৩৩৬। ৭,০০০-এর বর্গ ৪,৯০,০০,০০০ দিয়ে ভাগ করে বর্গমূল: ০.০২০৯। t হয় ২.৮৭।
ঢাল এখনও ০.০৬। তা-ই হওয়ার কথা: লিস্ট স্কোয়ার ফারাক ছোট করে ঢাল বেছেছিল, ফারাক কীভাবে ছড়ানো তা দেখেইনি। রোবাস্ট ত্রুটি নতুন করে আন্দাজ করে আপনি কতটা নিশ্চিত হতে পারেন, কী পেয়েছেন তা নয়। ছয়টা খামার এত কম যে রোবাস্ট সংখ্যাটার নিজের মানে সামান্য; আসল কথা, কোন সংখ্যাটা নড়ল।
ক্লাস্টার করা ত্রুটি
ছয় গ্রামের ষাটটা খামার বৃষ্টি নিয়ে ষাটটা স্বাধীন তথ্য নয়। এক গ্রামের খামারগুলো একই আবহাওয়া, একই মাটি, একই কৃষি কর্মকর্তা ভাগ করে নেয়, তাই তাদের ফারাকগুলো একসঙ্গে নড়ে, আর চতুর্থ অনুমান গোড়া থেকেই ভাঙে। ক্লাস্টার-রোবাস্ট ত্রুটি গ্রামের ভেতরে ফারাকগুলোকে যেমন খুশি জড়াতে দেয়, আর গ্রামে গ্রামে কিছু ধরে না। ক্লাস্টার করুন সেই স্তরে যেখানে ধাক্কা বা কর্মসূচিটা বদলায়: গ্রামভিত্তিক কর্মসূচি হলে গ্রাম ধরে ক্লাস্টার, ফলাফল খামার ধরে মাপা হলেও।
কটা ক্লাস্টার
পদ্ধতিটা অনেক ক্লাস্টার চায়, মোটামুটি হিসেবে তিরিশ থেকে পঞ্চাশ। ছয়টা গ্রামে কোনো সংশোধনই সৎ নয়। ক্লাস্টার করা ত্রুটি দিয়ে বিষয়টা মিটে গেছে এমন ভাব না করে, লেখায় কথাটা বলুন।
কোথায় ভুল হয়
- একক ছাড়া ঢাল লেখা, তাই ০.০৬ বেশি না কম কেউ বলতে পারে না।
- বড় t-কে বড় প্রভাব ভেবে নেওয়া।
- দ্বিতীয় অনুমান ভেঙে পক্ষপাতী হওয়া ঢাল বাঁচাতে রোবাস্ট ত্রুটির দিকে হাত বাড়ানো। তা পারে না।
- কর্মসূচি গ্রাম ধরে দেওয়া হলেও খামার ধরে ক্লাস্টার করা।
- বিশটা নমুনায় HC1 ত্রুটি এমনভাবে লেখা যেন নিখুঁত।
যাচাই তালিকা
- প্রতিটি সহগ যে বাক্যে লেখা হয়েছে, তাতে তার একক বলা আছে।
- রেখা টানার আগে বিন্দুর ছবিটা দেখা হয়েছে।
- গোলমালের ভেতরে কী থাকতে পারে যা বৃষ্টিকেও নাড়ায়, তা নিয়ে কিছু বলা হয়েছে।
- অসমান ছড়ানোর পরীক্ষা চালানো হয়েছে, নয়তো রোবাস্ট ত্রুটিই লেখা হয়েছে।
- পর্যবেক্ষণ কোনো দল ভাগ করলে সেই দল ধরে ক্লাস্টার, আর ক্লাস্টারের সংখ্যা লেখা।
- প্রভাবের মাপ আর t দুটো আলাদা জিনিস হিসেবে লেখা।
ল্যাব পদ্ধতির তালিকা থেকে সাধারণ, HC1 বা ক্লাস্টার করা ত্রুটিসহ OLS চালায় আর APA টেবিল লিখে দেয়; কর্মশালার "কোন পরীক্ষা" যন্ত্র জিজ্ঞেস করে আপনার প্রশ্নের জন্য রিগ্রেশনই দরকার কি না, আর তার নমুনার মাপের যন্ত্র বলে এই মাপের ঢাল সীমা পার করতে কটা খামার লাগত।