Latihan Logit Probit
Latihan Logit Probit
Latihan Logit Probit
inlf
hours
kidslt6
kidsge6
age
educ
wage
repwage
hushrs
husage
huseduc
huswage
faminc
mtr
motheduc
fatheduc
unem
city
exper
nwifeinc
lwage
expersq
a.
b.
c.
d.
e.
Jawab
Dengan STATA:
. use "E:\05Ekonometri\PIA_Ekmet2\Pertemuan3\mroz.dta", clear
MODEL LOGIT
. logit inlf
Iteration
Iteration
Iteration
Iteration
Iteration
0:
1:
2:
3:
4:
likelihood
likelihood
likelihood
likelihood
likelihood
Logistic regression
Log likelihood = -401.76515
=
=
=
=
=
-514.8732
-406.94123
-401.85151
-401.76519
-401.76515
Number of obs
LR chi2(7)
Prob > chi2
Pseudo R2
=
=
=
=
753
226.22
0.0000
0.2197
------------------------------------------------------------------------------
inlf |
Coef.
Std. Err.
z
P>|z|
[95% Conf. Interval]
-------------+---------------------------------------------------------------nwifeinc | -.0213452
.0084214
-2.53
0.011
-.0378509
-.0048394
educ |
.2211704
.0434396
5.09
0.000
.1360303
.3063105
exper |
.2058695
.0320569
6.42
0.000
.1430391
.2686999
expersq | -.0031541
.0010161
-3.10
0.002
-.0051456
-.0011626
age | -.0880244
.014573
-6.04
0.000
-.116587
-.0594618
kidslt6 | -1.443354
.2035849
-7.09
0.000
-1.842373
-1.044335
kidsge6 |
.0601122
.0747897
0.80
0.422
-.086473
.2066974
_cons |
.4254524
.8603696
0.49
0.621
-1.260841
2.111746
-----------------------------------------------------------------------------Dalam logistic yang dibaca odds ratio coefnya tidak di baca
MENCARI ODDS RATIO
. logistic inlf nwifeinc educ exper expersq age kidslt6 kidsge6
Logistic regression
Number of obs
LR chi2(7)
Prob > chi2
Log likelihood = -401.76515
Pseudo R2
=
=
=
=
753
226.22
0.0000
0.2197
. estat class
Logistic model for inlf
-------- True -------Classified |
D
~D |
Total
-----------+--------------------------+----------+
|
347
118 |
465
|
81
207 |
288
-----------+--------------------------+----------Total
|
428
325 |
753
Classified + if predicted Pr(D) >= .5
True D defined as inlf != 0
-------------------------------------------------Sensitivity
Pr( +| D)
81.07%
Specificity
Pr( -|~D)
63.69%
Positive predictive value
Pr( D| +)
74.62%
Negative predictive value
Pr(~D| -)
71.88%
-------------------------------------------------False + rate for true ~D
Pr( +|~D)
36.31%
False - rate for true D
Pr( -| D)
18.93%
False + rate for classified +
Pr(~D| +)
25.38%
False - rate for classified Pr( D| -)
28.13%
-------------------------------------------------Correctly classified
73.57%
-------------------------------------------------. estat ic
----------------------------------------------------------------------------Model |
Obs
ll(null)
ll(model)
df
AIC
BIC
-------------+--------------------------------------------------------------. |
753
-514.8732
-401.7652
8
819.5303
856.5228
----------------------------------------------------------------------------Note: N=Obs used in calculating BIC; see [R] BIC note
Nilai AIC BIC lebih rendah lebih bagus
PROBIT
. probit inlf
Iteration
Iteration
Iteration
Iteration
Iteration
log
log
log
log
log
0:
1:
2:
3:
4:
likelihood
likelihood
likelihood
likelihood
likelihood
=
=
=
=
=
-514.8732
-405.78215
-401.32924
-401.30219
-401.30219
Probit regression
Number of obs
LR chi2(7)
Prob > chi2
Pseudo R2
=
=
=
=
753
227.14
0.0000
0.2206
-----------------------------------------------------------------------------inlf |
Coef.
Std. Err.
z
P>|z|
[95% Conf. Interval]
-------------+---------------------------------------------------------------nwifeinc | -.0120237
.0048398
-2.48
0.013
-.0215096
-.0025378
educ |
.1309047
.0252542
5.18
0.000
.0814074
.180402
exper |
.1233476
.0187164
6.59
0.000
.0866641
.1600311
expersq | -.0018871
.0006
-3.15
0.002
-.003063
-.0007111
age | -.0528527
.0084772
-6.23
0.000
-.0694678
-.0362376
kidslt6 | -.8683285
.1185223
-7.33
0.000
-1.100628
-.636029
kidsge6 |
.036005
.0434768
0.83
0.408
-.049208
.1212179
_cons |
.2700768
.508593
0.53
0.595
-.7267472
1.266901
-----------------------------------------------------------------------------MENCARI MARGINAL EFFECT
. dprobit inlf nwifeinc educ exper expersq age kidslt6 kidsge6
Iteration
Iteration
Iteration
Iteration
Iteration
0:
1:
2:
3:
4:
log
log
log
log
log
likelihood
likelihood
likelihood
likelihood
likelihood
=
=
=
=
=
-514.8732
-405.78215
-401.32924
-401.30219
-401.30219
Number of obs
LR chi2(7)
Prob > chi2
Pseudo R2
=
753
= 227.14
= 0.0000
= 0.2206
-----------------------------------------------------------------------------inlf |
dF/dx
Std. Err.
z
P>|z|
x-bar [
95% C.I.
]
---------+-------------------------------------------------------------------nwifeinc | -.0046962
.0018903
-2.48
0.013
20.129 -.008401 -.000991
educ |
.0511287
.0098592
5.18
0.000
12.2869
.031805 .070452
exper |
.0481771
.0073278
6.59
0.000
10.6308
.033815 .062539
expersq | -.0007371
.0002347
-3.15
0.002
178.039 -.001197 -.000277
age | -.0206432
.0033079
-6.23
0.000
42.5378 -.027127 -.01416
kidslt6 | -.3391514
.0463581
-7.33
0.000
.237716 -.430012 -.248291
kidsge6 |
.0140628
.0169852
0.83
0.408
1.35325 -.019228 .047353
---------+-------------------------------------------------------------------obs. P |
.5683931
pred. P |
.581542 (at x-bar)
-----------------------------------------------------------------------------z and P>|z| correspond to the test of the underlying coefficient being 0
. estat class
Probit model for inlf
-------- True -------Classified |
D
~D |
Total
-----------+--------------------------+-----------
+
|
348
120 |
468
|
80
205 |
285
-----------+--------------------------+----------Total
|
428
325 |
753
Classified + if predicted Pr(D) >= .5
True D defined as inlf != 0
-------------------------------------------------Sensitivity
Pr( +| D)
81.31%
Specificity
Pr( -|~D)
63.08%
Positive predictive value
Pr( D| +)
74.36%
Negative predictive value
Pr(~D| -)
71.93%
-------------------------------------------------False + rate for true ~D
Pr( +|~D)
36.92%
False - rate for true D
Pr( -| D)
18.69%
False + rate for classified +
Pr(~D| +)
25.64%
False - rate for classified Pr( D| -)
28.07%
-------------------------------------------------Correctly classified
73.44%
-------------------------------------------------Note: Nilai Logit dan Probit lebih tinggi lebih bagus
. estat ic
----------------------------------------------------------------------------Model |
Obs
ll(null)
ll(model)
df
AIC
BIC
-------------+--------------------------------------------------------------. |
753
-514.8732
-401.3022
8
818.6044
855.5969
----------------------------------------------------------------------------Note: N=Obs used in calculating BIC; see [R] BIC note
DENGAN EVIEWS
Quick Estimate Equation
Equation specification: inlf nwifeinc educ exper expersq age kidslt6 kidsge6 c
Coefficient
Std. Error
z-Statistic
Prob.
NWIFEINC
EDUC
EXPER
EXPERSQ
AGE
KIDSLT6
KIDSGE6
C
-0.021345
0.221170
0.205870
-0.003154
-0.088024
-1.443354
0.060112
0.425452
0.008421
0.043440
0.032057
0.001016
0.014573
0.203585
0.074790
0.860370
-2.534620
5.091442
6.422001
-3.104093
-6.040232
-7.089692
0.803749
0.494500
0.0113
0.0000
0.0000
0.0019
0.0000
0.0000
0.4215
0.6210
McFadden R-squared
S.D. dependent var
Akaike info criterion
Schwarz criterion
Hannan-Quinn criter.
LR statistic
Prob(LR statistic)
Obs with Dep=0
Obs with Dep=1
0.219681
0.495630
1.088354
1.137481
1.107280
226.2161
0.000000
325
428
Total obs
0.568393
0.425963
135.1762
-401.7652
-514.8732
-0.533553
753
E(# of Dep=0)
E(# of Dep=1)
Total
Correct
% Correct
% Incorrect
Total Gain*
Percent Gain**
207
118
325
207
63.69
36.31
63.69
63.69
81
347
428
347
81.07
18.93
-18.93
NA
288
465
753
554
73.57
26.43
16.73
38.77
Constant Probability
Dep=0
Dep=1
Total
0
325
325
0
0.00
100.00
0
428
428
428
100.00
0.00
0
753
753
428
56.84
43.16
Estimated Equation
Dep=0
Dep=1
Total
Constant Probability
Dep=0
Dep=1
Total
190.18
134.82
325.00
190.18
58.52
41.48
15.36
27.02
140.27
184.73
325.00
140.27
43.16
56.84
134.82
293.18
428.00
293.18
68.50
31.50
11.66
27.02
325.00
428.00
753.00
483.35
64.19
35.81
13.25
27.02
184.73
243.27
428.00
243.27
56.84
43.16
325.00
428.00
753.00
383.54
50.94
49.06
Coefficient
Std. Error
z-Statistic
Prob.
NWIFEINC
EDUC
EXPER
EXPERSQ
AGE
KIDSLT6
KIDSGE6
C
-0.012024
0.130905
0.123348
-0.001887
-0.052853
-0.868329
0.036005
0.270077
0.004840
0.025254
0.018716
0.000600
0.008477
0.118522
0.043477
0.508593
-2.484327
5.183485
6.590348
-3.145205
-6.234656
-7.326288
0.828142
0.531027
0.0130
0.0000
0.0000
0.0017
0.0000
0.0000
0.4076
0.5954
McFadden R-squared
0.220581
0.568393
0.495630
1.087124
1.136251
1.106050
227.1420
0.000000
325
428
S.E. of regression
Sum squared resid
Log likelihood
Restr. log likelihood
Avg. log likelihood
0.425945
135.1646
-401.3022
-514.8732
-0.532938
Total obs
753
E(# of Dep=0)
E(# of Dep=1)
Total
Correct
% Correct
% Incorrect
Total Gain*
Percent Gain**
205
120
325
205
63.08
36.92
63.08
63.08
80
348
428
348
81.31
18.69
-18.69
NA
285
468
753
553
73.44
26.56
16.60
38.46
Constant Probability
Dep=0
Dep=1
Total
0
325
325
0
0.00
100.00
0
428
428
428
100.00
0.00
0
753
753
428
56.84
43.16
Estimated Equation
Dep=0
Dep=1
Total
Constant Probability
Dep=0
Dep=1
Total
189.60
135.40
325.00
189.60
58.34
41.66
15.18
26.70
140.27
184.73
325.00
140.27
43.16
56.84
134.11
293.89
428.00
293.89
68.67
31.33
11.83
27.40
323.71
429.29
753.00
483.48
64.21
35.79
13.27
27.05
184.73
243.27
428.00
243.27
56.84
43.16
325.00
428.00
753.00
383.54
50.94
49.06
variable
Educ
deskripsi
Lama masa pendidikan formal individu i (tahun)
Service
Mtr
Sex
VIOL
Ahmad
Maia
Service
3
3
MTR
0.25
0.25
Sex
1
0
Jawab:
Estimasi LOGIT:
logit
Iteration
Iteration
Iteration
Iteration
Iteration
Iteration
0:
1:
2:
3:
4:
5:
log
log
log
log
log
log
likelihood
likelihood
likelihood
likelihood
likelihood
likelihood
Logistic regression
Log likelihood = -4699.5369
=
=
=
=
=
=
-7246.3443
-5293.5223
-4765.2154
-4701.7883
-4699.5407
-4699.5369
Number of obs
LR chi2(4)
Prob > chi2
Pseudo R2
=
=
=
=
20000
5093.61
0.0000
0.3515
-----------------------------------------------------------------------------viol |
Coef.
Std. Err.
z
P>|z|
[95% Conf. Interval]
-------------+---------------------------------------------------------------educ | -.6274836
.0125418
-50.03
0.000
-.6520651
-.6029022
service | -.9220601
.029517
-31.24
0.000
-.9799123
-.864208
mtr |
.9877184
.5326701
1.85
0.064
-.0562959
2.031733
sex |
.4556379
.0540524
8.43
0.000
.349697
.5615787
_cons |
4.548163
.1702511
26.71
0.000
4.214477
4.881849
------------------------------------------------------------------------------
ODD RATIO
. logistic viol educ service mtr sex
Logistic regression
Number of obs
LR chi2(4)
Prob > chi2
Pseudo R2
=
=
=
=
20000
5093.61
0.0000
0.3515
Estimasi PROBIT
. probit viol educ service mtr sex
Iteration
Iteration
Iteration
Iteration
Iteration
Iteration
0:
1:
2:
3:
4:
5:
log
log
log
log
log
log
likelihood
likelihood
likelihood
likelihood
likelihood
likelihood
Probit regression
Log likelihood = -4690.1149
=
=
=
=
=
=
-7246.3443
-5077.4429
-4728.1689
-4690.6948
-4690.115
-4690.1149
Number of obs
LR chi2(4)
Prob > chi2
Pseudo R2
=
=
=
=
20000
5112.46
0.0000
0.3528
-----------------------------------------------------------------------------viol |
Coef.
Std. Err.
z
P>|z|
[95% Conf. Interval]
-------------+---------------------------------------------------------------educ | -.3407488
.0065509
-52.02
0.000
-.3535884
-.3279091
service | -.4989346
.0156772
-31.83
0.000
-.5296613
-.4682078
mtr |
.5544322
.2885814
1.92
0.055
-.0111769
1.120041
sex |
.2416716
.0292332
8.27
0.000
.1843757
.2989676
_cons |
2.431004
.092101
26.39
0.000
2.250489
2.611519
-----------------------------------------------------------------------------Note: 4 failures and 0 successes completely determined.
MARGINAL EFFECT
. mfx
mnthborn
yearborn
age
electric
radio
tv
bicycle
educ
ceb
agefbrth
children
knowmeth
usemeth
monthfm
yearfm
agefm
idlnchld
heduc
agesq
urban
urbeduc
spirit
protest
catholic
frsthalf
educ0
evermarr
bulan lahir
tahun lahir
umur
=1 jika punya akses listrik
=1 jika punya radio
=1 jika punya TV
=1 jika punya sepeda
lama pendidikan formal (tahun)
pernah melahirkan
umur saat kelahiran pertama
jumlah anak yang hidup
=1 jika tau tentang kontrasepsi
=1 jika pernah menggunakan kontrasepsi
bulan pernikahan pertama
tahun pernikahan pertama
umur saat pernikahan pertama
jumlah anak ideal
lama pendidikan formal suami (tahun)
kuadrat dari umur
=1 jika tinggal di perkotaan
urban*educ
=1 jika agama adalah animisme
=1 jika beragama protestant
=1 jika beragama katholik
=1 jika mnthborn <= 6
=1 jika educ == 0
=1 jika pernah menikah
Seorang analis berusaha mencari faktor-faktor yang menentukan jumlah anak yang
dimiliki oleh satu keluarga. Dengan menggunakan data FERTIL2, dia melakukan regresi
dengan spesifikasi sebagai berikut;
childreni = 0 + 1 agei + 2 agesqi + 3 agefbrthi + 4 educi + 5 urbani + u i