fbpx
blog

O regresji i Metodzie Najmniejszych Kwadratów, czyli skąd wzięły się oszacowania parametrów modelu

Joanna Grochowska

Kierownik Działu Nauczania eTrapez.
Absolwentka matematyki finansowej oraz informatyki i ekonometrii na Uniwersytecie w Białymstoku. Doświadczony korepetytor w zakresie przedmiotów matematycznych i ekonomicznych.
Mieszka w Białymstoku. Uwielbia podróżować i chodzić po górach. Wolny czas przeznacza na spotkania z rodziną i z przyjaciółmi. Lubi eksperymenty w kuchni oraz siatkówkę.


Ekonometria Wykład 6

Temat: Analiza regresji. Szacowanie parametrów modelu
Metodą Najmniejszych Kwadratów.

 

W tym Wykładzie przedstawię Ci na czym polega regresja liniowa oraz jak dokładnie działa Metoda Najmniejszych Kwadratów. Dowiesz się zatem skąd wzięły się wzorki na oszacowania parametrów strukturalnych  a modelu ekonometrycznego.

Zapraszam!

 

Główny cel ekonometrii to zbadanie i wyjaśnienie zachowania jednej zmiennej ekonomicznej w zależności od zachowania innych zmiennych. Oczywiście muszą być one ze sobą w jakiś sposób powiązane. Np.: czy i w jaki sposób wydatki rodziny zależą od jej dochodu?; – czy wzrost wydatków na żywność jest szybszy, czy wolniejszy w zależności od wzrostu dochodu?

W jednym z poprzednich Wykładów przedstawiłam temat o zależności statystycznej, jaką jest korelacja. Jak pamiętamy, pojęcie korelacji dotyczy SIŁY i KIERUNKU badanej współzależności.

Oprócz analizy korelacji, można dokonać jeszcze innego typu analizy – tzw. REGRESJI. Jest ona działem statystyki zajmującej się badaniem związków i zależności pomiędzy rozkładami dwu lub więcej badanych cech w populacji generalnej.

Termin regresja dotyczy jednak KSZTAŁTU zależności pomiędzy cechami. Dzieli się na analizę regresji liniowej i nieliniowej.

Wykresem regresji liniowej dwóch zmiennych, jak sama nazwa wskazuje, będzie prosta. W przypadku analizy regresji nieliniowej, graficzną reprezentacją współzależności są krzywe wyższego rzędu np. parabola.

Wystarczy spojrzeć na poniższe chmury punktów. na ich podstawie można stwierdzić, że im wartości współczynnika korelacji są bliższe 1 (w module), tym bardziej punkty na wykresie układają się w sposób liniowy. W trzecim wierszu zaprezentowano przykłady wykresów nieliniowych.

 

Źródło: https://pl.wikipedia.org/wiki/Zależność_zmiennych_losowych, dn. 12.06.2018 r.

 

Analiza regresji i korelacji może dotyczyć nie tylko dwóch, ale również i większej ilości zmiennych. Mówimy wtedy o tzw. analizie wielorakiej.

Przejdę teraz do omówienia zarówno jednego, jak i drugiego przypadku regresji liniowej.

 

 

Regresja liniowa – wstępne informacje

Nazwa regresja liniowa wywodzi się od tego, że zakładanym modelem zależności między zmiennymi zależnymi a niezależnymi jest funkcja liniowa bądź przekształcenie liniowe.

Prostą, którą wyznacza równanie modelu liniowego jest prosta regresji, zaś model – modelem regresji liniowej. O prostej regresji można mówić jedynie w przypadku modelu ze stałą i jedną zmienną objaśniającą. W przypadku wielowymiarowym, czyli regresji wielorakiej, mówimy o hiperpłaszczyźnie regresji.

Zanim pojawią się bardziej szczegółowe wykresy, warto przypomnieć ogólną postać modelu ekonometrycznego:

Y space equals space alpha subscript 0 space plus space alpha subscript 1 X subscript 1 space plus space alpha subscript 2 X subscript 2 space plus space... space plus space alpha subscript k X subscript k space plus space epsilon

Uwzględniając realizacje zmiennych często zapisuje się go następująco:

y subscript t space equals space alpha subscript 0 space plus space alpha subscript 1 x subscript 1 t end subscript space plus space alpha subscript 2 x subscript 2 t end subscript space plus space... space plus space alpha subscript k x subscript k t end subscript space plus space epsilon subscript t

przy czym:

Y space semicolon space y subscript t – zmienna objaśniana, zależna, endogeniczna; realizacje zmiennej objaśnianej w okresie t,

X subscript k space semicolon space x subscript k t end subscript – zmienne objaśniające, niezależne; realizacje zmiennych objaśniających w okresie t,

epsilon – składnik losowy (więcej o nim poczytasz w artykule),

space t – kolejne realizacje (obserwacje), t space element of space 1 comma... comma n .

 

Interesująca jest sama geneza terminu regresja.

W mowie potocznej regresja oznacza: cofanie się, spadek, zanik. Możesz zatem się zastanawiać, skąd wzięło się ono w statystyce?

Termin ten jako pierwszy użył Francis Galton, zięć Karola Darwina. W 1886 roku badał on związek pomiędzy wzrostem rodziców i ich dzieci. Zauważył, że wysocy rodzice mają też średnio wysokie dzieci. Jednakże wzrost dzieci ponadprzeciętnie wysokich rodziców jest bliższy średniej, niż wzrostowi ich rodziców. Taką tendencję powrotu do średniej Galton określił jako: “regresję do średniactwa”. Jego wioski można więc zapisać za pomocą następującego modelu liniowego:

w z r o s t space d z i e c i space equals space alpha subscript 0 space plus space alpha subscript 1 times w z r o s t space r o d z i c ó w space plus space epsilon subscript t

gdzie wartość parametru stojącego przy zmiennej objaśniającej zawiera się pomiędzy  0 space less than space alpha subscript 1 space less than space 1.  Wynika stąd, że centymetr wzrostu rodziców przekłada się na mniej niż jeden centymetr wzrostu dzieci.

Zmienna objaśniana i zmienne objaśniające w modelu regresji nie są symetryczne. Galton w swoich badaniach nie tylko zakładał to, że wzrost rodziców ma wpływ na wzrost dzieci, ale i to, że odwrotnie skutek ten nie działa, tzn. wzrost rodziców nie zależy od wzrostu dzieci.

Należy zatem zauważyć, że w teorii ekonomii bardzo ważnym jest znajomość kierunku związku przyczynowo-skutkowego.

 

 

Regresja liniowa prosta

Regresja liniowa prosta dotyczy przypadku dwóch zmiennych – objaśnianej i jednej objaśniającej X.

Prostą można opisać znanym Ci (jeszcze z gimnazjum) wzorem: Y space equals space a X plus b. Ten zapis jest najprostszy. Jeśli zatem wiemy już co oznaczają literki X, to pozostałe dwie oznaczają:

a – parametr stojący przy zmiennej, jest to współczynnik kierunkowy regresji, tangens kąta gamma nachylenia prostej do osi OX,

b – wyraz wolny (stała), współrzędna punktu przecięcia z osią OY.

Większość z osób zapewne pamięta, jak w szkole średniej czy gimnazjum znajdywało się prostą przechodzącą przez dwa punkty A space open parentheses x subscript A comma y subscript A close parentheses oraz B space open parentheses x subscript B comma y subscript B close parentheses. Oczywiście był na to konkretny wzór, dostępny np w tablicach maturalnych: open parentheses y minus y subscript A close parentheses open parentheses x subscript B minus x subscript A close parentheses minus open parentheses y subscript B minus y subscript A close parentheses open parentheses x minus x subscript A close parentheses equals 0. Równie dobrze wystarczyło rozwiązać układ równań dwóch prostych, podstawiając za XY współrzędne punktów, typu open curly brackets table attributes columnalign left end attributes row cell y subscript A space equals space a times x subscript A plus b end cell row cell y subscript B space equals space a times x subscript B plus b end cell end table close i z tego wyliczyć nieznane wartości parametrów a i b.

