Nama : Auzan Fathi Hawari
NIM : 2304220001
Program Studi :
Analisis Data Eksploratif
X4 : kondisi stik ps (dalam skala 1-10, di mana 10 adalah kondisi terbaik)
X1 : Usia PS (dalam bulan)
set.seed(99)
min_models <- 3
max_models <- 5
x <- runif(20, min=min_models, max=max_models)
x1 <- round(x)
x1
## [1] 4 3 4 5 4 5 4 4 4 3 4 4 3 4 4 4 4 3 3 3
X2 : Jumlah Permainan yang Tersedia
set.seed(992)
n <- 20
u <- runif(n)
x2 <- round(60*u)
x2
## [1] 36 48 50 24 31 22 22 41 1 3 54 52 56 25 12 59 5 57 53 25
x3 : Kondisi PS (dalam skala 1-10, di mana 10 adalah kondisi terbaik)
set.seed(993)
min_conditions <- 1
max_conditions <- 10
x <- runif(20,min = min_conditions,max = max_conditions)
x3 <- round(x)
x3
## [1] 10 8 6 7 1 5 9 1 1 2 9 6 5 3 8 9 9 5 2 3
x4 : kondisi stik ps (dalam skala 1-10, di mana 10 adalah kondisi terbaik)
set.seed(995)
min_conditions <- 1
max_conditions <- 10
x <- runif(20,min = min_conditions,max = max_conditions)
x4 <- round(x)
x4
## [1] 10 8 3 7 5 9 7 2 1 3 2 4 7 8 7 8 6 3 8 3
Menentukan koefisen
b0 <- 5
b1 <- 7
b2 <- 9
b3 <- 3
b4 <- 1
set.seed(1210)
y = b0 + (x1*b1) + (x2*b2) + (x3*b3) + (x4*b4)
y
## [1] 397 490 504 284 320 262 265 407 46 62 548 523 552 275 172 599 111 557 517
## [20] 263
p <- exp(y)/(1+exp(y))
p
## [1] 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1
set.seed(3)
y <- rbinom(n,1,p)
y
## [1] 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1
datagab <- data.frame(y,x1,x2,x3,x4)
datagab
## y x1 x2 x3 x4
## 1 1 4 36 10 10
## 2 1 3 48 8 8
## 3 1 4 50 6 3
## 4 1 5 24 7 7
## 5 1 4 31 1 5
## 6 1 5 22 5 9
## 7 1 4 22 9 7
## 8 1 4 41 1 2
## 9 1 4 1 1 1
## 10 1 3 3 2 3
## 11 1 4 54 9 2
## 12 1 4 52 6 4
## 13 1 3 56 5 7
## 14 1 4 25 3 8
## 15 1 4 12 8 7
## 16 1 4 59 9 8
## 17 1 4 5 9 6
## 18 1 3 57 5 3
## 19 1 3 53 2 8
## 20 1 3 25 3 3
modelreglog <- glm(y~x1+x2+x3+x4, family = binomial(link = "logit"), data=datagab)
summary(modelreglog)
##
## Call:
## glm(formula = y ~ x1 + x2 + x3 + x4, family = binomial(link = "logit"),
## data = datagab)
##
## Coefficients:
## Estimate Std. Error z value Pr(>|z|)
## (Intercept) 2.557e+01 3.589e+05 0 1
## x1 8.725e-10 8.826e+04 0 1
## x2 2.485e-11 2.746e+03 0 1
## x3 6.627e-12 1.862e+04 0 1
## x4 -3.999e-10 2.058e+04 0 1
##
## (Dispersion parameter for binomial family taken to be 1)
##
## Null deviance: 0.000e+00 on 19 degrees of freedom
## Residual deviance: 3.154e-10 on 15 degrees of freedom
## AIC: 10
##
## Number of Fisher Scoring iterations: 24
Semua variabel yang ada didalam data ini berpengaruh