Y : Keputusan menolak/menerima pelamar kerja pada PT BANG JARWO posisi Manager x1 : Lama pengalaman kerja sebelumnya (bulan) x2 : Status pekerjaan saat ini(0:Lulusan Sekolah Menengah, 1: Lulusan Perguruan Tinggi) x3 :Tingkat pendidikan Keterangan yang digunakan (0=lulus SMA/Tidak kuliah) dan (1=lulus kuliah) x4 :adalah data IPK Pelamar dengan skala 4
x1 : Lama pengalaman kerja sebelumnya (bulan) Membangkitkan variabel x1 dengan lamapekerjaan 0-60 bulan dengan nilai tengah 12 dan banyak pelamar adalah 100
set.seed(100)
n <- 100
u <- runif(n)
x1 <- round(60*(-(log(1-u)/12)))
x1
## [1] 2 1 4 0 3 3 8 2 4 1 5 11 2 3 7 6 1 2 2 6 4 6 4 7 3
## [26] 1 7 11 4 2 3 13 2 15 6 11 1 5 23 1 2 10 8 9 5 3 8 11 1 2
## [51] 2 1 1 2 4 1 1 1 5 1 3 5 16 6 3 2 3 3 1 6 3 2 4 17 5
## [76] 5 10 7 9 0 3 5 13 20 0 4 7 1 2 7 12 1 2 3 12 2 4 1 0 7
x2 : Statuspekerjaan keterangan yang digunakan (0= Tidak Bekerja) (1= Bekerja)
set.seed(1234)
x2 <- round(runif(n))
x2
## [1] 0 1 1 1 1 1 0 0 1 1 1 1 0 1 0 1 0 0 0 0 0 0 0 0 0 1 1 1 1 0 0 0 0 1 0 1 0
## [38] 0 1 1 1 1 0 1 0 1 1 0 0 1 0 0 1 1 0 1 0 1 0 1 1 0 0 0 0 1 0 1 0 1 0 1 0 1
## [75] 0 1 0 0 0 1 1 0 0 1 0 1 0 0 0 1 0 1 0 0 0 1 0 0 0 1
x3 : Tingkat pendidikan Keterangan yang digunakan (0=lulus SMA/Tidak kuliah) dan (1=lulus kuliah)
set.seed(123)
x3 <- round(runif(n))
x3
## [1] 0 1 0 1 1 0 1 1 1 0 1 0 1 1 0 1 0 0 0 1 1 1 1 1 1 1 1 1 0 0 1 1 1 1 0 0 1
## [38] 0 0 0 0 0 0 0 0 0 0 0 0 1 0 0 1 0 1 0 0 1 1 0 1 0 0 0 1 0 1 1 1 0 1 1 1 0
## [75] 0 0 0 1 0 0 0 1 0 1 0 0 1 1 1 0 0 1 0 1 0 0 1 0 0 1
x4 adalah data IPK Pelamar dengan skala 4
set.seed(10000)
x4 <-round(rnorm(n,3,0.5),2)
x4
## [1] 2.93 2.78 2.88 3.34 3.04 2.42 3.20 2.47 3.24 3.97 3.32 2.68 2.85 2.75 2.93
## [16] 2.01 3.25 3.09 2.83 2.65 3.16 3.17 2.53 3.40 2.73 3.94 3.07 2.64 3.30 3.01
## [31] 2.77 2.96 2.94 3.06 2.38 2.99 3.54 3.71 2.91 3.14 3.47 2.12 3.34 3.00 2.78
## [46] 3.11 3.77 2.75 4.03 2.35 2.87 3.02 3.73 2.57 2.97 3.37 2.75 4.07 3.28 3.09
## [61] 3.14 3.47 3.12 2.83 3.14 1.74 3.93 3.07 3.34 3.36 3.17 3.27 3.30 2.75 3.47
## [76] 2.48 2.54 3.27 4.66 2.89 3.58 2.65 3.07 4.36 3.26 3.60 3.60 3.06 1.34 1.95
## [91] 3.14 3.14 2.25 3.57 2.94 3.41 3.55 2.31 3.64 3.00
b0 <- -11
b1 <- 3.5
b2 <- 0.5
b3 <- 2.7
b4 <- 2.2
set.seed(1)
datapendukung <- b0+(b1*x1)+(b2*x2)+(b3*x3)+(b4*x4)
datapendukung
## [1] 2.446 1.816 9.836 -0.452 9.388 5.324 26.740 4.134 13.328 1.734
## [11] 17.004 33.896 4.970 8.750 19.946 17.622 -0.350 2.798 2.226 18.530
## [21] 12.652 19.674 11.266 23.680 8.206 4.368 23.454 36.508 10.760 2.622
## [31] 8.294 43.712 5.168 51.432 15.236 34.578 2.988 14.662 76.402 -0.092
## [41] 4.134 29.164 24.348 27.600 12.616 6.842 25.794 33.550 1.366 4.370
## [51] 2.314 -0.856 3.906 2.154 12.234 0.414 -1.450 4.654 16.416 -0.202
## [61] 9.608 14.134 51.864 16.226 9.108 0.328 10.846 9.454 2.548 17.892
## [71] 9.174 6.394 12.960 55.050 14.134 12.456 29.588 23.394 30.752 -4.142
## [81] 7.876 15.030 41.254 71.792 -3.828 11.420 24.120 1.932 1.648 18.290
## [91] 37.908 2.608 0.950 10.054 37.468 4.002 13.510 -2.418 -2.992 23.300
p <- exp(datapendukung)/(1+exp(datapendukung))
p
## [1] 0.92026845 0.86008547 0.99994651 0.38888535 0.99991628 0.99515041
## [7] 1.00000000 0.98423388 0.99999837 0.84992335 0.99999996 1.00000000
## [13] 0.99310473 0.99984156 1.00000000 0.99999998 0.41338242 0.94256765
## [19] 0.90256014 0.99999999 0.99999680 1.00000000 0.99998720 1.00000000
## [25] 0.99972706 0.98748212 1.00000000 1.00000000 0.99997877 0.93226411
## [31] 0.99975005 1.00000000 0.99433631 1.00000000 0.99999976 1.00000000
## [37] 0.95202905 0.99999957 1.00000000 0.47701621 0.98423388 1.00000000
## [43] 1.00000000 1.00000000 0.99999668 0.99893317 1.00000000 1.00000000
## [49] 0.79673312 0.98750681 0.91002989 0.29817574 0.98027604 0.89604197
## [55] 0.99999514 0.60204661 0.19000157 0.99056641 0.99999993 0.44967102
## [61] 0.99993282 0.99999927 1.00000000 0.99999991 0.99988924 0.58127267
## [67] 0.99998052 0.99992163 0.92743904 0.99999998 0.99989631 0.99833123
## [73] 0.99999765 1.00000000 0.99999927 0.99999611 1.00000000 1.00000000
## [79] 1.00000000 0.01564246 0.99962040 0.99999970 1.00000000 1.00000000
## [85] 0.02128996 0.99998903 1.00000000 0.87347062 0.83862056 0.99999999
## [91] 1.00000000 0.93137467 0.72111518 0.99995699 1.00000000 0.98204908
## [97] 0.99999864 0.08181036 0.04778860 1.00000000
set.seed(2030)
y <- rbinom(n,1,p)
y
## [1] 1 1 1 0 1 1 1 1 1 1 1 1 1 1 1 1 0 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1
## [38] 1 1 0 1 1 1 1 1 1 1 1 1 1 1 0 1 1 1 0 0 1 1 0 1 1 1 1 1 1 1 1 1 1 1 1 1 1
## [75] 1 1 1 1 1 0 1 1 1 1 0 1 1 1 1 1 1 1 1 1 1 1 1 0 0 1
datagap <- data.frame(y,x1,x2,x3,x4)
datagap
## y x1 x2 x3 x4
## 1 1 2 0 0 2.93
## 2 1 1 1 1 2.78
## 3 1 4 1 0 2.88
## 4 0 0 1 1 3.34
## 5 1 3 1 1 3.04
## 6 1 3 1 0 2.42
## 7 1 8 0 1 3.20
## 8 1 2 0 1 2.47
## 9 1 4 1 1 3.24
## 10 1 1 1 0 3.97
## 11 1 5 1 1 3.32
## 12 1 11 1 0 2.68
## 13 1 2 0 1 2.85
## 14 1 3 1 1 2.75
## 15 1 7 0 0 2.93
## 16 1 6 1 1 2.01
## 17 0 1 0 0 3.25
## 18 1 2 0 0 3.09
## 19 1 2 0 0 2.83
## 20 1 6 0 1 2.65
## 21 1 4 0 1 3.16
## 22 1 6 0 1 3.17
## 23 1 4 0 1 2.53
## 24 1 7 0 1 3.40
## 25 1 3 0 1 2.73
## 26 1 1 1 1 3.94
## 27 1 7 1 1 3.07
## 28 1 11 1 1 2.64
## 29 1 4 1 0 3.30
## 30 1 2 0 0 3.01
## 31 1 3 0 1 2.77
## 32 1 13 0 1 2.96
## 33 1 2 0 1 2.94
## 34 1 15 1 1 3.06
## 35 1 6 0 0 2.38
## 36 1 11 1 0 2.99
## 37 1 1 0 1 3.54
## 38 1 5 0 0 3.71
## 39 1 23 1 0 2.91
## 40 0 1 1 0 3.14
## 41 1 2 1 0 3.47
## 42 1 10 1 0 2.12
## 43 1 8 0 0 3.34
## 44 1 9 1 0 3.00
## 45 1 5 0 0 2.78
## 46 1 3 1 0 3.11
## 47 1 8 1 0 3.77
## 48 1 11 0 0 2.75
## 49 1 1 0 0 4.03
## 50 1 2 1 1 2.35
## 51 1 2 0 0 2.87
## 52 0 1 0 0 3.02
## 53 1 1 1 1 3.73
## 54 1 2 1 0 2.57
## 55 1 4 0 1 2.97
## 56 0 1 1 0 3.37
## 57 0 1 0 0 2.75
## 58 1 1 1 1 4.07
## 59 1 5 0 1 3.28
## 60 0 1 1 0 3.09
## 61 1 3 1 1 3.14
## 62 1 5 0 0 3.47
## 63 1 16 0 0 3.12
## 64 1 6 0 0 2.83
## 65 1 3 0 1 3.14
## 66 1 2 1 0 1.74
## 67 1 3 0 1 3.93
## 68 1 3 1 1 3.07
## 69 1 1 0 1 3.34
## 70 1 6 1 0 3.36
## 71 1 3 0 1 3.17
## 72 1 2 1 1 3.27
## 73 1 4 0 1 3.30
## 74 1 17 1 0 2.75
## 75 1 5 0 0 3.47
## 76 1 5 1 0 2.48
## 77 1 10 0 0 2.54
## 78 1 7 0 1 3.27
## 79 1 9 0 0 4.66
## 80 0 0 1 0 2.89
## 81 1 3 1 0 3.58
## 82 1 5 0 1 2.65
## 83 1 13 0 0 3.07
## 84 1 20 1 1 4.36
## 85 0 0 0 0 3.26
## 86 1 4 1 0 3.60
## 87 1 7 0 1 3.60
## 88 1 1 0 1 3.06
## 89 1 2 0 1 1.34
## 90 1 7 1 0 1.95
## 91 1 12 0 0 3.14
## 92 1 1 1 1 3.14
## 93 1 2 0 0 2.25
## 94 1 3 0 1 3.57
## 95 1 12 0 0 2.94
## 96 1 2 1 0 3.41
## 97 1 4 0 1 3.55
## 98 0 1 0 0 2.31
## 99 0 0 0 0 3.64
## 100 1 7 1 1 3.00
modelreglog <- glm(y~x1+x2+x3+x4, family = binomial(link = "logit"), data=datagap)
## Warning: glm.fit: algorithm did not converge
## Warning: glm.fit: fitted probabilities numerically 0 or 1 occurred
summary(modelreglog)
##
## Call:
## glm(formula = y ~ x1 + x2 + x3 + x4, family = binomial(link = "logit"),
## data = datagap)
##
## Coefficients:
## Estimate Std. Error z value Pr(>|z|)
## (Intercept) -342.2720 52625.7406 -0.007 0.995
## x1 129.8434 17101.1984 0.008 0.994
## x2 0.5095 17347.3415 0.000 1.000
## x3 71.7759 19026.6747 0.004 0.997
## x4 57.8011 8408.3828 0.007 0.995
##
## (Dispersion parameter for binomial family taken to be 1)
##
## Null deviance: 6.9303e+01 on 99 degrees of freedom
## Residual deviance: 1.4388e-07 on 95 degrees of freedom
## AIC: 10
##
## Number of Fisher Scoring iterations: 25