Warto pamiętać, że w ekonometrii NIE mamy jednak do czynienia ze związkiem funkcyjnym (zwanym często deterministycznym), czyli takim, w którym każdej wartości x subscript i odpowiada jedna i tylko jedna wartość y subscript i.

W ekonometrii bada się związki stochastyczne (losowe, probabilistyczne) pomiędzy zmiennymi XY. W tym przypadku KAŻDEJ wartości x subscript i odpowiada cały zbiór wartości y subscript i tworzących określony rozkład. Stąd typowe równanie linii regresji prostej jest następujące:

Y space equals space alpha subscript 0 space plus space alpha subscript 1 X space plus space epsilon

Sytuację taką można zobrazować następująco:

Jeżeli rozkład ten jest rozkładem normalnym (jeden z typów rozkładów statystycznych zmiennych losowych), to zależność Y(X) jest liniowa.

 

Przejdźmy zatem do meritum. Otóż narysowanie prostej przechodzącej przez dwa punkty wydaje się sprawą łatwą. Niemniej jednak, w przypadku wielu punktów nie pójdzie już tak łatwo. Praktycznie nigdy nie zdarzy się sytuacja, kiedy prosta przeszłaby przez każdy z zaznaczonych na wykresie elementów.

W tym przypadku, należy wybrać taką metodę, która pozwoli znaleźć najbardziej optymalną prostą. Powinna ona być odpowiednio “dopasowana”, tj. być narysowana tak, aby jak najlepiej zobrazować zależność pomiędzy XY.

Taką prostą (czyli równanie regresji, w postaci TEORETYCZNEJ) zapisuje się jako:

Y with hat on top space equals space a subscript 0 space plus space a subscript 1 X space

Uwzględniając konkretne realizacje zmiennych, w kolejnych okresach t, można ją również zapisać:

y with hat on top subscript t space equals space a subscript 0 space plus space a subscript 1 x subscript t space

W tym przypadku, a subscript 0 – jest to estymator, czyli oszacowana wartość wyrazu wolnego. Natomiast a subscript 1 reprezentuje oszacowaną wartość współczynnika regresji. Określa ona wpływ zmiennej na zmienną Y.

 

Pytanie brzmi – jak wyrazić liczbowo wartości parametrów a subscript 0 oraz a subscript 1?  Będę miła do narysowania prostą np. y with hat on top subscript t space equals space 2 comma 8 space plus space 4 x subscript t space, czy też prostą o lekko innym nachyleniu, np. y with hat on top subscript t space equals space 2 comma 52 space plus space 4 comma 6 x subscript t space ?

W dalszej części wykładu postaram się wyjaśnić matematycznie sposób wyprowadzenia wzorów na najlepsze oszacowania wartości  a subscript 0 oraz a subscript 1 , a także pozostałe parametry  a subscript 2 comma space a subscript 3 space comma space... space comma space a subscript k dla przypadku modelu z wieloma zmiennymi objaśniającymi.

 

 

Estymacja parametrów modelu ekonometrycznego Metodą Najmniejszych Kwadratów – przypadek z jedną zmienną objaśniającą.

Metod oszacowania parametrów modelu jest bardzo dużo. Być może słyszałeś już o metodzie największej wiarygodności, metodzie regresji medianowej czy metodzie dwupunktowej. Niemniej jednak, spośród tych wszystkich metod najpopularniejsza jest Metoda Najmniejszych Kwadratów (w skrócie MNK).

Wymaga ona pewnych założeń, które omówię dokładniej w kolejnym wykładzie.  Do najważniejszych z nich należą własności składnika losowego epsilon subscript t w modelu y subscript t space equals space alpha space plus space beta x subscript t space plus space epsilon subscript t :

  • wartość oczekiwana składnika losowego jest równa zero for all for t of space E open parentheses epsilon subscript t close parentheses equals 0;
  • składnik losowy ma stałą skończoną wariancję  for all for t of space D squared open parentheses epsilon subscript t close parentheses equals sigma squared;
  • nie występuje zjawisko autokorelacji składnika losowego, czyli zależności składnika losowego w różnych jednostkach czasu  for all for t not equal to s of space c o v open parentheses epsilon subscript t comma epsilon subscript s space close parentheses equals 0.

 

W ramach ścisłości oznaczeń, w powyższym artykule oraz w całym moim Kursie używam następujących oznaczeń (literek):  a subscript 0 oraz a subscript 1. Są to estymatory metody najmniejszych kwadratów parametrów alpha subscript 0 oraz alpha subscript 1 z modelu postaci:  y subscript t space equals space alpha subscript 0 space plus space alpha subscript 1 x subscript t space plus space epsilon.

Na swoich zajęciach być może używałeś modelu postaci ogólnej takiej:  y subscript t space equals space alpha space plus space beta x subscript t space plus space epsilon subscript t . Zatem szukaliście oszacowań parametrów modelu w postaci teoretycznej: y with hat on top subscript t space equals space a space plus space b x subscript t .

W literaturze czy na zajęciach, można niejednokrotnie spotkać również i odwrotne oznaczenia modelu: y subscript t space equals space beta space plus space alpha x subscript t space plus space epsilon subscript t , stąd równanie teoretyczne prostej będzie miało postać: y with hat on top subscript t space equals space b space plus space a x subscript t.

Najważniejsze jednak jest to, aby zrozumieć, która literka w równaniu oznacza wyraz wolny, a która współczynnik kierunkowy (stojący przy zmiennej X).

 

W tym miejscu, powróć na chwilę do zamieszczonego wcześniej wykresu. Tak jak wspominałam, poprowadzona czerwona linia nie pokrywa idealnie wszystkich niebieskich punktów. Niektóre z nich leżą poniżej, niektóre powyżej prostej.

Model ekonometryczny będzie tym lepiej dopasowany, im mniejsza będzie odległość wartości teoretycznych y with hat on top subscript t od wartości zaobserwowanych y subscript t.

Każdy z tych pionowych (bordowych) słupków reprezentuje różnice pomiędzy wartościami rzeczywistymi zmiennej y subscript t a wartościami teoretycznymi y with hat on top subscript t wyliczonymi z linii regresji. Są to tzw. reszty modelu. Oznaczamy je jako:

e subscript t space equals space y subscript t minus y with hat on top subscript t

Relację między resztami, obserwacjami i oszacowaniami parametrów, można zapisać następująco:

space y subscript t space equals space y with hat on top subscript t plus e subscript t space equals space a subscript 0 plus a subscript 1 x subscript t plus e subscript t

Z tego wynika, że reszty e subscript t stanowią oszacowania elementów losowych epsilon subscript t z modelu y subscript t space equals space alpha subscript 0 space plus space alpha subscript 1 x subscript t space plus space epsilon subscript t, ale nie są im równe!

Niektóre różnice pomiędzy wartościami rzeczywistymi, a teoretycznymi, są powyżej osi, a zatem będą miały wartość dodatnią. Inne są pod osią, stąd będą miały wynik ujemny. Jeśli więc dążymy do tego, aby te odcinki były JAK NAJMNIEJSZE, nie ma sensu dodawać samych różnic e subscript 1 plus e subscript 2 plus... plus e subscript n. W takim przypadku wynik nie byłby miarodajny. Dopasowanie będzie tym lepsze, im mniejsze są wartości bezwzględne tych odchyleń.

 

Przykład 1

