• Tidak ada hasil yang ditemukan

Carter Regression 652019

N/A
N/A
Purwanto

Academic year: 2023

Membagikan "Carter Regression 652019"

Copied!
1
0
0

Teks penuh

(1)

The Simple Linear Regression

use "C:\Users\Windows 10 Gamer.PURWANTO\Desktop\Using Stata\Data POT\food.dta", clear . describe

Contains data from C:\Users\Windows 10 Gamer.PURWANTO\Desktop\Using Stata\Data POT\food.dta

obs: 40 vars: 2 size: 640

--- ---

storage display value

variable name type format label variable label

--- ---

food_exp double %10.0g household food expenditure per week income double %10.0g weekly household income

--- ---

Sorted by:

. summarize

Variable | Obs Mean Std. Dev. Min Max ---+--- food_exp | 40 283.5735 112.6752 109.71 587.66 income | 40 19.60475 6.847773 3.69 33.4

. tabstat food_exp income  semua variable, khusus mean stats | food_exp income

---+--- mean | 283.5735 19.60475

. . tabstat food_exp income, stat(n mean sd max min) stats | food_exp income

---+--- N | 40 40 mean | 283.5735 19.60475 sd | 112.6752 6.847773 max | 587.66 33.4 min | 109.71 3.69

. tabstat food_exp income, stat(n mean sd max min) col(stat) variable | N mean sd max min ---+--- food_exp | 40 283.5735 112.6752 587.66 109.71 income | 40 19.60475 6.847773 33.4 3.69 --- . . tabstat food_exp income, stat(n mean var max min) col(stat) variable | N mean variance max min ---+--- food_exp | 40 283.5735 12695.7 587.66 109.71 income | 40 19.60475 46.89199 33.4 3.69 ---

(2)

tabstat food_exp income, stat(n mean var skew kurt) col(stat) variable | N mean variance skewness kurtosis ---+--- food_exp | 40 283.5735 12695.7 .4920827 2.851522 income | 40 19.60475 46.89199 -.6265073 3.279728 ---

Korelasi

. correlate food_exp income (obs=40)

| food_exp income ---+--- food_exp | 1.0000

income | 0.6205 1.0000

. correlate food_exp income, mean  selain korelasi, ditampilkan statistic deskriptif

(obs=40)

Variable | Mean Std. Dev. Min Max ---+--- food_exp | 283.5735 112.6752 109.71 587.66 income | 19.60475 6.847773 3.69 33.4

| food_exp income ---+--- food_exp | 1.0000

income | 0.6205 1.0000

. pwcorr food_exp income

| food_exp income ---+--- food_exp | 1.0000

income | 0.6205 1.0000

. pwcorr food_exp income, obs sig 

ditampilkan banyak sampeel dan probability

| food_exp income ---+--- food_exp | 1.0000

|

| 40 |

income | 0.6205 1.0000 | 0.0000

| 40 40

(3)

Menampilkan grafik Grafik scatter

. twoway (scatter food_exp income)

100200300400500600household food expenditure per week

0 10 20 30 40

weekly household income

Jika scale dari X dan Y diubah

twoway (scatter food_exp income), ylabel(0(100)600) xlabel(0(5)35) title(Food Expenditure Data)

ylabel(0(100)600)  untuk Y dimulai dari 0 sampai dengan 600, dengan skala 100 xlabel(0(5)35)  untuk X dimulai dari 0 sampai dengan 35, skala 5

title(Food Expenditure Data)  judul grafik “title = Food Expenditure Data

0100200300400500600household food expenditure per week

0 5 10 15 20 25 30 35

weekly household income

Food Expenditure Data

(4)

. twoway (scatter food_exp income), ylabel(0(100)600) xlabel(0(5)35) title(Food Expenditure Data) xtitle(Pendapatan RT) ytitle(Pengeluaran RT mingguan)

0100200300400500600Pengeluaran RT mingguan

0 5 10 15 20 25 30 35

Pendapatan RT

Food Expenditure Data

. twoway (scatter food_exp income) (lfit food_exp income), ylabel(0(100)600) xlabel(0(5)35) title(Food Expenditure Data) xtitle(Pendapatan RT)

(lfit food_exp income)  menggambarkan fit antara variable

0100200300400500600

0 5 10 15 20 25 30 35

Pendapatan RT

household food expenditure per week Fitted values

Food Expenditure Data

(5)

Grafik histogram

. histogram income

(bin=6, start=3.69, width=4.9516667)

0.02.04.06.08Density

5 10 15 20 25 30

weekly household income

Dalam percent

histogram income, percent

(bin=6, start=3.69, width=4.9516667)

010203040Percent

5 10 15 20 25 30

weekly household income

(6)

Regresi Linear sederhana

. regress food_exp income

Source | SS df MS Number of obs = 40 ---+--- F(1, 38) = 23.79 Model | 190626.984 1 190626.984 Prob > F = 0.0000 Residual | 304505.176 38 8013.2941 R-squared = 0.3850 ---+--- Adj R-squared = 0.3688 Total | 495132.16 39 12695.6964 Root MSE = 89.517 --- food_exp | Coef. Std. Err. t P>|t| [95% Conf. Interval]

---+--- income | 10.20964 2.093264 4.88 0.000 5.972052 14.44723 _cons | 83.416 43.41016 1.92 0.062 -4.463279 171.2953 --- . predict ehat, residuals  prediksi residual

. histogram ehat, percent

(bin=6, start=-223.02548, width=72.511584)

0102030Percent

-200 -100 0 100 200

Residuals

Pengujian parameter

. lincom income  pengujian menggunakan uji t  pengujian 1 variabel bebas ( 1) income = 0

--- food_exp | Coef. Std. Err. t P>|t| [95% Conf. Interval]

---+--- (1) | 10.20964 2.093264 4.88 0.000 5.972052 14.44723 ---

(7)

Pengujian menggunakan uji t

. lincom income – 10 

pengujian income = 10

( 1) income = 10

--- food_exp | Coef. Std. Err. t P>|t| [95% Conf. Interval]

---+--- (1) | .209643 2.093264 0.10 0.921 -4.027948 4.447233 --- Pengujian apakah suppins = 0.5

. lincom suppins - 0.5 ( 1) suppins = .5

--- ltotexp | Coef. Std. Err. t P>|t| [95% Conf. Interval]

---+--- (1) | -.2246371 .0455897 -4.93 0.000 -.314028 -.1352461 --- Pengujian suppins = -0.5

. lincom suppins + 0.5 ( 1) suppins = -.5

--- ltotexp | Coef. Std. Err. t P>|t| [95% Conf. Interval]

---+--- (1) | .7753629 .0455897 17.01 0.000 .685972 .8647539 ---

Pengujian apakah variable suppins = totchr 

penngujian melibatkan 2 variabel

. lincom suppins - totchr ( 1) suppins - totchr = 0

--- ltotexp | Coef. Std. Err. t P>|t| [95% Conf. Interval]

---+--- (1) | -.0988464 .0497555 -1.99 0.047 -.1964053 -.0012874

Pengujian apakah variable suppins = 2*totchr dan merubah conf. interval 90%

. lincom suppins -2*totchr, level(90)

level () dipakai untuk merubah confidence interval

( 1) suppins - 2*totchr = 0

--- ltotexp | Coef. Std. Err. t P>|t| [90% Conf. Interval]

---+--- (1) | -.4730557 .0595983 -7.94 0.000 -.571117 -.3749943 ---

(8)

Pengujian menggunakan uji F

test suppins ( 1) suppins = 0

F( 1, 2948) = 36.48 Prob > F = 0.0000 Bandingkan dengan sebelumnya : . lincom suppins

( 1) suppins = 0

--- ltotexp | Coef. Std. Err. t P>|t| [95% Conf. Interval]

---+--- (1) | .2753629 .0455897 6.04 0.000 .185972 .3647539 --- t = 6.04, t2 =(6.04) = 36.48  uji F

Selain itu, tidak ditampilkan confidence interval Pengujian apakah suppins = 0.5

. test suppins = 0.5  terdapat perbedaan argument saat menggunkan lincom ( 1) suppins = .5

F( 1, 2948) = 24.28 Prob > F = 0.0000 Bandingkan dengan sebelumnya . lincom suppins - 0.5 ( 1) suppins = .5

--- ltotexp | Coef. Std. Err. t P>|t| [95% Conf. Interval]

---+--- (1) | -.2246371 .0455897 -4.93 0.000 -.314028 -.1352461 --- t = -4.93  t2 = (-4.93)2 = 24.30  same as test F

Pengujian apakah variable suppins = totchr . test suppins = totchr

( 1) suppins - totchr = 0 F( 1, 2948) = 3.95 Prob > F = 0.0471 Sebelumnya

. lincom suppins - totchr ( 1) suppins - totchr = 0

(9)

