STATA for Beginners INTENSIVE Public - stou.ac.th for Beginners INTENSIVE_Public... · กระบวนการทางเศรษฐมิติ…

  • View
    212

  • Download
    0

Embed Size (px)

Transcript

  • STATA for Beginners INTENSIVE

    1

  • (Economic measurement)

    & && (Samualson)

    2

  • 6 ( & &&) (estimate) (parameter) &&& (forecast) &

    3

  • 1.

    & (Disposable Income) &&& 6&& & 6&

    4

  • 2.

    Consumption: Y

    Disposable Income: X

    1

    0

    Y

    &

    *** *

    Y = 1 + 2X

    0 < 2

  • 3.

    U (disturbance term) error term 6 && && 6

    Y = 1 + 2X + U

    6

  • 4.

    Personal Consumption Expenditures (PCE) > U.S. Bureau of Labor Statistics

    Real GDP > World Bank

    6 1960 - 2005

    7

  • 5.

    MPC = ???

    8

  • 6. ***

    MPC = 0.72 & () () 2

    Multicolinearlity ??? Heterosckedasticity ??? Autocorrelation ???

    0 < 2

  • 7. (forecast)

    mean consumption expenditure 2006

    GDP 2006 11,319.4

    6 mean consumption expenditure 7,870.75

    2006 8,044 & 174

    forecast error 174 10

  • 7. (forecast)

    (income tax)

    Consumption expenditure

    11

  • 7. (forecast)

    & income & investment expenditure & income multiplier

    6& 6 () & & 6 () 3.57

    12

  • 8. *

    & 6

    & consumer expenditure 8,750 (unemployment rate) & 4.2% ( 2006) income consumer expenditure & 8,750

    13

  • 8. *

    & (income) & 12,537 consumer expenditure & 8,750

    & (income) 6 & Fiscal policy Monetary policy

    14

  • ..

    15

  • * 4

    Cross - sectional data Time series data Panel or Longitudinal data Pooled Cross sectional data

    16

  • Cross - sectional data ID ( 1 = , 0 = &)

    2010 120 0

    2010 135 0

    2010 115 0

    2010 125 1

    2010 123 1

    2010 140 117

  • Time series data

    ** ID ( 1 = , 0 = &)

    2010 120 0

    2011 125 0

    2012 137 0

    2013 148 0

    2014 159 0

    2015 168 018

  • Panel or Longitudinal data

    ( !) ID ( 1 = , 0 = &)

    2010 120 0

    2011 125 0

    2010 115 0

    2011 128 0

    2010 123 1

    2011 137 119

  • Pooled Cross sectional data

    ID ( 1 = , 0 = &)

    2010 120 0

    2011 137 0

    2012 155 0

    2010 125 1

    2013 150 1

    2011 147 120

  • (dummy variable)

    (Dummy variables) & 6 && 6 6 6 (Qualitative variable)

    21

  • (* )

    (Primary Data) & & 6 -> Experimental Economics -> Google forms FB &

    &&

    22

  • (* )

    (Secondary Data) & & & &

    6 6 &

    6 6 6 & 6 &&

    23

  • (Secondary Data)

    (labor force survey) uncomtrade FTA

    & 6& & CEIC -> ABAC , Bloomberg

    24

  • (Secondary Data)

    () (www. bot.or.th)

    :

    (www.mof.go.th) :

    (www.moc.go.th) :

    &&

    25

  • (Secondary Data)

    (www. nesdb.go.th ) :

    (www.set.or.th) : & 6

    International Monetary Fund (www.imf.org) :

    26

  • (Secondary Data)

    World Bank (www.worldbank.org): &&

    Bank of International Settlement (www.bis.org ) :

    World Trade Organization (www.wto.org) :

    27

  • (Secondary Data)

    &

    28

  • , , estimate, STATA

    29

  • STATA

    Stata is a general-purpose statistical software package created in 1985 by StataCorp. Most of its users work in research, especially in the fields of economics, sociology, political science, biomedicine and epidemiology.

    Stata's capabilities include data management, statistical analysis, graphics, simulations, regression analysis (linear and multiple), and custom programming.

    30

  • * 1

    31

  • summarize

    summarize = data 6

    Thesis data 6 !

    32

  • codebook

    codebook detail variable

    33

  • describe

    describe ->

    describe year 34

  • plot

    plot rgdp c plot ngdp c plot rgdp ngdp c

    35

  • scatter

    scatter rgdp c scatter ngdp c scatter rgdp ngdp c

    36

    4.0e

    +06

    6.0e

    +06

    8.0e

    +06

    1.0e

    +07

    1.2e

    +07

    1.8e+06 2.0e+06 2.2e+06 2.4e+06c

    rgdp ngdp

  • correlate

    correlate rgdp ngdp corr rgdp c corr

    Thesis correlate 6 !37

  • generate rgdp_mill = rgdp / 1000000 rename rgdp_mill rgdp_mil gen ngdp_mil = ngdp / 1000000 gen consumption_mil = c / 1000000

    Plot ??? line rgdp_mil year

    38

  • reg rgdp_mil consumption_mil

    39

  • Result:

    40

    2R F Test

    t test

    1 1 Y a b X= +

    Root MSE

  • x y (95.05) Root MSE = Root Mean Square Error

    & Root Mean Square Error

    F-test -> M 1 &

    t-test 6

    41

    2R

    0: 0

    : 0a

    H b

    H b

    =

    & 1% (P

  • Thesis Copy

    OLS

    year 0.150***

    (.012)

    constant -297.153***

    (24.29)

    Observation 10

    R-square 95.05

    F-Test 153.73***

    42

    SE , *** & 1%, ** & 5% , * & 10%

  • y_hat u_hat

    43

  • y_hat u_hat

    y_hat

    predict rgdp_mil_hat, xb

    u_hat predict u_hat, residual

    44

  • 45

  • Plot Graph

    twoway scatter rgdp_mil consumption_mil || line rgdp_mil_hat consumption_mil

    46

    33.

    54

    4.5

    1.8 2 2.2 2.4consumption_mil

    rgdp_mil Linear prediction

  • &

    47

  • 48

  • predict ngdp_mil_hat, xb twoway line rgdp_mil_hat year || line ngdp_mil_hat year

    49

    46

    810

    12Li

    near

    pre

    dict

    ion

    2002 2004 2006 2008 2010 2012year

    Linear prediction Linear prediction

  • 1. MPC 2. multiplier

    50

  • MPC = 0.422 Multiplier = 1.73

    1,000,000 reg c rgdp

    51

    1

    1multiplier

    MPC=

  • X & 1 Y &

    X & 100 Y &

    X & 1 Y & 0.01

    X & 1 Y & Elasticity

    52

    0 1Y X = +

    0 1lnY X = +

    0 1 lnY X = +

    0 1ln lnY X = +

  • Dummy Variable

    53

  • Dummy Variable

    6& estimate 6 6 6 ( )

    & &

    6 dummy variable

    estimate 6 & 6 = 1 = 0

    estimate54

  • Average salary of public school

    teachers by state, 1986

    gives data on average salary (in dollars) of public school teachers in 50 states and the District of

    Columbia for the year 1985.

    These 51 areas are classified into three geographical regions:

    (1) Northeast and North Central (21 states in all), (2) South (17 states in all), (3) West (13 states in all).

    55

  • West D2i D3i = 0 west dummy & ???

    56

  • ** 1. m

    model m-1 6 3 model dummy 2 6 & dummy variable trap & pefect collinearity perfect multicollinearity 6 ( estimate constant )

    2. & ( 0 6) base, benchmark, control, comparison, reference, or omitted category

    benchmark ??? 3. intercept constant term mean

    value & benchmark 57

  • **

    4. dummy variable differential intercept coefficients & effect dummy intercept &

    5. benchmark south west

    6. dummy ( 6 3 ) estimate constant

    7. constant

    58

  • ex9.1

    59

  • 60

    WestN/E & N/C South

    1 48 15 ,0 =

    1 2 4 ,539 9 + =

    1 3 4 ,294 6 + =

  • constant reg salary d1 d2 d3, nocon

    61

  • Model * (*)

    reg salary d2 d3 spending

    62

  • 63

  • 64

  • * *

    65

  • ex9.2 page 287

    gen DX = dum* income reg saving income dum DX

    66

  • 67

  • Interaction dummy 2 *

    & 6& Model

    dummy 6

    68

  • Coefficients

    69

  • 70

  • coefficient

    71

  • 72

  • 1

    Multicollinearity

    Heteroscedasticity

    Autocorrelation

    73

  • Multicollinearity

    74

  • Multicollinearity

    & ( Correlation)

    && &

    6 6 () 6(.)

    75

  • Collinearity Multicollinearity 6& Multiple regression

    R Square significant Scatter plot

    STATA & ???

    76

  • ex10.5 page 333

    reg y x2 x3 R-square p-value

    77

  • multi

    plot x2 x3 Corr x2 x3

    78

  • * Collinearity Multicollinearity

    & Collinearity Multicollinearity 6

    & Collinearity & 6 & Correlation

    & Collinearity

    Collinearity Multicollinearity 6& 6

    79

  • ex10.5 page 333

    corr

    multi

    80

    1 2 3 4ln ln lndc y w I u = + + + +

  • gen lnc = ln(c)

    gen lnyd = ln( yd)

    gen lnw = ln(w)

    corr i lnyd lnw

    81

  • reg lnc lnyd lnw i