W pewnym modelu różnice pomiędzy wartościami teoretycznymi, a rzeczywistymi wynoszą: 3 comma space 4 comma space minus 1 comma space 0 comma space minus 5 comma space minus 4 comma space 2 comma space minus 3.  Są to odległości pomiędzy dwoma punktami. Można je porównać np. do temperatury na termometrze i odległości od zera – raz jest dodatnia, raz ujemna. Lub też do zrobionych kroków do przodu (te na plusie) i do tyłu (te na minusie).

Jeśli potrzebujesz policzyć całościową różnicę, czyli łączne dodanie wszystkich odległości, to zwykła suma liczb nie będzie miarodajna:  3 space plus space 4 space plus space left parenthesis negative 1 right parenthesis space plus space 0 space plus space left parenthesis negative 5 right parenthesis space plus space left parenthesis negative 4 right parenthesis space plus space 2 space plus space left parenthesis negative 3 right parenthesis equals bold minus bold 4.  Wiele liczb się po prostu skróciło. Nie zrobiłeś przecież tylko czterech kroków do tyłu. Dlatego do sumy wykorzystać należy wartość bezwzględną danej liczby, czyli jej odległość na osi od zera. To jakbyś policzył kroki – te do przodu i te do tyłu, ale łącznie. 

open vertical bar 3 close vertical bar space plus open vertical bar space 4 close vertical bar space plus space open vertical bar negative 1 close vertical bar space plus space open vertical bar 0 close vertical bar space plus space open vertical bar negative 5 close vertical bar space plus space open vertical bar negative 4 close vertical bar space plus space open vertical bar 2 close vertical bar space plus space open vertical bar negative 3 close vertical bar equals bold 22Teraz się wszystko zgadza 🙂

 

 

Kryterium, które należy zminimalizować, aby uzyskać najlepsze dopasowanie, jest sumą wszystkich reszt co do wartości bezwzględnej:

sum from t equals 1 to n of space open vertical bar y subscript t minus y with hat on top subscript t close vertical bar space equals sum from t equals 1 to n of space open vertical bar e subscript t close vertical bar

Aby znaleźć wartości najmniejsze, czyli tzw. ekstrema lokalne funkcji wielu zmiennych potrzebne są pochodne (więcej na ich temat odnajdziesz w Kursach Pana Krystiana).

Funkcja ta jest jednak kłopotliwa w użyciu, ponieważ dla modułu nie istnieje pochodna funkcji w zerze. W rezultacie nie da się zminimalizować sumy  sum from t equals 1 to n of space open vertical bar e subscript t close vertical bar  standardowymi metodami analitycznymi.

Z pomocą przychodzi Metoda Najmniejszych Kwadratów. Jak sama nazwa wskazuje, pozwala ona szukać minimum dla sumy kwadratów różnic wartości obserwowanych i wartości teoretycznych (obliczonych z równania modelu).

sum from t equals 1 to n of space open parentheses y subscript t minus y with hat on top subscript t space close parentheses squared equals sum from t equals 1 to n of space open parentheses e subscript t close parentheses squared space rightwards arrow space m i n

Podstawiając równanie teoretyczne modelu otrzymuję:

sum from t equals 1 to n of space open parentheses y subscript t minus open parentheses a subscript 0 plus a subscript 1 x subscript t close parentheses close parentheses squared equals sum from t equals 1 to n of space open parentheses y subscript t minus a subscript 0 minus a subscript 1 x subscript t close parentheses squared space equals S open parentheses a subscript 0 comma space a subscript 1 close parentheses space rightwards arrow space m i n

Należy teraz znaleźć minimum funkcji sumy S open parentheses a subscript 0 comma a subscript 1 close parentheses. Czyli dobrać tak oszacowania a subscript 0 space i space a subscript 1 , aby suma ta była jak najmniejsza.

Posługując się analizą matematyczną, można znaleźć ekstremum funkcji. Wystarczy tutaj obliczyć pochodne cząstkowe funkcji względem parametrów i przyrównać je do zera. W przypadku funkcji S open parentheses a subscript 0 comma a subscript 1 close parentheses warunki te można zapisać jako układ równań:

open curly brackets table attributes columnalign left end attributes row cell fraction numerator partial differential S open parentheses a subscript 0 comma a subscript 1 close parentheses over denominator partial differential a subscript 0 end fraction equals 0 end cell row cell fraction numerator begin display style partial differential S open parentheses a subscript 0 comma a subscript 1 close parentheses end style over denominator begin display style partial differential a subscript 1 end style end fraction equals 0 end cell end table close

Do policzenia pochodnych cząstkowych, można oczywiście rozpisać wyrażenie w nawiasie podniesione do kwadratu, czyli:

S open parentheses a subscript 0 comma space a subscript 1 close parentheses equals sum from t equals 1 to n of space open parentheses y subscript t minus a subscript 0 minus a subscript 1 x subscript t close parentheses squared space equals sum from t equals 1 to n of space open parentheses y subscript t minus a subscript 0 minus a subscript 1 x subscript t close parentheses times open parentheses y subscript t minus a subscript 0 minus a subscript 1 x subscript t close parentheses equals equals sum from t equals 1 to n of space open parentheses y subscript t superscript 2 minus 2 y subscript t a subscript 0 minus 2 y subscript t a subscript 1 x subscript t plus 2 a subscript 0 a subscript 1 x subscript t plus a subscript 0 superscript 2 plus a subscript 1 superscript 2 x subscript t superscript 2 close parentheses

Licząc pochodne cząstkowe i wykorzystując przy tym podstawowe wzory z pochodnych, czyli  open parentheses a times f left parenthesis x right parenthesis close parentheses apostrophe space equals space a times open parentheses f left parenthesis x right parenthesis close parentheses apostrophe space,  open parentheses x to the power of n close parentheses apostrophe space equals space n times x to the power of n minus 1 end exponent,  open parentheses x close parentheses apostrophe equals 1 oraz open parentheses s t a ł a close parentheses apostrophe equals 0 otrzymam:

fraction numerator partial differential S open parentheses a subscript 0 comma a subscript 1 close parentheses over denominator partial differential a subscript 0 end fraction equals sum from t equals 1 to n of space open parentheses y subscript t superscript 2 minus 2 y subscript t a subscript 0 minus 2 y subscript t a subscript 1 x subscript t plus 2 a subscript 0 a subscript 1 x subscript t plus a subscript 0 superscript 2 plus a subscript 1 superscript 2 x subscript t superscript 2 close parentheses apostrophe equals sum from t equals 1 to n of space open parentheses 0 minus 2 y subscript t times 1 minus 0 plus 2 a subscript 1 x subscript t times 1 plus 2 a subscript 0 superscript blank plus 0 close parentheses apostrophe equals equals sum from t equals 1 to n of space open parentheses negative 2 y subscript t plus 2 a subscript 1 x subscript t plus 2 a subscript 0 close parentheses space equals space sum from t equals 1 to n of space open parentheses negative 2 y subscript t close parentheses plus sum from t equals 1 to n of space open parentheses 2 a subscript 1 x subscript t close parentheses plus sum from t equals 1 to n of space open parentheses 2 a subscript 0 close parentheses equals bold 2 open square brackets bold minus bold sum from bold t bold equals bold 1 to bold n of bold y subscript bold t bold plus bold a subscript bold 1 bold sum from bold t bold equals bold 1 to bold n of bold x subscript bold t bold plus bold n bold times bold a subscript bold 0 close square brackets