--- ltotexp | Coef. Std. Err. t P>|t| [95% Conf. Interval]

---+--- (1) | -.0988464 .0497555 -1.99 0.047 -.1964053 -.0012874 Pengujian lebih dari 2 variabel

. lincom suppins - totchr + age ( 1) suppins - totchr + age = 0

--- ltotexp | Coef. Std. Err. t P>|t| [95% Conf. Interval]

---+--- (1) | -.0959317 .0502366 -1.91 0.056 -.1944341 .0025706 --- . test suppins = totchr - age

( 1) suppins - totchr + age = 0 F( 1, 2948) = 3.65 Prob > F = 0.0563 .

.

. . test suppins + age = totchr ( 1) suppins - totchr + age = 0 F( 1, 2948) = 3.65 Prob > F = 0.0563

. . lincom suppins - totchr + age -2 ( 1) suppins - totchr + age = 2

--- ltotexp | Coef. Std. Err. t P>|t| [95% Conf. Interval]

---+--- (1) | -2.095932 .0502366 -41.72 0.000 -2.194434 -1.997429 --- . test suppins - totchr + age = 2

( 1) suppins - totchr + age = 2 F( 1, 2948) = 1740.66 Prob > F = 0.0000 Pengujian bersama

. test suppins totchr age ( 1) suppins = 0

( 2) totchr = 0 ( 3) age = 0

F( 3, 2948) = 152.61 Prob > F = 0.0000

Pengujian ini, tidak bisa menggunakan lincom

(10)

Title

[R] lincom -- Linear combinations of parameters

Syntax

lincom exp [, options]

options Description

--- eform generic label; exp(b)

or odds ratio hr hazard ratio shr subhazard ratio irr incidence-rate ratio rrr relative-risk ratio

level(#) set confidence level; default is level(95) display_options control column formats

df(#) use t distribution with # degrees of freedom for computing p- values and confidence intervals

--- exp is any linear combination of coefficients that is valid syntax for test; see [R] test. exp must not contain an equal sign.

df(#) does not appear in the dialog box.

Menu

Statistics > Postestimation

Description

lincom computes point estimates, standard errors, t or z statistics, p-values, and confidence intervals for linear combinations of coefficients after any estimation command, including

survey estimation. Results can optionally be displayed as odds ratios, hazard ratios, incidence-rate ratios, or relative-risk ratios.

Options

eform, or, hr, shr, irr, and rrr all report coefficient estimates as exp(b) rather than b. Standard errors and confidence intervals are similarly transformed. or is the default

after logistic. The only difference in these options is how the output is labeled.

Option Label Explanation Example commands --- eform exp(b) Generic label cloglog

or Odds Ratio Odds ratio logistic, logit hr Haz. Ratio Hazard ratio stcox, streg shr SHR Subhazard ratio stcrreg irr IRR Incidence-rate ratio poisson rrr RRR Relative-rate ratio mlogit

---

exp may not contain any additive constants when you use the eform, or, hr, irr, or rrr option.

(11)

level(#) specifies the confidence level, as a percentage, for confidence intervals. The default is level(95) or as set by set level.

display_options: cformat(%fmt), pformat(%fmt), and sformat(%fmt); see [R]

estimation options.

The following option is available with lincom but is not shown in the dialog box:

df(#) specifies that the t distribution with # degrees of freedom be used for computing p-values and confidence intervals. The default is to use e(df_r) degrees of freedom or the

standard normal distribution if e(df_r) is missing.

Examples Setup

. webuse regress . regress y x1 x2 x3

Estimate linear combinations of coefficients . lincom x2-x1

. lincom 3*x1 + 500*x3 . lincom 3*x1 + 500*x3 - 12

--- Setup

. webuse lbw

Fit logistic regression, reporting coefficients . logit low age lwt i.race smoke ptl ht ui

Estimate linear combination of coefficients; report odds ratio . lincom 2.race+smoke, or

Fit logistic regression, reporting odds ratios . logistic low age lwt i.race smoke ptl ht ui lincom after logistic reports odds ratios by default . lincom 2.race+smoke

--- Setup

. webuse sysdsn1

. mlogit insure age male nonwhite i.site

Estimate linear combination of coefficients from Prepaid equation . lincom [Prepaid]male + [Prepaid]nonwhite

(12)

Kembali menggunakan Carter, mulai ch 5

. use "C:\Users\Windows 10 Gamer.PURWANTO\Desktop\Using Stata\Data POT\andy.dta", clear

. summarize

Variable | Obs Mean Std. Dev. Min Max ---+--- sales | 75 77.37467 6.488537 62.4 91.2 price | 75 5.6872 .518432 4.83 6.49 advert | 75 1.844 .8316769 .5 3.1

describe

Contains data from C:\Users\Windows 10 Gamer.PURWANTO\Desktop\Using Stata\Data POT\andy.dta

obs: 75 vars: 3 size: 1,800

--- storage display value

variable name type format label variable label

--- sales double %10.0g Monthly sales revenue ($1000s)

price double %10.0g A price index for all products sold in a given month.

advert double %10.0g Expenditure on advertising ($1000s) --- Sorted by:

Regresi

. regress sales price advert

Source | SS df MS Number of obs = 75 ---+--- F(2, 72) = 29.25 Model | 1396.53893 2 698.269465 Prob > F = 0.0000 Residual | 1718.94294 72 23.8742075 R-squared = 0.4483 ---+--- Adj R-squared = 0.4329 Total | 3115.48187 74 42.1011063 Root MSE = 4.8861 --- sales | Coef. Std. Err. t P>|t| [95% Conf. Interval]

---+--- price | -7.907854 1.095993 -7.22 0.000 -10.09268 -5.723032 advert | 1.862584 .6831955 2.73 0.008 .500659 3.22451 _cons | 118.9136 6.351638 18.72 0.000 106.2519 131.5754 ---

(13)

Confidence interval 99%

. regress sales price advert, level(99) dinyatakan dalam 99

Source | SS df MS Number of obs = 75 ---+--- F(2, 72) = 29.25 Model | 1396.53893 2 698.269465 Prob > F = 0.0000 Residual | 1718.94294 72 23.8742075 R-squared = 0.4483 ---+--- Adj R-squared = 0.4329 Total | 3115.48187 74 42.1011063 Root MSE = 4.8861 --- sales | Coef. Std. Err. t P>|t| [99% Conf. Interval]

---+--- price | -7.907854 1.095993 -7.22 0.000 -10.80769 -5.008019 advert | 1.862584 .6831955 2.73 0.008 .0549502 3.670218 _cons | 118.9136 6.351638 18.72 0.000 102.1081 135.7191 --- . regress sales price advert, level(99) noconstant  konstanta dihilangkan Source | SS df MS Number of obs = 75 ---+--- F(2, 73) = 1599.55 Model | 442041.486 2 221020.743 Prob > F = 0.0000 Residual | 10086.9239 73 138.17704 R-squared = 0.9777 ---+--- Adj R-squared = 0.9771 Total | 452128.41 75 6028.3788 Root MSE = 11.755 --- sales | Coef. Std. Err. t P>|t| [99% Conf. Interval]

---+--- price | 12.12089 .5728601 21.16 0.000 10.60575 13.63603 advert | 4.068586 1.618979 2.51 0.014 -.2134001 8.350572 --- . regress sales price advert

Source | SS df MS Number of obs = 75 ---+--- F(2, 72) = 29.25 Model | 1396.53893 2 698.269465 Prob > F = 0.0000 Residual | 1718.94294 72 23.8742075 R-squared = 0.4483 ---+--- Adj R-squared = 0.4329 Total | 3115.48187 74 42.1011063 Root MSE = 4.8861 --- sales | Coef. Std. Err. t P>|t| [95% Conf. Interval]

---+--- price | -7.907854 1.095993 -7.22 0.000 -10.09268 -5.723032 advert | 1.862584 .6831955 2.73 0.008 .500659 3.22451 _cons | 118.9136 6.351638 18.72 0.000 106.2519 131.5754 --- . estat vce

Covariance matrix of coefficients of regress model e(V) | price advert _cons ---+--- price | 1.2012007 advert | -.01974215 .46675606 _cons | -6.7950641 -.7484206 40.343299

(14)

Var(b1) = 1.2012007

sb1 = 1.09599302  sb1 price

Var(b2) = .46675606  sb2 = 0.683195477  sb advert Var(b3) = 40.343299  sb3 = 6.351637505  sb constanta

Menggunakan variable dummy

. use "C:\Users\Windows 10 Gamer.PURWANTO\Desktop\Using Stata\mus\mus03data.dta", clear

. summ

Variable | Obs Mean Std. Dev. Min Max ---+--- dupersid | 3,064 6.24e+07 3.43e+07 2.00e+07 9.83e+07

year03 | 3,064 1 0 1 1

age | 3,064 74.17167 6.372938 65 90

famsze | 3,064 1.907963 .9883496 1 13

educyr | 3,064 11.77546 3.435878 0 17

---+--- totexp | 3,064 7030.889 11852.75 0 125610

private | 3,064 .5812663 .4934321 0 1

retire | 3,064 .5946475 .4910403 0 1

female | 3,064 .5796345 .4936982 0 1

white | 3,064 .9742167 .1585141 0 1

---+--- hisp | 3,064 .0848564 .2787134 0 1

marry | 3,064 .5558094 .4969567 0 1

northe | 3,064 .1517624 .358849 0 1

mwest | 3,064 .2310705 .4215862 0 1

south | 3,064 .3962141 .4891897 0 1

---+--- phylim | 3,064 .4255875 .4945125 0 1

(15)

actlim | 3,064 .2836162 .4508263 0 1

msa | 3,064 .7415144 .4378737 0 1

income | 3,064 22.47472 22.53491 -1 312.46 injury | 3,064 .1964752 .3973968 0 1

---+--- priolist | 3,064 .8028721 .3978947 0 1

totchr | 3,064 1.754243 1.307197 0 7

omc | 3,064 .4461488 .4971727 0 1

hmo | 3,064 .1158616 .3201111 0 1

mnc | 3,064 .0192559 .1374454 0 1

---+--- ratio | 3,064 .0120952 .0958159 0 1

posexp | 3,064 .9644256 .1852568 0 1

suppins | 3,064 .5812663 .4934321 0 1

hvgg | 3,064 .6054178 .4888406 0 1

hfp | 3,064 .2078982 .4216508 0 2

---+--- ltotexp | 2,955 8.059866 1.367592 1.098612 11.74094 hins | 1,506 1 0 1 1

hdem | 1,737 1 0 1 1

. regress dupersid age famsze totexp retire female Source | SS df MS Number of obs = 3,064 ---+--- F(5, 3058) = 1.15 Model | 6.7603e+15 5 1.3521e+15 Prob > F = 0.3329 Residual | 3.6031e+18 3,058 1.1783e+15 R-squared = 0.0019 ---+--- Adj R-squared = 0.0002 Total | 3.6099e+18 3,063 1.1786e+15 Root MSE = 3.4e+07 --- dupersid | Coef. Std. Err. t P>|t| [95% Conf. Interval] ---+--- age | 39025.09 99033.1 0.39 0.694 -155153.1 233203.3 famsze | 679284.8 644606.1 1.05 0.292 -584620.2 1943190

totexp | 11.62878 52.43965 0.22 0.825 -91.19174 114.4493 retire | -2682542 1332020 -2.01 0.044 -5294287 -70796.6 female | -413713.4 1333963 -0.31 0.756 -3029268 2201841 _cons | 6.00e+07 7699985 7.79 0.000 4.49e+07 7.51e+07 ---

Age, famsze, totexp  variable continuous  disingkat c Retire, female  variable dummy atau discret  disingkat i Maka interaksi antara Age dengan famsze menjadi c.age#c.famsze Interaksi antara Age dengan retire  c.age#i.retire

Interaksi antara tetire dengan female  i.retire#i.female

(16)

. regress dupersid age famsze totexp retire female c.famsze#c.age

Source | SS df MS Number of obs = 3,064 ---+--- F(6, 3057) = 1.25 Model | 8.8295e+15 6 1.4716e+15 Prob > F = 0.2778 Residual | 3.6011e+18 3,057 1.1780e+15 R-squared = 0.0024 ---+--- Adj R-squared = 0.0005 Total | 3.6099e+18 3,063 1.1786e+15 Root MSE = 3.4e+07 --- dupersid | Coef. Std. Err. t P>|t| [95% Conf. Interval]

---+--- age | -198092.8 204484.3 -0.97 0.333 -599033.5 202847.9 famsze | -8948212 7292660 -1.23 0.220 -2.32e+07 5350800 totexp | 12.46506 52.43696 0.24 0.812 -90.35021 115.2803 retire | -2672632 1331876 -2.01 0.045 -5284095 -61167.86 female | -299693.2 1336569 -0.22 0.823 -2920359 2320972 |

c.famsze#c.age | 131609.4 99301.72 1.33 0.185 -63095.45 326314.3 |

_cons | 7.74e+07 1.52e+07 5.09 0.000 4.75e+07 1.07e+08 --- . regress dupersid age famsze totexp retire female c.famsze#i.female i.female#i.retire note: 1.female#0b.retire omitted because of collinearity

note: 1.female#1.retire omitted because of collinearity

Source | SS df MS Number of obs = 3,064 ---+--- F(7, 3056) = 0.98 Model | 8.0577e+15 7 1.1511e+15 Prob > F = 0.4463 Residual | 3.6018e+18 3,056 1.1786e+15 R-squared = 0.0022 ---+--- Adj R-squared = -0.0001 Total | 3.6099e+18 3,063 1.1786e+15 Root MSE = 3.4e+07 --- dupersid | Coef. Std. Err. t P>|t| [95% Conf. Interval]

---+--- age | 40577.15 99327.14 0.41 0.683 -154177.6 235331.9 famsze | -40809.15 1025402 -0.04 0.968 -2051356 1969738 totexp | 10.62807 52.4586 0.20 0.839 -92.22963 113.4858 retire | -3094810 1649019 -1.88 0.061 -6328108 138487.3 female | -1783345 3555078 -0.50 0.616 -8753930 5187241 |

female#c.famsze |

1 | 1157836 1309372 0.88 0.377 -1409502 3725174 |

female#retire |

0 1 | 1335085 2800940 0.48 0.634 -4156831 6827002 1 0 | 0 (omitted)

1 1 | 0 (omitted) |

_cons | 6.06e+07 7875101 7.70 0.000 4.52e+07 7.61e+07 --- . regress dupersid age famsze totexp c.famsze#i.female i.female#i.retire

Source | SS df MS Number of obs = 3,064 ---+--- F(7, 3056) = 0.98 Model | 8.0577e+15 7 1.1511e+15 Prob > F = 0.4463 Residual | 3.6018e+18 3,056 1.1786e+15 R-squared = 0.0022 ---+--- Adj R-squared = -0.0001 Total | 3.6099e+18 3,063 1.1786e+15 Root MSE = 3.4e+07

(17)

--- dupersid | Coef. Std. Err. t P>|t| [95% Conf. Interval]

---+--- age | 40577.15 99327.14 0.41 0.683 -154177.6 235331.9 famsze | -40809.15 1025402 -0.04 0.968 -2051356 1969738 totexp | 10.62807 52.4586 0.20 0.839 -92.22963 113.4858 |

female#c.famsze |

1 | 1157836 1309372 0.88 0.377 -1409502 3725174 |

female#retire |

0 1 | -1759725 2264677 -0.78 0.437 -6200170 2680719 1 0 | -1783345 3555078 -0.50 0.616 -8753930 5187241 1 1 | -4878155 3478195 -1.40 0.161 -1.17e+07 1941684 |

_cons | 6.06e+07 7875101 7.70 0.000 4.52e+07 7.61e+07 . regress dupersid age famsze totexp c.famsze#i.female i.female##i.retire

Source | SS df MS Number of obs = 3,064 ---+--- F(7, 3056) = 0.98 Model | 8.0577e+15 7 1.1511e+15 Prob > F = 0.4463 Residual | 3.6018e+18 3,056 1.1786e+15 R-squared = 0.0022 ---+--- Adj R-squared = -0.0001 Total | 3.6099e+18 3,063 1.1786e+15 Root MSE = 3.4e+07 --- dupersid | Coef. Std. Err. t P>|t| [95% Conf. Interval]

---+--- age | 40577.15 99327.14 0.41 0.683 -154177.6 235331.9 famsze | -40809.15 1025402 -0.04 0.968 -2051356 1969738 totexp | 10.62807 52.4586 0.20 0.839 -92.22963 113.4858 |

female#c.famsze |

1 | 1157836 1309372 0.88 0.377 -1409502 3725174 |

1.female | -1783345 3555078 -0.50 0.616 -8753930 5187241 1.retire | -1759725 2264677 -0.78 0.437 -6200170 2680719 |

female#retire |

1 1 | -1335085 2800940 -0.48 0.634 -6827002 4156831 |

_cons | 6.06e+07 7875101 7.70 0.000 4.52e+07 7.61e+07 --- Pendugaan Variabel Indikator

. use "C:\Users\Windows 10 Gamer.PURWANTO\Desktop\Using Stata\Data POT\utown.dta", clear

. describe

Contains data from C:\Users\Windows 10 Gamer.PURWANTO\Desktop\Using Stata\Data POT\utown.dta

obs: 1,000 vars: 6 size: 20,000

--- ---

storage display value

variable name type format label variable label

--- ---

(18)

price double %10.0g house price, in $1000

sqft double %10.0g square feet of living area, in 100s age byte %8.0g house age, in years

utown byte %8.0g =1 if close to university pool byte %8.0g =1 if house has pool fplace byte %8.0g =1 if house has fireplace

--- ---

Sorted by:

. summarize

Variable | Obs Mean Std. Dev. Min Max ---+--- price | 1,000 247.6557 42.19273 134.316 345.197 sqft | 1,000 25.20965 2.91848 20.03 30 age | 1,000 9.392 9.426728 0 60 utown | 1,000 .519 .4998889 0 1 pool | 1,000 .204 .4031706 0 1 ---+--- fplace | 1,000 .518 .4999259 0 1 .

Model

PRICE=β

1

+ δ

1

UTOWN+γ ( SQFT × UTOWN )+β

2

SQFT +δ

2

POOL+δ

3

PLACE

. regress price i.utown sqft i.utown#c.sqft age i.pool i.fplace

Source | SS df MS Number of obs = 1,000 ---+--- F(6, 993) = 1113.18 Model | 1548261.71 6 258043.619 Prob > F = 0.0000 Residual | 230184.426 993 231.807076 R-squared = 0.8706 ---+--- Adj R-squared = 0.8698 Total | 1778446.14 999 1780.22637 Root MSE = 15.225 --- price | Coef. Std. Err. t P>|t| [95% Conf. Interval]

---+--- 1.utown | 27.45295 8.422582 3.26 0.001 10.92485 43.98106 sqft | 7.612177 .2451765 31.05 0.000 7.131053 8.0933 |

utown#c.sqft |

1 | 1.299405 .3320478 3.91 0.000 .6478091 1.951001 |

age | -.1900864 .0512046 -3.71 0.000 -.2905681 -.0896048 1.pool | 4.377163 1.196692 3.66 0.000 2.028828 6.725498 1.fplace | 1.649176 .9719568 1.70 0.090 -.2581495 3.556501 _cons | 24.49998 6.191721 3.96 0.000 12.34962 36.65035 --- regress price i.utown sqft i.utown#c.sqft age i.pool i.fplace  model ini i,town sqft muncul dua kali, sehingga dapat diringkas menjadi

. regress price i.utown##c.sqft age i.pool i.fplace

Source | SS df MS Number of obs = 1,000 ---+--- F(6, 993) = 1113.18 Model | 1548261.71 6 258043.619 Prob > F = 0.0000 Residual | 230184.426 993 231.807076 R-squared = 0.8706 ---+--- Adj R-squared = 0.8698

(19)

Total | 1778446.14 999 1780.22637 Root MSE = 15.225 --- price | Coef. Std. Err. t P>|t| [95% Conf. Interval]

---+--- 1.utown | 27.45295 8.422582 3.26 0.001 10.92485 43.98106 sqft | 7.612177 .2451765 31.05 0.000 7.131053 8.0933 |

utown#c.sqft |

1 | 1.299405 .3320478 3.91 0.000 .6478091 1.951001 |

age | -.1900864 .0512046 -3.71 0.000 -.2905681 -.0896048 1.pool | 4.377163 1.196692 3.66 0.000 2.028828 6.725498 1.fplace | 1.649176 .9719568 1.70 0.090 -.2581495 3.556501 _cons | 24.49998 6.191721 3.96 0.000 12.34962 36.65035 --- Pendugaan untuk PRICE, dekat dengan universitas (utown =1)

PRICE=β

1

+ δ

1

UTOWN+γ ( SQFT × UTOWN )+β

2

SQFT +δ

2

POOL+δ

3

PLACE PRICE=(β

1

+ δ

1

) UTOWN +(γ+β

2

) SQFT +δ

2

POOL+δ

3

PLACE

PRICE = (24.4999+27.45295)

UTOWN

+ (1.299405+7.612177)*SQFT+4.377163*POOL +1.649176*PLCE -.1900864*AGE

test 1.utown ( 1) 1.utown = 0

F( 1, 993) = 10.62 Prob > F = 0.0012 . test 1.utown 1.utown#c.sqft ( 1) 1.utown = 0

( 2) 1.utown#c.sqft = 0 F( 2, 993) = 1954.83 Prob > F = 0.0000

. lincom _cons +1.utown ( 1) 1.utown + _cons = 0

--- price | Coef. Std. Err. t P>|t| [95% Conf. Interval]

---+--- (1) | 51.95294 5.767235 9.01 0.000 40.63557 63.2703 --- . describe

Contains data from C:\Users\Windows 10 Gamer.PURWANTO\Desktop\Using Stata\Data POT\cps4_small.dta

obs: 1,000 vars: 12 size: 19,000

(20)

--- ---

storage display value

variable name type format label variable label

--- ---

wage double %10.0g earnings per hour educ byte %8.0g years of education

exper byte %8.0g post education years experience hrswk byte %8.0g usual hours worked per week married byte %8.0g = 1 if married

female byte %8.0g = 1 if female

metro byte %8.0g = 1 if lives in metropolitan area midwest byte %8.0g = 1 if lives in midwest

south byte %8.0g = 1 if lives in south west byte %8.0g = 1 if lives in west black byte %8.0g = 1 if black

asian byte %8.0g = 1 if asian

--- ---

Sorted by:

. summarize

Variable | Obs Mean Std. Dev. Min Max ---+--- wage | 1,000 20.61566 12.83472 1.97 76.39

educ | 1,000 13.799 2.711079 0 21

exper | 1,000 26.508 12.85446 2 65

hrswk | 1,000 39.952 10.3353 0 90

married | 1,000 .581 .4936423 0 1

---+--- female | 1,000 .514 .5000541 0 1

metro | 1,000 .78 .4144536 0 1

midwest | 1,000 .24 .4272968 0 1

south | 1,000 .296 .4567194 0 1

west | 1,000 .24 .4272968 0 1

---+--- black | 1,000 .112 .3155243 0 1

asian | 1,000 .043 .2029586 0 1 Model

WAGE=β

1

+ β

2

EDUC+δ

1

¿+ δ

2

FEMALE+γ( ¿× FEMALE)

(21)

. regress wage educ i.black##i.female

Source | SS df MS Number of obs = 1,000 ---+--- F(4, 995) = 65.67 Model | 34370.7606 4 8592.69016 Prob > F = 0.0000 Residual | 130194.667 995 130.848912 R-squared = 0.2089 ---+--- Adj R-squared = 0.2057 Total | 164565.428 999 164.730158 Root MSE = 11.439 --- wage | Coef. Std. Err. t P>|t| [95% Conf. Interval]

---+--- educ | 2.070391 .1348781 15.35 0.000 1.805712 2.335069 1.black | -4.169077 1.774714 -2.35 0.019 -7.651689 -.6864656 1.female | -4.784607 .7734139 -6.19 0.000 -6.302317 -3.266898 |

black#female |

1 1 | 3.844294 2.327653 1.65 0.099 -.7233779 8.411966 |

_cons | -5.281159 1.900468 -2.78 0.006 -9.010544 -1.551774 --- Root MSE = 11.439

MSE =

Persamaan WHITE – MALE

Wage = -5.281159 + 2.070391 EDUC BLACK – MALE

Wage = (-5.281159 -4.169077)+ 2.070391 EDUC WHITE – FEMALE

Wage = (-5.281159 - -4.784607) + 2.070391 EDUC BLACK – FEMALE

Wage = (-5.281159+-4.169077 --4.784607+3.844294) + 2.070391 EDUC

Pengujian perbedaan WAGE WHITE laki-laki dengan BLACK perempuan . lincom 1.black + 1.female + 1.black#1.female

( 1) 1.black + 1.female + 1.black#1.female = 0

--- wage | Coef. Std. Err. t P>|t| [95% Conf. Interval]

---+--- (1) | -5.10939 1.510567 -3.38 0.001 -8.073652 -2.145128 --- . test 1.female 1.black 1.black#1.female

( 1) 1.female = 0 ( 2) 1.black = 0

(22)

( 3) 1.black#1.female = 0 F( 3, 995) = 14.21 Prob > F = 0.0000

. . bysort south: reg wage educ i.black##i.female

--- -> south = 0

Source | SS df MS Number of obs = 704 ---+--- F(4, 699) = 49.72 Model | 25346.0083 4 6336.50209 Prob > F = 0.0000 Residual | 89088.4615 699 127.451304 R-squared = 0.2215 ---+--- Adj R-squared = 0.2170 Total | 114434.47 703 162.780185 Root MSE = 11.289 --- wage | Coef. Std. Err. t P>|t| [95% Conf. Interval]

---+--- educ | 2.172554 .1640077 13.25 0.000 1.850547 2.49456 1.black | -5.08936 2.604061 -1.95 0.051 -10.20208 .0233585 1.female | -5.005078 .8857423 -5.65 0.000 -6.744112 -3.266044 |

black#female |

1 1 | 5.305574 3.445664 1.54 0.124 -1.459516 12.07066 |

_cons | -6.605572 2.30215 -2.87 0.004 -11.12553 -2.085615 ---

--- -> south = 1

Source | SS df MS Number of obs = 296 ---+--- F(4, 291) = 16.43 Model | 9234.26014 4 2308.56503 Prob > F = 0.0000 Residual | 40895.9474 291 140.535902 R-squared = 0.1842 ---+--- Adj R-squared = 0.1730 Total | 50130.2075 295 169.932907 Root MSE = 11.855 --- wage | Coef. Std. Err. t P>|t| [95% Conf. Interval]

---+--- educ | 1.864013 .2402682 7.76 0.000 1.391129 2.336896 1.black | -3.384964 2.579268 -1.31 0.190 -8.46135 1.691422 1.female | -4.103958 1.580621 -2.60 0.010 -7.214857 -.993059 |

black#female |

1 1 | 2.36974 3.382739 0.70 0.484 -4.287995 9.027476 |

_cons | -2.661662 3.420413 -0.78 0.437 -9.393547 4.070223 --- .

. reg wage educ i.black##i.female i.south

Source | SS df MS Number of obs = 1,000 ---+--- F(5, 994) = 52.49 Model | 34374.1154 5 6874.82308 Prob > F = 0.0000 Residual | 130191.312 994 130.977175 R-squared = 0.2089 ---+--- Adj R-squared = 0.2049 Total | 164565.428 999 164.730158 Root MSE = 11.445

(23)

--- wage | Coef. Std. Err. t P>|t| [95% Conf. Interval]

---+--- educ | 2.06961 .1350322 15.33 0.000 1.804629 2.334591 1.black | -4.209441 1.793406 -2.35 0.019 -7.728737 -.6901442 1.female | -4.784337 .7737947 -6.18 0.000 -6.302795 -3.265878 |

black#female |

1 1 | 3.841436 2.328862 1.65 0.099 -.7286144 8.411486 |

1.south | .130196 .8135153 0.16 0.873 -1.466209 1.726601 _cons | -5.304359 1.906917 -2.78 0.006 -9.046404 -1.562314 --- Menguji pengaruh

. regress wage educ i.black##i.female

Source | SS df MS Number of obs = 1,000 ---+--- F(4, 995) = 65.67 Model | 34370.7606 4 8592.69016 Prob > F = 0.0000 Residual | 130194.667 995 130.848912 R-squared = 0.2089 ---+--- Adj R-squared = 0.2057 Total | 164565.428 999 164.730158 Root MSE = 11.439 --- wage | Coef. Std. Err. t P>|t| [95% Conf. Interval]

---+--- educ | 2.070391 .1348781 15.35 0.000 1.805712 2.335069 1.black | -4.169077 1.774714 -2.35 0.019 -7.651689 -.6864656 1.female | -4.784607 .7734139 -6.19 0.000 -6.302317 -3.266898 |

black#female |

1 1 | 3.844294 2.327653 1.65 0.099 -.7233779 8.411966 |

_cons | -5.281159 1.900468 -2.78 0.006 -9.010544 -1.551774 Root MSE = 11.439

MSE = 11.4392 = 130.8507 n = 1000

k = 4

n – k – 1 = 1000 – 4 -1 = 995

SSE = MSEx(n-k-1) = 130.8507*955 = 130196.5

(24)

. regress wage educ

Source | SS df MS Number of obs = 1,000 ---+--- F(1, 998) = 211.66 Model | 28794.2878 1 28794.2878 Prob > F = 0.0000 Residual | 135771.14 998 136.043226 R-squared = 0.1750 ---+--- Adj R-squared = 0.1741 Total | 164565.428 999 164.730158 Root MSE = 11.664 --- wage | Coef. Std. Err. t P>|t| [95% Conf. Interval]

---+--- educ | 1.980288 .1361174 14.55 0.000 1.713178 2.247397 _cons | -6.710328 1.914156 -3.51 0.000 -10.46656 -2.954096 --- Root MSE = 11.664

MSE = 11.6642 = 136.0489 n = 1000

k = 1

n – k – 1 = 1000 – 1 -1 =998

SSE = MSEx(n-k-1) = 130.8507*998 = 135776.8 J = 4 – 1 = 3

SSER = 135776.8 SSEu = 130196.5

SS E

U

(n−k −1)

¿

F= (SS E

R

SS E

U

)/ J

¿

F= (13776.8−130196.5)/3 130196.5/995 =¿

16 Juni 2019

summa

Variable | Obs Mean Std. Dev. Min Max ---+--- wage | 1,000 20.61566 12.83472 1.97 76.39 educ | 1,000 13.799 2.711079 0 21 exper | 1,000 26.508 12.85446 2 65 hrswk | 1,000 39.952 10.3353 0 90 married | 1,000 .581 .4936423 0 1 ---+---

(25)

female | 1,000 .514 .5000541 0 1 metro | 1,000 .78 .4144536 0 1 midwest | 1,000 .24 .4272968 0 1 south | 1,000 .296 .4567194 0 1 west | 1,000 .24 .4272968 0 1 ---+--- black | 1,000 .112 .3155243 0 1 asian | 1,000 .043 .2029586 0 1 . regress wage educ west midwest south

Source | SS df MS Number of obs = 1,000 ---+--- F(4, 995) = 56.84 Model | 30611.0977 4 7652.77442 Prob > F = 0.0000 Residual | 133954.33 995 134.627467 R-squared = 0.1860 ---+--- Adj R-squared = 0.1827 Total | 164565.428 999 164.730158 Root MSE = 11.603 --- wage | Coef. Std. Err. t P>|t| [95% Conf. Interval]

---+--- educ | 1.982838 .1356373 14.62 0.000 1.71667 2.249006 west | 1.160497 1.079364 1.08 0.283 -.9575936 3.278588 midwest | -2.629239 1.078689 -2.44 0.015 -4.746005 -.5124721 south | -.7308785 1.027618 -0.71 0.477 -2.747426 1.285669 _cons | -6.17668 2.050517 -3.01 0.003 -10.20051 -2.152846 --- .

EDUC – WEST

Wage = (-6.17668+1.160497) + 1.160497EDUC EDUC – MIDWSET

Wage = (-6.17668-2.629239) + 1.160497EDUC EDUC – SOUTH

Wage = (-6.17668-.7308785) + 1.160497EDUC EDUC – NORTHEAST

Wage = -6.17668 + 1.160497EDUC Pengujian kesamaan 2 regresi

(26)

. regress wage i.south##(c.educ i.black##i.female)

Source | SS df MS Number of obs = 1,000 ---+--- F(9, 990) = 29.26 Model | 34581.0189 9 3842.33543 Prob > F = 0.0000 Residual | 129984.409 990 131.297383 R-squared = 0.2101 ---+--- Adj R-squared = 0.2030 Total | 164565.428 999 164.730158 Root MSE = 11.459 --- wage | Coef. Std. Err. t P>|t| [95% Conf. Interval]

---+--- 1.south | 3.94391 4.048453 0.97 0.330 -4.000625 11.88845 educ | 2.172554 .1664639 13.05 0.000 1.845891 2.499216 1.black | -5.08936 2.64306 -1.93 0.054 -10.276 .0972837 1.female | -5.005078 .8990074 -5.57 0.000 -6.769257 -3.240899 |

black#female |

1 1 | 5.305574 3.497267 1.52 0.130 -1.557333 12.16848 |

south#c.educ |

1 | -.308541 .2857343 -1.08 0.280 -.8692554 .2521734 |

south#black |

1 1 | 1.704396 3.633327 0.47 0.639 -5.42551 8.834302 |

south#female |

1 1 | .9011198 1.772665 0.51 0.611 -2.577492 4.379732 |

south#black#female |

1 1 1 | -2.935834 4.787647 -0.61 0.540 -12.33094 6.459268 |

_cons | -6.605572 2.336628 -2.83 0.005 -11.19088 -2.02026 ---

(27)
(28)

Pengaruh perlakuan

. use "C:\Users\Windows 10 Gamer.PURWANTO\Desktop\Using Stata\Data POT\star.dta", clear

. summa

Variable | Obs Mean Std. Dev. Min Max ---+--- id | 5,786 15593.06 2694.317 10133 21580 schid | 5,786 211001.8 38381.93 112038 264945 tchid | 5,786 2.11e+07 3838193 1.12e+07 2.65e+07 tchexper | 5,766 9.306452 5.767684 0 27 absent | 5,765 10.27511 9.27064 0 79 ---+--- readscore | 5,786 436.7297 31.71347 315 627 mathscore | 5,786 485.599 47.69394 320 626 totalscore | 5,786 922.3287 73.7466 635 1253 boy | 5,786 .5134808 .4998614 0 1 white_asian | 5,786 .6766333 .4678018 0 1 ---+--- black | 5,786 .3209471 .4668809 0 1 tchwhite | 5,786 .8354649 .3707925 0 1 tchmasters | 5,786 .351711 .4775456 0 1 freelunch | 5,786 .4816799 .4997074 0 1 schurban | 5,786 .3128241 .4636834 0 1 ---+--- schrural | 5,786 .4709644 .4991994 0 1 small | 5,786 .3003802 .4584629 0 1 regular | 5,786 .3465261 .4759043 0 1 aide | 5,786 .3530937 .4779728 0 1

. drop if aide==1

(2,043 observations deleted) . summa

Variable | Obs Mean Std. Dev. Min Max ---+--- id | 3,743 15601.07 2684.69 10263 21580 schid | 3,743 211030.3 38269.99 112038 264945 tchid | 3,743 2.11e+07 3826999 1.12e+07 2.65e+07 tchexper | 3,743 9.034464 5.727104 0 27 absent | 3,733 10.08117 9.052402 0 79 ---+--- readscore | 3,743 437.4347 31.80723 315 627 mathscore | 3,743 487.062 48.56821 320 626 totalscore | 3,743 924.4967 74.96196 635 1253 boy | 3,743 .5140262 .49987 0 1

(29)

white_asian | 3,743 .6828747 .4654189 0 1 ---+--- black | 3,743 .3144536 .4643599 0 1 tchwhite | 3,743 .8279455 .3774782 0 1 tchmasters | 3,743 .3430403 .4747883 0 1 freelunch | 3,743 .4728827 .4993308 0 1 schurban | 3,743 .3034999 .4598306 0 1 ---+--- schrural | 3,743 .4825007 .4997604 0 1 small | 3,743 .4643334 .4987929 0 1 regular | 3,743 .5356666 .4987929 0 1 aide | 3,743 0 0 0 0

Penggunn global . global x1list small

. global x2list x1list tchexper . global x2list $x1list tchexper

. global x3list $x2list boy freelunch white_asian

global x4list $x3list tchwhite tchmasters schurban schrural . summa $x1list

Variable | Obs Mean Std. Dev. Min Max ---+--- small | 3,743 .4643334 .4987929 0 1 . summarize $x2list

Variable | Obs Mean Std. Dev. Min Max ---+--- small | 3,743 .4643334 .4987929 0 1 tchexper | 3,743 9.034464 5.727104 0 27 . summarize $x3list

Variable | Obs Mean Std. Dev. Min Max ---+--- small | 3,743 .4643334 .4987929 0 1 tchexper | 3,743 9.034464 5.727104 0 27 boy | 3,743 .5140262 .49987 0 1 freelunch | 3,743 .4728827 .4993308 0 1 white_asian | 3,743 .6828747 .4654189 0 1

. summarize $x4list

Variable | Obs Mean Std. Dev. Min Max ---+--- small | 3,743 .4643334 .4987929 0 1 tchexper | 3,743 9.034464 5.727104 0 27 boy | 3,743 .5140262 .49987 0 1 freelunch | 3,743 .4728827 .4993308 0 1

(30)

white_asian | 3,743 .6828747 .4654189 0 1 ---+--- tchwhite | 3,743 .8279455 .3774782 0 1 tchmasters | 3,743 .3430403 .4747883 0 1 schurban | 3,743 .3034999 .4598306 0 1 schrural | 3,743 .4825007 .4997604 0 1 . pwcorr $x3list

| small tchexper boy freelu~h white_~n ---+--- small | 1.0000

tchexper | -0.0064 1.0000

boy | 0.0017 -0.0341 1.0000

freelunch | -0.0020 -0.0969 0.0066 1.0000

white_asian | 0.0036 0.1286 0.0231 -0.4378 1.0000 . pwcorr $x4list

| small tchexper boy freelu~h white_~n tchwhite tchmas~s ---+--- small | 1.0000

tchexper | -0.0064 1.0000

boy | 0.0017 -0.0341 1.0000

freelunch | -0.0020 -0.0969 0.0066 1.0000

white_asian | 0.0036 0.1286 0.0231 -0.4378 1.0000

tchwhite | 0.0852 0.0177 0.0085 -0.1836 0.4332 1.0000

tchmasters | -0.0499 0.2274 0.0022 -0.0814 0.1454 0.1609 1.0000 schurban | 0.0053 -0.1794 0.0012 0.3385 -0.5803 -0.3719 -0.0902 schrural | -0.0371 0.0754 0.0071 -0.1371 0.5270 0.3495 0.0951 | schurban schrural

---+--- schurban | 1.0000

schrural | -0.6374 1.0000

TIME SERIES

. use "C:\Users\Windows 10 Gamer.PURWANTO\Desktop\Using Stata\Data POT\okun.dta", clear

. generate date =tq(1985q2) +_n-1 . list date in 1/10

+---+

| date | |---|

1. | 101 | 2. | 102 | 3. | 103 | 4. | 104 | 5. | 105 | |---|

6. | 106 | 7. | 107 | 8. | 108 | 9. | 109 | 10. | 110 | +---+

(31)

. format %tq date . list date in 1/10 +---+

| date | |---|

1. | 1985q2 | 2. | 1985q3 | 3. | 1985q4 | 4. | 1986q1 | 5. | 1986q2 | |---|

6. | 1986q3 | 7. | 1986q4 | 8. | 1987q1 | 9. | 1987q2 | 10. | 1987q3 | +---+

.

. tsset date

time variable: date, 1985q2 to 2009q3 delta: 1 quarter

. label var u "% Unemployment"

. label var g "% GDP Growth"

. tsline u g, lpattern (solid dash)

-50510

1985q1 1990q1 1995q1 2000q1 2005q1 2010q1

date

% Unemployment % GDP Growth

(32)

. list date u L.u L2.u D.u D2.u in 1/10 +---+

| L. L2. D. D2.|

| date u u u u u | |---|

1. | 1985q2 7.3 . . . . | 2. | 1985q3 7.2 7.3 . -.1 . | 3. | 1985q4 7 7.2 7.3 -.2 -.1 | 4. | 1986q1 7 7 7.2 0 .2 | 5. | 1986q2 7.2 7 7 .2 .2 | |---|

6. | 1986q3 7 7.2 7 -.2 -.4 | 7. | 1986q4 6.8 7 7.2 -.2 0 | 8. | 1987q1 6.6 6.8 7 -.2 0 | 9. | 1987q2 6.3 6.6 6.8 -.3 -.1 | 10. | 1987q3 6 6.3 6.6 -.3 0 | +---+

. list date L(0/1).u D.u L(0/3).g in 1/10

+---+

| L. D. L. L2. L3.|

| date u u u g g g g | |---|

1. | 1985q2 7.3 . . 1.4 . . . | 2. | 1985q3 7.2 7.3 -.1 2 1.4 . . | 3. | 1985q4 7 7.2 -.2 1.4 2 1.4 . | 4. | 1986q1 7 7 0 1.5 1.4 2 1.4 | 5. | 1986q2 7.2 7 .2 .9 1.5 1.4 2 | |---|

6. | 1986q3 7 7.2 -.2 1.5 .9 1.5 1.4 | 7. | 1986q4 6.8 7 -.2 1.2 1.5 .9 1.5 | 8. | 1987q1 6.6 6.8 -.2 1.5 1.2 1.5 .9 | 9. | 1987q2 6.3 6.6 -.3 1.6 1.5 1.2 1.5 | 10. | 1987q3 6 6.3 -.3 1.7 1.6 1.5 1.2 | +---+

(33)

. list date L(0/1).u D(0/1).u L(0/3).g in 1/10

+---+

| L. D. L. L2. L3.|

| date u u u u g g g g | |---|

1. | 1985q2 7.3 . 7.3 . 1.4 . . . | 2. | 1985q3 7.2 7.3 7.2 -.1 2 1.4 . . | 3. | 1985q4 7 7.2 7 -.2 1.4 2 1.4 . | 4. | 1986q1 7 7 7 0 1.5 1.4 2 1.4 | 5. | 1986q2 7.2 7 7.2 .2 .9 1.5 1.4 2 | |---|

6. | 1986q3 7 7.2 7 -.2 1.5 .9 1.5 1.4 | 7. | 1986q4 6.8 7 6.8 -.2 1.2 1.5 .9 1.5 | 8. | 1987q1 6.6 6.8 6.6 -.2 1.5 1.2 1.5 .9 | 9. | 1987q2 6.3 6.6 6.3 -.3 1.6 1.5 1.2 1.5 | 10. | 1987q3 6 6.3 6 -.3 1.7 1.6 1.5 1.2 | +---+

. list date L(0/1).u D(1/3).u L(1/3).g in 1/10

+---+

| L. D. D2. D3. L. L2. L3.|

| date u u u u u g g g | |---|

1. | 1985q2 7.3 . . . . | 2. | 1985q3 7.2 7.3 -.1 . . 1.4 . . | 3. | 1985q4 7 7.2 -.2 -.1 . 2 1.4 . | 4. | 1986q1 7 7 0 .2 .3 1.4 2 1.4 | 5. | 1986q2 7.2 7 .2 .2 0 1.5 1.4 2 | |---|

6. | 1986q3 7 7.2 -.2 -.4 -.6 .9 1.5 1.4 | 7. | 1986q4 6.8 7 -.2 0 .4 1.5 .9 1.5 | 8. | 1987q1 6.6 6.8 -.2 0 0 1.2 1.5 .9 | 9. | 1987q2 6.3 6.6 -.3 -.1 -.1 1.5 1.2 1.5 | 10. | 1987q3 6 6.3 -.3 0 .1 1.6 1.5 1.2 | +---+

.

. regress D.u L(0/2).g

Source | SS df MS Number of obs = 96 ---+--- F(3, 92) = 57.95 Model | 5.17925206 3 1.72641735 Prob > F = 0.0000 Residual | 2.74074794 92 .029790739 R-squared = 0.6539 ---+--- Adj R-squared = 0.6427 Total | 7.92 95 .083368421 Root MSE = .1726 --- D.u | Coef. Std. Err. t P>|t| [95% Conf. Interval]

---+--- g |

--. | -.2020216 .0323832 -6.24 0.000 -.2663374 -.1377059 L1. | -.1653269 .0335368 -4.93 0.000 -.2319339 -.0987198 L2. | -.0700135 .0331 -2.12 0.037 -.1357529 -.0042741 |

_cons | .5835561 .0472119 12.36 0.000 .4897892 .6773231 --- .

(34)

. scatter g L.g, xline(`r(mean)') yline(`r(mean)')

-10123% GDP Growth

-1 0 1 2 3

% GDP Growth, L

. use "C:\Users\Windows 10 Gamer.PURWANTO\Desktop\Using Stata\Data POT\phillips_aus.dta", clear

. generate date = tq(1987q1) +_n-1 . format %tq date

. tsset date

time variable: date, 1987q1 to 2009q3 delta: 1 quarter

. list date in 1/10 +---+

| date | |---|

1. | 1987q1 | 2. | 1987q2 | 3. | 1987q3 | 4. | 1987q4 | 5. | 1988q1 | |---|

6. | 1988q2 | 7. | 1988q3 | 8. | 1988q4 | 9. | 1989q1 | 10. | 1989q2 |

(35)

Tsline inf D.u tsline inf D.u

-10123

1985q1 1990q1 1995q1 2000q1 2005q1 2010q1

date

Australian Inflation Rate Australian Unemployment Rate (Seasonally adjusted), D

. reg inf D.u

Source | SS df MS Number of obs = 90 ---+--- F(1, 88) = 5.29 Model | 2.04834633 1 2.04834633 Prob > F = 0.0238 Residual | 34.0445426 88 .386869802 R-squared = 0.0568 ---+--- Adj R-squared = 0.0460 Total | 36.0928889 89 .405538077 Root MSE = .62199 --- inf | Coef. Std. Err. t P>|t| [95% Conf. Interval]

---+--- u |

D1. | -.5278638 .2294049 -2.30 0.024 -.9837578 -.0719699 |

_cons | .7776213 .0658249 11.81 0.000 .646808 .9084345 --- . predict ehat, res

(1 missing value generated) . ac ehat, lag(12)

(36)

-0.40-0.200.000.200.400.60Autocorrelations of ehat

0 5 10 15

Lag Bartlett's formula for MA(q) 95% confidence bands

. ac ehat, lag(12) generate(rk)

-0.40-0.200.000.200.400.60Autocorrelations of ehat

0 5 10 15

Lag

Bartlett's formula for MA(q) 95% confidence bands

. list rk in 1/10 +---+

| rk | |---|

1. | .54865864 | 2. | .45573248 | 3. | .43321579 |

(37)

4. | .42049358 | 5. | .33903419 | |---|

6. | .27097344 | 7. | .1912208 | 8. | .25069401 | 9. | .15340864 | 10. | .05000152 | +---+

. corrgram ehat, lags(10)

-1 0 1 -1 0 1 LAG AC PAC Q Prob>Q [Autocorrelation] [Partial Autocor]

--- 1 0.5487 0.5498 28.006 0.0000 |---- |---- 2 0.4557 0.2297 47.548 0.0000 |--- |- 3 0.4332 0.1926 65.409 0.0000 |--- |- 4 0.4205 0.1637 82.433 0.0000 |--- |- 5 0.3390 0.0234 93.63 0.0000 |-- | 6 0.2710 -0.0256 100.87 0.0000 |-- | 7 0.1912 -0.0771 104.52 0.0000 |- | 8 0.2507 0.1211 110.86 0.0000 |-- | 9 0.1534 -0.0464 113.27 0.0000 |- | 10 0.0500 -0.1047 113.53 0.0000 | | . estat bgodfrey, lags(1)

Breusch-Godfrey LM test for autocorrelation

--- lags(p) | chi2 df Prob > chi2 ---+--- 1 | 27.592 1 0.0000 --- H0: no serial correlation

. . estat bgodfrey, lags(5)

Breusch-Godfrey LM test for autocorrelation

--- lags(p) | chi2 df Prob > chi2 ---+--- 5 | 36.871 5 0.0000 --- H0: no serial correlation

. . newey inf D.u, lag(4)

Regression with Newey-West standard errors Number of obs = 90 maximum lag: 4 F( 1, 88) = 2.76 Prob > F = 0.1001 --- | Newey-West

inf | Coef. Std. Err. t P>|t| [95% Conf. Interval]

---+--- u |

D1. | -.5278638 .3176735 -1.66 0.100 -1.159173 .1034454 |

_cons | .7776213 .1116107 6.97 0.000 .5558184 .9994242 ---

(38)

CH 9

. use "C:\Users\Windows 10 Gamer.PURWANTO\Desktop\Using Stata\Data POT\okun.dta", clear

. drop date . set obs 100

number of observations (_N) was 98, now 100 . generate date=tq(1961q1) + _n-1

. list date in 1/5 +---+

| date | |---|

1. | 4 | 2. | 5 | 3. | 6 | 4. | 7 | 5. | 8 | +---+

. format %tq date . list date in 1/10 +---+

| date | |---|

1. | 1961q1 | 2. | 1961q2 | 3. | 1961q3 | 4. | 1961q4 | 5. | 1962q1 | |---|

6. | 1962q2 | 7. | 1962q3 | 8. | 1962q4 | 9. | 1963q1 | 10. | 1963q2 | +---+

.

Function tq(l)

Description: convenience function to make typing quarterly dates in expressions easier

For example, typing tq(1960q2) is equivalent to typing 1.

Domain l: quarter literal strings 0100q1 to 9999q4

Range: %tq dates 0100q1 to 9999q12 (integers -7,440 to 32,159)

yq(Y,Q)

Description: the e_q quarterly date (quarters since 1960q1) corresponding to year Y, quarter Q

Domain Y: integers 1000 to 9999 (but probably 1800 to 2100) Domain Q: integers 1 to 4

Range: %tq dates 1000q1 to 9999q4 (integers -3,840 to 32,159)

(39)

Autokorelasi summarize g

Variable | Obs Mean Std. Dev. Min Max ---+--- g | 98 1.276531 .6469279 -1.4 2.5 . ac g, lags(12) generate(ac_g)

. list ac_g in 1/10 +---+

| ac_g | |---|

1. | .49425676 | 2. | .4107073 | 3. | .1544205 | 4. | .20043788 | 5. | .09038538 | |---|

6. | .02447111 | 7. | -.03008434 | 8. | -.08231978 | 9. | .04410661 | 10. | -.02128483 | +---+

Ac = autocorrelation . regress D.u L(0/2).g

Source | SS df MS Number of obs = 96 ---+--- F(3, 92) = 57.95 Model | 5.17925206 3 1.72641735 Prob > F = 0.0000 Residual | 2.74074794 92 .029790739 R-squared = 0.6539 ---+--- Adj R-squared = 0.6427 Total | 7.92 95 .083368421 Root MSE = .1726 --- D.u | Coef. Std. Err. t P>|t| [95% Conf. Interval]

---+--- g |

--. | -.2020216 .0323832 -6.24 0.000 -.2663374 -.1377059 L1. | -.1653269 .0335368 -4.93 0.000 -.2319339 -.0987198 L2. | -.0700135 .0331 -2.12 0.037 -.1357529 -.0042741 |

_cons | .5835561 .0472119 12.36 0.000 .4897892 .6773231 --- . regress D.u L(0/3).g

Source | SS df MS Number of obs = 95 ---+--- F(4, 90) = 42.23 Model | 5.13367789 4 1.28341947 Prob > F = 0.0000 Residual | 2.73516422 90 .030390714 R-squared = 0.6524 ---+--- Adj R-squared = 0.6370 Total | 7.86884211 94 .083711086 Root MSE = .17433 --- D.u | Coef. Std. Err. t P>|t| [95% Conf. Interval]

---+--- g |

(40)

--. | -.2020526 .0330131 -6.12 0.000 -.267639 -.1364663 L1. | -.1645352 .0358175 -4.59 0.000 -.2356929 -.0933774 L2. | -.071556 .0353043 -2.03 0.046 -.1416941 -.0014179 L3. | .003303 .0362603 0.09 0.928 -.0687345 .0753405 |

_cons | .5809746 .0538893 10.78 0.000 .4739142 .688035 --- Baum Introduction to Modern Econometric Using Stata

. use "C:\Users\Windows 10 Gamer.PURWANTO\Desktop\Using Stata\imeus\hprice2a.dta", clear

(Housing price data for Boston-area communities) . . summarize lprice lnox ldist rooms stratio

Variable | Obs Mean Std. Dev. Min Max ---+--- lprice | 506 9.941057 .409255 8.517193 10.8198 lnox | 506 1.693091 .2014102 1.348073 2.164472 ldist | 506 1.188233 .539501 .1222176 2.495682 rooms | 506 6.284051 .7025938 3.56 8.78

stratio | 506 18.45929 2.16582 12.6 22

. describe proptax lowstat lprice

storage display value

variable name type format label variable label

--- ---

proptax float %9.0g property tax per $1000 lowstat float %9.0g % of people 'lower status' lprice float %9.0g log(price)

. regress lprice lnox ldist rooms stratio

Source | SS df MS Number of obs = 506 ---+--- F(4, 501) = 175.86 Model | 49.3987735 4 12.3496934 Prob > F = 0.0000 Residual | 35.1834974 501 .070226542 R-squared = 0.5840 ---+--- Adj R-squared = 0.5807 Total | 84.5822709 505 .167489645 Root MSE = .265 --- lprice | Coef. Std. Err. t P>|t| [95% Conf. Interval]

---+--- lnox | -.95354 .1167418 -8.17 0.000 -1.182904 -.7241762 ldist | -.1343401 .0431032 -3.12 0.002 -.2190255 -.0496548 rooms | .2545271 .0185303 13.74 0.000 .2181203 .2909338 stratio | -.0524512 .0058971 -8.89 0.000 -.0640373 -.0408651 _cons | 11.08387 .3181115 34.84 0.000 10.45887 11.70886 ---

(41)

. estat ic

Akaike's information criterion and Bayesian information criterion

--- Model | Obs ll(null) ll(model) df AIC BIC ---+--- . | 506 -265.4135 -43.49514 5 96.99028 118.123 --- Note: N=Obs used in calculating BIC; see [R] BIC note.

. estat vce

Covariance matrix of coefficients of regress model

e(V) | lnox ldist rooms stratio _cons ---+--- lnox | .01362865 ldist | .00426247 .00185789 rooms | .00035279 .00003043 .00034337 stratio | 9.740e-07 .00002182 .00003374 .00003478 _cons | -.03037429 -.01001835 -.00341397 -.00088151 .10119496

. regress, beta

Source | SS df MS Number of obs = 506

---+--- F(4, 501) = 175.86 Model | 49.3987735 4 12.3496934 Prob > F = 0.0000 Residual | 35.1834974 501 .070226542 R-squared = 0.5840 ---+--- Adj R-squared = 0.5807 Total | 84.5822709 505 .167489645 Root MSE = .265

--- lprice | Coef. Std. Err. t P>|t| Beta ---+--- lnox | -.95354 .1167418 -8.17 0.000 -.4692738

ldist | -.1343401 .0431032 -3.12 0.002 -.1770941

rooms | .2545271 .0185303 13.74 0.000 .4369626

stratio | -.0524512 .0058971 -8.89 0.000 -.2775771

_cons | 11.08387 .3181115 34.84 0.000 . --- . regress lnox ldist rooms stratio Source | SS df MS Number of obs = 506

---+--- F(3, 502) = 497.92 Model | 15.3329959 3 5.11099862 Prob > F = 0.0000 Residual | 5.15286079 502 .010264663 R-squared = 0.7485 ---+--- Adj R-squared = 0.7470 Total | 20.4858566 505 .040566053 Root MSE = .10131

--- lnox | Coef. Std. Err. t P>|t| [95% Conf. Interval] ---+--- ldist | -.3127584 .008758 -35.71 0.000 -.3299652 -.2955516 rooms | -.0258859 .0069896 -3.70 0.000 -.0396183 -.0121534 stratio | -.0000715 .0022545 -0.03 0.975 -.004501 .004358 _cons | 2.228709 .0699747 31.85 0.000 2.091229 2.366188 ---

(42)

. estat vif

Variable | VIF 1/VIF ---+--- lnox | 3.98 0.251533 ldist | 3.89 0.257162 rooms | 1.22 0.820417 stratio | 1.17 0.852488 ---+--- Mean VIF | 2.56

lnox

R-squared 0.7485 1/R^2 0.2515 VIF

3.9761 43

. regress lprice lnox ldist rooms stratio

Source | SS df MS Number of obs = 506 ---+--- F(4, 501) = 175.86 Model | 49.3987735 4 12.3496934 Prob > F = 0.0000 Residual | 35.1834974 501 .070226542 R-squared = 0.5840 ---+--- Adj R-squared = 0.5807 Total | 84.5822709 505 .167489645 Root MSE = .265 --- lprice | Coef. Std. Err. t P>|t| [95% Conf. Interval]

---+--- lnox | -.95354 .1167418 -8.17 0.000 -1.182904 -.7241762 ldist | -.1343401 .0431032 -3.12 0.002 -.2190255 -.0496548 rooms | .2545271 .0185303 13.74 0.000 .2181203 .2909338 stratio | -.0524512 .0058971 -8.89 0.000 -.0640373 -.0408651 _cons | 11.08387 .3181115 34.84 0.000 10.45887 11.70886 --- F test

. test lnox ( 1) lnox = 0

F( 1, 501) = 66.72 Prob > F = 0.0000 test lnox ldist

( 1) lnox = 0 ( 2) ldist = 0

F( 2, 501) = 58.95 Prob > F = 0.0000 . test lnox = ldist

( 1) lnox - ldist = 0

F( 1, 501) = 96.40 Prob > F = 0.0000

(43)

. test lnox + ldist = 1 ( 1) lnox + ldist = 1

F( 1, 501) = 181.55 Prob > F = 0.0000 . testparm lnox

( 1) lnox = 0

F( 1, 501) = 66.72 Prob > F = 0.0000 . testparm lnox ldist

( 1) lnox = 0 ( 2) ldist = 0

F( 2, 501) = 58.95 Prob > F = 0.0000 . test lnox = 2*ldist

( 1) lnox - 2*ldist = 0 F( 1, 501) = 116.96 Prob > F = 0.0000 Pengujian Hetero

predict ehat, resid

. twoway (scatter ehat lprice)

Referensi

Dokumen terkait

Proses dikembangkan mengacu pada Standar Kompetensi Lulusan dan StandarIsi yang telah ditetapkan sesuai dengan ketentuan dalam PeraturanPemerintahNomor 19 Tahun 2005 tentang

Bahwa terhadap kewajiban PPID untuk melakukan Pengujian Konsekuensi, Peraturan Pemerintah Nomor 61 Tahun 2010 tentang Pelaksanaan Undang-undang Nomor 14 Tahun 2008

Soetomo (2006) menyatakan bahwa pengelolaan berbasis komunitas adalah suatu proses yang merupakan usaha masyarakat sendiri yang diintegrasikan dengan

Penelitian ini bertujuan untuk meningkatkan kemampuan berpikir kritis peserta didik dengan menerapkan model Problem Based Learning. Penelitian Tindakan Kelas ini

1) Buku yang diterjemahkan. 2) Buku terjemahanyang sudah diterbitkan dan memiliki ISBN. 3) Lampiran surat izin dari dari penerbit atau penulis selaku pemegang hak cipta jika

Predictors: (Constant), SIZE, PENDAPATAN PAJAK DAERAH, DANA PERIMBANGAN. Dependent Variable: KINERJA

Melihat proses asal terjadinya bahan-bahan organik tersebut dapat di ketahui bahwa sumber utama dari bahan-bahan tersebut adalah kegiatan rumah tangga dan

Secara arsitekturalnya gedung akad nikah, pemberkatan dan gedung resepsi indoor memiliki konsep bangunan yang menyatu dengan alam (unsur air pada stage jalan