fraction numerator partial differential S open parentheses a subscript 0 comma a subscript 1 close parentheses over denominator partial differential a subscript 1 end fraction equals sum from t equals 1 to n of space open parentheses y subscript t superscript 2 minus 2 y subscript t a subscript 0 minus 2 y subscript t a subscript 1 x subscript t plus 2 a subscript 0 a subscript 1 x subscript t plus a subscript 0 superscript 2 plus a subscript 1 superscript 2 x subscript t superscript 2 close parentheses apostrophe equals sum from t equals 1 to n of space open parentheses 0 minus 0 minus 2 y subscript t x subscript t times 1 plus 2 a subscript 0 x subscript t times 1 plus 0 plus 2 times a subscript 1 superscript blank x subscript t superscript 2 close parentheses apostrophe equals equals sum from t equals 1 to n of space open parentheses negative 2 y subscript t x subscript t plus 2 a subscript 0 x subscript t plus 2 times a subscript 1 x subscript t superscript 2 close parentheses space equals space sum from t equals 1 to n of space open parentheses negative 2 y subscript t x subscript t close parentheses plus sum from t equals 1 to n of space open parentheses 2 a subscript 0 x subscript t close parentheses plus sum from t equals 1 to n of space open parentheses 2 a subscript 1 x subscript t superscript 2 close parentheses equals bold 2 open square brackets bold minus bold sum from bold t bold equals bold 1 to bold n of bold y subscript bold t bold x subscript bold t bold plus bold a subscript 0 bold sum from bold t bold equals bold 1 to bold n of bold x subscript bold t bold plus bold italic a subscript bold 1 bold sum from bold t bold equals bold 1 to bold n of bold space bold italic x subscript bold t superscript bold 2 close square brackets

Porównując obliczone pochodne do zera mam dalej:

open curly brackets table attributes columnalign left end attributes row cell bold 2 open square brackets bold minus bold sum from bold t bold equals bold 1 to bold n of bold y subscript bold t bold plus bold a subscript bold 1 bold sum from bold t bold equals bold 1 to bold n of bold x subscript bold t bold plus bold n bold times bold a subscript bold 0 close square brackets equals 0 space space space space space space space space space space space space space space space space space divided by colon 2 end cell row cell bold 2 open square brackets bold minus bold sum from bold t bold equals bold 1 to bold n of bold y subscript bold t bold x subscript bold t bold plus bold a subscript 0 bold sum from bold t bold equals bold 1 to bold n of bold x subscript bold t bold plus bold italic a subscript bold 1 bold sum from bold t bold equals bold 1 to bold n of bold space bold italic x subscript bold t superscript bold 2 close square brackets equals 0 space space space space space space divided by colon 2 end cell end table close

open curly brackets table attributes columnalign left end attributes row cell negative sum from straight t equals 1 to straight n of straight y subscript straight t plus straight a subscript 1 sum from straight t equals 1 to straight n of straight x subscript straight t plus straight n times straight a subscript 0 equals 0 end cell row cell negative sum from straight t equals 1 to straight n of straight y subscript straight t straight x subscript straight t plus straight a subscript 0 sum from straight t equals 1 to straight n of straight x subscript straight t plus a subscript 1 sum from straight t equals 1 to straight n of space x subscript straight t superscript 2 equals 0 end cell end table close

open curly brackets table attributes columnalign left end attributes row cell straight n times straight a subscript 0 plus straight a subscript 1 sum from straight t equals 1 to straight n of straight x subscript straight t equals sum from straight t equals 1 to straight n of straight y subscript straight t end cell row cell straight a subscript 0 sum from straight t equals 1 to straight n of straight x subscript straight t plus a subscript 1 sum from straight t equals 1 to straight n of space x subscript straight t superscript 2 equals sum from straight t equals 1 to straight n of straight y subscript straight t straight x subscript straight t end cell end table close space space space space space space space space space left parenthesis 1 right parenthesis

Naszym zadaniem jest rozwiązać powyższy układ równań i wyliczyć z niego wartości  a subscript 0 oraz a subscript 1.

Zastosuję tu metodę przeciwnych współczynników

open curly brackets table attributes columnalign left end attributes row cell straight n times straight a subscript 0 plus straight a subscript 1 sum from straight t equals 1 to straight n of straight x subscript straight t equals sum from straight t equals 1 to straight n of straight y subscript straight t space space space space space space space space space space space space space space space divided by space times open parentheses negative sum from straight t equals 1 to straight n of straight x subscript straight t close parentheses end cell row cell straight a subscript 0 sum from straight t equals 1 to straight n of straight x subscript straight t plus a subscript 1 sum from straight t equals 1 to straight n of space x subscript straight t superscript 2 equals sum from straight t equals 1 to straight n of straight y subscript straight t straight x subscript straight t space space space space space divided by times straight n end cell end table close open curly brackets table attributes columnalign left end attributes row cell negative straight n space straight a subscript 0 sum from straight t equals 1 to straight n of straight x subscript straight t minus straight a subscript 1 open parentheses sum from straight t equals 1 to straight n of straight x subscript straight t close parentheses squared equals negative sum from straight t equals 1 to straight n of straight x subscript straight t space sum from straight t equals 1 to straight n of straight y subscript straight t space end cell row cell straight n space straight a subscript 0 sum from straight t equals 1 to straight n of straight x subscript straight t plus n space a subscript 1 sum from straight t equals 1 to straight n of space x subscript straight t superscript 2 equals n sum from straight t equals 1 to straight n of straight y subscript straight t straight x subscript straight t space space end cell end table close

Dodając oba równania do siebie, wychodzi:

n space a subscript 1 sum from straight t equals 1 to straight n of space x subscript straight t superscript 2 minus straight a subscript 1 open parentheses sum from straight t equals 1 to straight n of straight x subscript straight t close parentheses squared equals straight n sum from straight t equals 1 to straight n of straight y subscript straight t straight x subscript straight t space space minus sum from straight t equals 1 to straight n of straight x subscript straight t space sum from straight t equals 1 to straight n of straight y subscript straight t space

Stąd wyliczymy wartość estymatora a subscript 1:

a subscript 1 open square brackets straight n space sum from straight t equals 1 to straight n of space straight x subscript straight t superscript 2 minus open parentheses sum from straight t equals 1 to straight n of straight x subscript straight t close parentheses squared close square brackets equals straight n sum from straight t equals 1 to straight n of straight y subscript straight t straight x subscript straight t space space minus sum from straight t equals 1 to straight n of straight x subscript straight t space sum from straight t equals 1 to straight n of straight y subscript straight t space

a subscript 1 equals fraction numerator straight n sum from straight t equals 1 to straight n of straight y subscript straight t straight x subscript straight t space space minus sum from straight t equals 1 to straight n of straight x subscript straight t space sum from straight t equals 1 to straight n of straight y subscript straight t space over denominator straight n space sum from straight t equals 1 to straight n of space straight x subscript straight t superscript 2 minus open parentheses sum from straight t equals 1 to straight n of straight x subscript straight t close parentheses squared end fraction

Po małych przekształceniach, ostatecznie wychodzi (dla czytelności nie będę pisała indeksów sumy):

a subscript 1 equals fraction numerator straight n sum for blank of straight y subscript straight t straight x subscript straight t space space minus sum straight x subscript straight t space sum straight y subscript straight t space over denominator straight n space sum straight x subscript straight t superscript 2 minus open parentheses sum straight x subscript straight t close parentheses squared end fraction equals fraction numerator straight n sum for blank of straight y subscript straight t straight x subscript straight t space space minus n squared times begin display style 1 over n squared end style sum straight x subscript straight t space sum straight y subscript straight t space over denominator straight n space sum straight x subscript straight t superscript 2 minus n squared times 1 over n squared open parentheses sum straight x subscript straight t close parentheses squared end fraction equals fraction numerator straight n sum for blank of straight y subscript straight t straight x subscript straight t space space minus n squared times begin display style fraction numerator sum straight x subscript straight t over denominator straight n end fraction end style space begin display style fraction numerator sum straight y subscript straight t over denominator straight n end fraction end style space over denominator straight n space sum straight x subscript straight t superscript 2 minus n squared times open parentheses 1 over n sum straight x subscript straight t close parentheses squared end fraction equals fraction numerator straight n open parentheses sum for blank of straight y subscript straight t straight x subscript straight t space space minus n space x with bar on top space y with bar on top space close parentheses over denominator straight n space open parentheses sum straight x subscript straight t superscript 2 minus n space open parentheses straight x with bar on top close parentheses squared close parentheses end fraction
bold italic a subscript bold 1 bold equals fraction numerator bold sum bold y subscript bold t bold x subscript bold t bold space bold space bold minus bold n bold space bold x with bold bar on top bold space bold y with bold bar on top bold space over denominator bold sum bold x subscript bold t superscript bold 2 bold minus bold n bold space open parentheses bold x with bold bar on top close parentheses to the power of bold 2 end fraction

Zostało jeszcze oszacować parametr a subscript 0. W tym celu wykorzystam pierwsze równanie z układu równań (1).

open curly brackets table attributes columnalign left end attributes row cell straight n times straight a subscript 0 plus straight a subscript 1 begin inline style sum for blank of end style straight x subscript straight t equals begin inline style sum for blank of end style straight y subscript straight t space space space space end cell row cell straight a subscript 1 equals fraction numerator sum straight y subscript straight t straight x subscript straight t space space minus straight n space straight x with bar on top space straight y with bar on top space over denominator sum straight x subscript straight t superscript 2 minus straight n space open parentheses straight x with bar on top close parentheses squared end fraction end cell end table close

straight n times straight a subscript 0 equals begin inline style sum for blank of end style straight y subscript straight t minus straight a subscript 1 begin inline style sum for blank of end style straight x subscript straight t space space space space space divided by space colon straight nstraight a subscript 0 equals fraction numerator sum for blank of straight y subscript straight t over denominator straight n end fraction minus fraction numerator straight a subscript 1 sum for blank of straight x subscript straight t over denominator straight n end fraction

Stąd ostateczne:

open curly brackets table attributes columnalign left end attributes row cell bold a subscript bold 0 bold equals bold y with bold bar on top bold minus bold a subscript bold 1 bold x with bold bar on top end cell row cell bold a subscript bold 1 bold equals fraction numerator bold sum bold y subscript bold t bold x subscript bold t bold space bold space bold minus bold n bold space bold x with bold bar on top bold space bold y with bold bar on top bold space over denominator bold sum bold x subscript bold t superscript bold 2 bold minus bold n bold space open parentheses bold x with bold bar on top close parentheses to the power of bold 2 end fraction end cell end table close

gdzie  top enclose x space equals space fraction numerator sum for blank of x subscript t over denominator n end fraction oraz   top enclose y space equals space fraction numerator sum for blank of y subscript t over denominator n end fraction są średnimi arytmetycznymi odpowiednio zmiennych X oraz Y.

Po pewnych przekształceniach można również stosować inną wersję wzoru na wartość parametru a subscript 1 stojącego przy X. Obie są poprawne i obie można śmiało zamiennie wykorzystywać.

  open curly brackets table attributes columnalign left end attributes row cell bold a subscript bold 0 bold equals bold y with bold bar on top bold minus bold a subscript bold 1 bold x with bold bar on top end cell row cell bold a subscript bold 1 bold equals fraction numerator bold sum open parentheses bold x subscript bold t bold minus bold x with bold bar on top close parentheses open parentheses bold y subscript bold t bold minus bold space bold y with bold bar on top close parentheses bold space over denominator bold sum open parentheses bold x subscript bold t bold minus bold x with bold bar on top close parentheses to the power of bold 2 end fraction end cell end table close

W ten oto sposób wyprowadza się wzory na oszacowania estymatorów parametrów strukturalnych modelu ekonometrycznego. 🙂

 

Dla osób bardziej wprawionych matematycznie: – skąd wiadomo, że akurat tak wyliczone wartości minimalizują funkcję S open parentheses a subscript 0 comma a subscript 1 close parentheses? W analizie matematycznej , aby to potwierdzić, wyznacza się na początku pochodne cząstkowe drugiego rzędu funkcji po danych parametrach. Pamiętam, że pierwsze pochodne wyglądały następująco: fraction numerator partial differential S open parentheses a subscript 0 comma a subscript 1 close parentheses over denominator partial differential a subscript 0 end fraction equals 2 open square brackets negative sum from straight t equals 1 to straight n of straight y subscript straight t plus straight a subscript 1 sum from straight t equals 1 to straight n of straight x subscript straight t plus straight n times straight a subscript 0 close square brackets  oraz  fraction numerator partial differential S open parentheses a subscript 0 comma a subscript 1 close parentheses over denominator partial differential a subscript 1 end fraction equals 2 open square brackets negative sum from straight t equals 1 to straight n of straight y subscript straight t straight x subscript straight t plus straight a subscript 0 sum from straight t equals 1 to straight n of straight x subscript straight t plus a subscript 1 sum from straight t equals 1 to straight n of space x subscript straight t superscript 2 close square brackets.

fraction numerator partial differential squared S open parentheses a subscript 0 comma a subscript 1 close parentheses over denominator partial differential a subscript 0 superscript 2 end fraction equals 2 times open square brackets 0 plus 0 plus straight n times 1 close square brackets equals 2 n

fraction numerator partial differential squared S open parentheses a subscript 0 comma a subscript 1 close parentheses over denominator partial differential a subscript 0 partial differential a subscript 1 end fraction equals 2 times open square brackets 0 plus sum from straight t equals 1 to straight n of straight x subscript straight t times 1 plus 0 close square brackets equals 2 sum from straight t equals 1 to straight n of straight x subscript straight t space equals fraction numerator partial differential squared straight S open parentheses straight a subscript 0 comma straight a subscript 1 close parentheses over denominator partial differential straight a subscript 1 partial differential straight a subscript 0 end fraction

fraction numerator partial differential squared S open parentheses a subscript 0 comma a subscript 1 close parentheses over denominator partial differential a subscript 1 superscript 2 end fraction equals 2 times open square brackets 0 plus 0 plus sum from straight t equals 1 to straight n of space x subscript straight t superscript 2 times 1 close square brackets space equals space 2 sum from straight t equals 1 to straight n of space x subscript straight t superscript 2

Układam je w tak zwany “Hessjan”, czyli macierz pochodnych drugiego rzędu:

H space equals space open square brackets table row cell fraction numerator partial differential squared S open parentheses a subscript 0 comma a subscript 1 close parentheses over denominator partial differential a subscript 0 superscript 2 end fraction end cell cell fraction numerator partial differential squared S open parentheses a subscript 0 comma a subscript 1 close parentheses over denominator partial differential a subscript 0 partial differential a subscript 1 end fraction end cell row cell fraction numerator partial differential squared straight S open parentheses straight a subscript 0 comma straight a subscript 1 close parentheses over denominator partial differential straight a subscript 1 partial differential straight a subscript 0 end fraction end cell cell fraction numerator partial differential squared S open parentheses a subscript 0 comma a subscript 1 close parentheses over denominator partial differential a subscript 1 superscript 2 end fraction end cell end table close square brackets space equals space open square brackets table row cell 2 n end cell cell 2 sum from straight t equals 1 to straight n of straight x subscript straight t space end cell row cell 2 sum from straight t equals 1 to straight n of straight x subscript straight t space end cell cell 2 sum from straight t equals 1 to straight n of straight x subscript straight t superscript 2 space end cell end table close square brackets

Funkcja dwóch zmiennych posiada ekstremum, gdy zachodzą dwa warunki:

  • maksimum lokalne, gdy wartość wyznacznika macierzy w punkcie open parentheses a subscript 0 comma a subscript 1 close parentheses jest dodatnia, tzn. d e t left parenthesis H right parenthesis space greater than space 0 oraz fraction numerator partial differential squared S open parentheses a subscript 0 comma a subscript 1 close parentheses over denominator partial differential a subscript 0 superscript 2 end fraction space less than 0
  • minimum lokalne, gdy wartość wyznacznika macierzy w punkcie open parentheses a subscript 0 comma a subscript 1 close parentheses jest dodatnia, tzn. d e t left parenthesis H right parenthesis space greater than space 0 oraz fraction numerator partial differential squared S open parentheses a subscript 0 comma a subscript 1 close parentheses over denominator partial differential a subscript 0 superscript 2 end fraction space greater than 0

Szukam wartości minimalizującej funkcję S open parentheses a subscript 0 comma a subscript 1 close parentheses.

Drugi warunek minimum lokalnego jest spełniony, gdyż fraction numerator partial differential squared S open parentheses a subscript 0 comma a subscript 1 close parentheses over denominator partial differential a subscript 0 superscript 2 end fraction space equals 2 n space greater than 0. Sprawdzam więc wyznacznik Hessjanu, czy aby na pewno będzie miał wartość dodatnią. W przypadku macierzy 2 cross times 2 taki wyznacznik łatwo się liczy: open vertical bar table row a b row c d end table close vertical bar equals space a times d minus b times c.  Stąd:

d e t open parentheses H close parentheses space equals space open vertical bar table row cell 2 n end cell cell 2 sum from straight t equals 1 to straight n of straight x subscript straight t end cell row cell 2 sum from straight t equals 1 to straight n of straight x subscript straight t end cell cell 2 sum from straight t equals 1 to straight n of straight x subscript straight t superscript 2 space end cell end table close vertical bar space equals 2 n times 2 sum from straight t equals 1 to straight n of straight x subscript straight t superscript 2 minus 2 sum from straight t equals 1 to straight n of straight x subscript straight t times 2 sum from straight t equals 1 to straight n of straight x subscript straight t space equals

equals 4 open parentheses straight n sum from straight t equals 1 to straight n of straight x subscript straight t superscript 2 minus open parentheses sum from straight t equals 1 to straight n of straight x subscript straight t close parentheses squared close parentheses equals 4 open parentheses straight n sum from straight t equals 1 to straight n of straight x subscript straight t superscript 2 minus open parentheses n times fraction numerator sum from straight t equals 1 to straight n of straight x subscript straight t over denominator straight n end fraction close parentheses squared close parentheses equals 4 open parentheses straight n sum from straight t equals 1 to straight n of straight x subscript straight t superscript 2 minus n squared open parentheses top enclose x close parentheses squared close parentheses equals 4 n open parentheses sum from straight t equals 1 to straight n of straight x subscript straight t superscript 2 minus n open parentheses top enclose x close parentheses squared close parentheses equals bold 4 bold italic n open parentheses bold sum from bold t bold equals bold 1 to bold n of open parentheses bold x subscript bold t superscript blank bold minus top enclose bold x close parentheses to the power of bold 2 close parentheses bold space bold greater than bold 0

Stąd wyznaczone wartości estymatorów parametrów a subscript 0 oraz a subscript 1 minimalizują funkcję S open parentheses a subscript 0 comma a subscript 1 close parentheses.

 

 

Interpretacja współczynnika kierunkowego i wyrazu wolnego

Kiedy obliczysz parametry równania regresji liniowej  y with hat on top subscript t space equals space a subscript 0 space plus space a subscript 1 x subscript t space, to warto by było wiedzieć, co one oznaczają.

Wartość estymatora współczynnika kierunkowego a subscript 1 interpretujemy następująco:

Wzrost (ZAWSZE wzrost) zmiennej objaśniającej o 1 jednostkę pociąga za sobą zmianę (wzrost lub spadek) zmiennej objaśnianej średnio/przeciętnie o wartość oszacowanego parametru alpha subscript i.

Wyraz wolny a subscript 0 mówi nam, jakiej wartości Y powinniśmy spodziewać się dla zerowego X.  Jednak nie zawsze ta interpretacja jest sensowna. Wspominałam o tym w moim Kursie.

 

Przykład 2

W pewnej grupie studentów zbadano zależność liczby punktów, otrzymanych jako wynik egzaminu open parentheses y subscript t close parentheses, od godzin nauki do tego egzaminu open parentheses x subscript t close parentheses. Po obliczeniach oszacowano model postaci: y with hat on top subscript t space equals space 128 space plus space 37 x subscript t space. Interpretacja parametrów modelu jest następująca:

a subscript 1 equals 37 space– jeżeli liczba godzin nauki do egzaminu zwiększy się o jedną godzinę, to liczba punktów otrzymanych z egzaminu zwiększy się przeciętnie o około 37 pkt;

a subscript 0 equals 128 – nie podlega interpretacji. Przecież nie jest sensowne powiedzieć, że jeżeli student nie będzie się uczył do egzaminu (poświęci 0 godzin na naukę), to otrzyma z egzaminu aż 128 punktów…

 

 

Estymacja parametrów modelu ekonometrycznego Metodą Najmniejszych Kwadratów – przypadek wielu zmiennych objaśniających.

Przed chwilą zostało wyjaśnione jak działa i na czym polega szukanie prostej w przypadku dwóch zmiennych X oraz Y.  Model liniowy ze stałą i jedną zmienną objaśniającą jest szczególnym przypadkiem modelu z  ilością k zmiennych objaśniających. Zatem jak działa Metoda Najmniejszych Kwadratów w sytuacji, gdy mamy więcej niż jedną zmienną X? W tym przypadku znalezienie rozwiązania staje się względnie proste przy zastosowaniu algebry macierzy.

Ogólny model ekonometryczny z wyrazem wolnym jest postaci:

y subscript t space equals space alpha subscript 0 space plus space alpha subscript 1 x subscript 1 t end subscript space plus space alpha subscript 2 x subscript 2 t end subscript space plus space... space plus space alpha subscript k x subscript k t end subscript space plus space epsilon subscript t

W zapisie macierzowo-wektorowym można przedstawić go następująco:

bold italic Y space equals space open square brackets table row cell y subscript 1 end cell row cell y subscript 2 end cell row vertical ellipsis row cell y subscript n end cell end table close square brackets space space bold space bold italic X space equals space open square brackets table row 1 cell x subscript 11 end cell cell x subscript 12 end cell midline horizontal ellipsis cell x subscript 1 k end subscript end cell row 1 cell x subscript 21 end cell cell x subscript 22 end cell midline horizontal ellipsis cell x subscript 2 k end subscript end cell row vertical ellipsis vertical ellipsis vertical ellipsis down right diagonal ellipsis vertical ellipsis row 1 cell x subscript n 1 end subscript end cell cell x subscript n 2 end subscript end cell midline horizontal ellipsis cell x subscript n k end subscript end cell end table close square brackets space space space space space bold italic alpha equals open square brackets table row cell alpha subscript 1 end cell row cell alpha subscript 2 end cell row vertical ellipsis row cell alpha subscript k end cell end table close square brackets space space space space space bold italic epsilon equals open square brackets table row cell epsilon subscript 1 end cell row cell epsilon subscript 2 end cell row vertical ellipsis row cell epsilon subscript n end cell end table close square brackets

Stąd:

 bold italic Y space equals space space bold italic X bold italic alpha plus space bold italic epsilon bold space bold space bold space bold space bold space bold space bold space bold space bold space left parenthesis 2 right parenthesis

Przy takim zapisie, wektor kolumnowy bold italic Y zawiera wszystkie obserwacje dla zmiennej objaśnianej. W macierzy bold italic Xkolejne kolumny stanowią obserwacje zmiennych objaśniających w modelu. Zazwyczaj macierz bold italic X jest macierzą prostokątną o dużo większej liczbie wierszy niż kolumn, ponieważ najczęściej liczba obserwacji jest większa niż liczba zmiennych X subscript k. Macierzy bold italic X jako macierzy prostokątnej nie da się odwrócić (tylko macierze kwadratowe są odwracalne). Z tego też względu równania (2) nie da się rozwiązać za pomocą czysto algebraicznych przekształceń.

Model ekonometryczny po oszacowaniu parametrów strukturalnych alpha subscript i będzie w postaci:

y with hat on top subscript t space equals space a subscript 0 space plus a subscript 1 x subscript 1 t end subscript space plus space a subscript 2 x subscript 2 t end subscript space plus space... space plus space a subscript k x subscript k t end subscript space

Pokażę teraz, jak wyprowadza się estymator bold italic a parametrów Metodą Najmniejszych Kwadratów.

Zasada jest taka sama jak poprzednio. Idea MNK sprowadza się do takiego wyznaczenia wartości ocen a subscript 0 comma space a subscript 1 comma space... space comma space a subscript k parametrów strukturalnych alpha subscript 0 comma space alpha subscript 1 comma space... space comma space alpha subscript k, aby suma kwadratów różnic wartości obserwowanych y subscript t i wartości teoretycznych obliczonych z równania modelu y with hat on top subscript t były jak najmniejsze.

sum from t equals 1 to n of space open parentheses y subscript t minus y with hat on top subscript t space close parentheses squared equals sum from t equals 1 to n of space open parentheses e subscript t close parentheses squared space rightwards arrow space m i n

Podobnie jak poprzednio, po podstawieniu równania teoretycznego modelu, otrzymuję:

sum from t equals 1 to n of space open parentheses y subscript t minus open parentheses a subscript 0 space plus a subscript 1 x subscript 1 t end subscript space plus space a subscript 2 x subscript 2 t end subscript space plus space... space plus space a subscript k x subscript k t end subscript space close parentheses close parentheses squared equals sum from t equals 1 to n of space open parentheses y subscript t minus a subscript 0 minus a subscript 1 x subscript 1 t end subscript minus a subscript 2 x subscript 2 t end subscript minus space... space minus a subscript k x subscript k t end subscript space close parentheses squared space equals S open parentheses a subscript 0 comma space a subscript 1 comma... space comma space a subscript k close parentheses space rightwards arrow space m i n

Rozwiązaniem układu w postaci macierzowej będzie wektor postaci: bold italic a equals open square brackets table row cell a subscript 1 end cell row cell a subscript 2 end cell row vertical ellipsis row cell a subscript k end cell end table close square brackets.

Funkcję  S open parentheses a subscript 0 comma space a subscript 1 comma... space comma space a subscript k close parentheses equals space sum from t equals 1 to n of space open parentheses y subscript t minus a subscript 0 minus a subscript 1 x subscript 1 t end subscript minus a subscript 2 x subscript 2 t end subscript minus space... space minus a subscript k x subscript k t end subscript space close parentheses squared space equals space sum from t equals 1 to n of space open parentheses e subscript t close parentheses squared space, wykorzystując własności działań na macierzach, w postaci macierzowej można rozpisać następująco:

S open parentheses bold italic a close parentheses equals bold italic e to the power of T times bold italic e equals space open parentheses bold italic Y minus bold italic X bold italic a space close parentheses to the power of T times open parentheses bold italic Y minus bold italic X bold italic a space close parentheses space equals space open parentheses bold italic Y to the power of T minus bold italic a to the power of T bold italic X to the power of T space close parentheses times open parentheses bold italic Y minus bold italic X bold italic a space close parentheses space equals space bold italic Y to the power of T bold italic Y bold space minus bold italic Y to the power of straight T bold italic X bold italic a minus bold italic a to the power of straight T bold italic X to the power of straight T bold italic Y plus bold italic a to the power of straight T bold italic X to the power of straight T bold italic X bold italic a bold space

Suma kwadratów reszt S open parentheses bold italic a close parentheses jest jedną konkretną liczbą, inaczej skalarem. Tak więc każdy element uzyskanej sumy również jest zwykłą liczbą. Transpozycja skalarów czy też zamiana kolejności mnożenie nie wpływa na wynik, więc: bold italic Y to the power of straight T bold italic X bold italic a equals bold italic a to the power of straight T bold italic X to the power of straight T bold italic Y. W rezultacie wychodzi:

S open parentheses bold italic a close parentheses space equals space bold italic Y to the power of T bold italic Y bold space minus bold italic Y to the power of straight T bold italic X bold italic a minus bold italic a to the power of straight T bold italic X to the power of straight T bold italic Y plus bold italic a to the power of straight T bold italic X to the power of straight T bold italic X bold italic a bold space bold equals bold italic Y to the power of straight T bold italic Y bold space minus 2 bold italic a to the power of straight T bold italic X to the power of straight T bold italic Y plus bold italic a to the power of straight T bold italic X to the power of straight T bold italic X bold italic a bold space

Funkcja S open parentheses bold italic a close parentheses osiąga minimum, jeśli jej pierwsza pochodna względem wektora bold italic a jest równa wektorowi zerowemu, a druga pochodna jest dodatnio określona.

open square brackets table row cell fraction numerator partial differential S open parentheses bold italic a close parentheses over denominator partial differential a subscript 0 end fraction end cell row cell fraction numerator partial differential S open parentheses bold italic a close parentheses over denominator partial differential a subscript 1 end fraction end cell row vertical ellipsis row cell fraction numerator partial differential S open parentheses bold italic a close parentheses over denominator partial differential a subscript k end fraction end cell end table close square brackets equals fraction numerator partial differential S open parentheses bold italic a close parentheses over denominator partial differential bold italic a end fraction equals fraction numerator partial differential bold italic Y to the power of straight T bold italic Y over denominator partial differential bold italic a end fraction minus 2 fraction numerator partial differential bold italic a to the power of straight T bold italic X to the power of straight T bold italic Y over denominator partial differential bold italic a end fraction plus fraction numerator partial differential bold italic a to the power of straight T bold italic X to the power of straight T bold italic X bold italic a over denominator partial differential bold italic a end fraction space equals space 0 minus 2 times bold italic X to the power of straight T bold italic Y plus 2 times bold italic X to the power of straight T bold italic X bold italic a

Przyrównując pochodną fraction numerator partial differential S open parentheses bold italic a close parentheses over denominator partial differential bold italic a end fraction do wektora zerowego otrzymuję:

negative 2 bold italic X to the power of straight T bold italic Y plus 2 bold italic X to the power of straight T bold italic X bold italic a bold space equals bold space bold 0 bold space bold space bold space bold space bold space divided by space colon space 2

negative bold italic X to the power of straight T bold italic Y plus bold italic X to the power of straight T bold italic X bold italic a bold space equals bold space bold 0bold italic X to the power of straight T bold italic X bold italic a bold space equals bold space bold italic X to the power of straight T bold italic Y bold space bold space bold space bold space bold space bold space bold space space divided by times bold space open parentheses bold italic X to the power of straight T bold italic X close parentheses subscript L superscript negative 1 end superscript

Z własności mnożenia macierzy bold italic A i macierzy do niej odwrotnej bold italic A to the power of negative 1 end exponent otrzymujemy macierz jednostkową, czyli: bold italic A to the power of negative 1 end exponent times bold italic A space equals space bold italic A times bold italic A to the power of negative 1 end exponent space equals space bold italic I. Jest to macierz odpowiadająca po prostu liczbie jeden.

Stąd ostatecznie otrzymujemy wzór na oszacowania nieznanych parametrów strukturalnych alpha subscript i w postaci wektorowej:

bold italic a bold space bold equals open parentheses bold X to the power of bold T bold X close parentheses subscript blank superscript bold minus bold 1 end superscript bold space bold italic X to the power of bold T bold italic Y

bold italic X to the power of T oznacza macierz transponowaną do macierzy bold italic X, natomiast open parentheses bold italic X to the power of straight T bold italic X close parentheses subscript blank superscript negative 1 end superscript oznacza macierz odwrotną do macierzy bold italic X to the power of straight T bold italic X.

Jak dotąd rozpatrywany był warunek konieczny istnienia ekstremum. Należy teraz zbadać, czy rzeczywiście znalezione ekstremum jest minimum funkcji S open parentheses bold italic a close parentheses. Warunek dostateczny istnienia ekstremum sprowadza się do tego, aby Hessjan, czyli macierzy drugich pochodnych była dodatnio określona. W tym przypadku będzie miała ona postać:

open square brackets table row cell fraction numerator partial differential S open parentheses bold italic a close parentheses over denominator partial differential a subscript 0 end fraction end cell row cell fraction numerator partial differential S open parentheses bold italic a close parentheses over denominator partial differential a subscript 1 end fraction end cell row vertical ellipsis row cell fraction numerator partial differential S open parentheses bold italic a close parentheses over denominator partial differential a subscript k end fraction end cell end table close square brackets equals fraction numerator partial differential squared S open parentheses bold italic a close parentheses over denominator partial differential bold italic a bold partial differential bold italic a to the power of bold T end fraction equals fraction numerator partial differential squared open parentheses bold 2 bold X to the power of bold T bold Y bold plus bold 2 bold X to the power of bold T bold X bold a close parentheses over denominator partial differential bold italic a end fraction equals 0 plus space 2 bold italic X to the power of straight T bold italic X times 1 equals 2 bold italic X to the power of straight T bold italic X

Powyższe równanie jasno wskazuje na fakt, że warunek dodatniej określoności Hessjanu jest spełniony, ponieważ bold italic X to the power of straight T bold italic X jest dodatnio określona, jeśli tylko jej wyznacznik jest różny od zera.

 

 

Interpretacja współczynników a subscript 0 comma space a subscript 1 comma space... space comma space a subscript k

Podobnie jak w przypadku równania z jedną zmienną objaśniającą, warto też wiedzieć jak interpretować parametry równania regresji liniowej  y with hat on top subscript t space equals space a subscript 0 space plus a subscript 1 x subscript 1 t end subscript space plus space a subscript 2 x subscript 2 t end subscript space plus space... space plus space a subscript k x subscript k t end subscript space.

W tym przypadku, nasz tok myślenia powinien pójść bardzo analogicznie co do wcześniej omawianego przypadku jednej zmiennej objaśniającej. Różnica będzie dotyczyła dodania do poprzedniej interpretacji frazy o stałości pozostałych zmiennych (nie interpretowanych w danym momencie). A co za tym idzie, wartość estymatora współczynnika a subscript i , stojącego przy zmiennej X subscript i , gdzie i element of 1 comma space... comma space k,  interpretujemy następująco:

Wzrost (ZAWSZE wzrost) zmiennej objaśniającej X subscript k o 1 jednostkę pociąga za sobą zmianę (wzrost lub spadek) zmiennej objaśnianej Y średnio/przeciętnie o wartość oszacowanego parametru alpha subscript i, przy założeniu stałości pozostałych zmiennych (ceteris paribus).

Tak jak poprzednio, wyraz wolny a subscript 0 mówi nam, jakiej wartości Y powinniśmy się spodziewać dla zerowych wartości wszystkich zmiennych objaśniających. Jednak w przypadku zmiennych ekonomicznych, nie zawsze ta interpretacja jest sensowna, co pokazuje Przykład 2.

 

 

Stąd oto biorą się i w ten sposób zostały wyprowadzone wzory na oszacowania parametrów modelu ekonometrycznego Metodą Najmniejszych Kwadratów.

 

 

Ciekawostka – Kwartet Anscombe’a

Wszystko co ma plusy, ma i swoje minusy. Niedostateczność Metody Najmniejszych Kwadratów w ogólnym przypadku pokazuje m.in. kwartet Anscombe’a – specjalnie przygotowany zestaw czterech zbiorów danych, które mają niemal tożsame wskaźniki statystyczne (średnią i wariację w kierunku X i Y, współczynnik korelacji oraz prostą regresji) pomimo znacząco różnego charakteru danych w ujęciu graficznym.

Źródło: By Anscombe.svg: SchutzPrace pochodne od tego pliku:(label using subscripts): Avenue – Anscombe.svg, CC BY-SA 3.0, https://commons.wikimedia.org/w/index.php?curid=9838454 , dostęp: 15.06.2018 r.

 

 

Na koniec niniejszego artykułu wspomnę jeszcze o jednej ważnej własności. Korzystając z Metody Najmniejszych Kwadratów otrzymane estymatory  aoszacowań parametrów modelu mają następujące własności: są liniowe, zgodne, nieobciążone i najefektywniejsze. Ale o tym wszystkim w następnych wykładach.

 

 

Podsumowanie

W powyższym Wykładzie zaprezentowałam pojęcie “regresji” oraz działanie najszerzej stosowanej w ekonometrii metody estymacji, zwanej Metodą Najmniejszych Kwadratów. To właśnie za jej pomocą szacując nieznane parametry modelu, uzyskujemy oszacowania, dla których model najlepiej opisuje zaprezentowane dane.

Mam nadzieję, że odtąd stosowane wzory nie będą już dla Ciebie żadną tajemnicą.

Jeśli chcesz zastosować poznaną wiedzę w praktyce, zachęcam Cię do zajrzenia do mojego Kursu, zwłaszcza do lekcji nr 3.

 

KONIEC

 


Kliknij, aby powtórzyć sobie, czym jest współczynnik korelacji, czyli jak bardzo powiązane są ze sobą zmienne (poprzedni Wykład) <–

Kliknij, aby sprawdzić, jakie są założenia klasycznej metody najmniejszych kwadratów (następny Wykład) ->

Kliknij, aby powrócić na stronę z Wykładami do ekonometrii


 

Bestsellery

Kurs Macierze

Studia / Autor: mgr Krystian Karczyński

39,00 

Kurs Prawdopodobieństwo

Studia / Autor: mgr Krystian Karczyński

39,00 

Kurs Mechanika - Statyka

Studia / Autor: mgr inż. Adam Kasprzak

39,00 

Kurs Matura Podstawowa (Formuła 2023 i 2015)

Szkoła Średnia / Autor: mgr inż. Anna Zalewska

59,00 

Zobacz wszystkie Kursy eTrapez

Szukasz korepetycji z matematyki na poziomie studiów lub szkoły średniej? A może potrzebujesz kursu, który przygotuje Cię do matury?

Jesteśmy ekipą eTrapez. Uczymy matematyki w sposób jasny, prosty i bardzo dokładny - trafimy nawet do najbardziej opornego na wiedzę.

Stworzyliśmy tłumaczone zrozumiałym językiem Kursy video do pobrania na komputer, tablet czy telefon. Włączasz nagranie, oglądasz i słuchasz, jak na korepetycjach. O dowolnej porze dnia i nocy.

Dodaj komentarz

Twój adres e-mail nie zostanie opublikowany. Wymagane pola są oznaczone *

Twój komentarz będzie dostępny publicznie na naszej stronie razem z powyższym podpisem. Komentarz możesz zmienić, lub usunąć w każdej chwili. Administratorem danych osobowych podanych w tym formularzu jest eTrapez Usługi Edukacyjne E-Learning Krystian Karczyński. Zasady przetwarzania danych oraz Twoje uprawnienia z tym związane opisane są w Polityce Prywatności.