| title: “ANALISIS PEUBAH-PEUBAH YANG MEMENGARUHI ANGKA PARTISIPASI SEKOLAH (APS) TINGKAT |
| SMA MENURUT PROVINSI DI INDONESIA” |
| author: “DIVA NISFU MUSTIKA” |
| date: “2023-08-01” |
| output: html_document |
library(readxl)
setwd("C:\\Users\\Diva\\Documents\\anreg")
data <- read_excel("tugasakhir.xlsx")
data
## # A tibble: 34 × 9
## y x1 x2 x3 x4 x5 x6 x7 x8
## <dbl> <dbl> <dbl> <dbl> <dbl> <dbl> <dbl> <dbl> <dbl>
## 1 83.1 245. 98.2 33.2 14.8 26064. 72.8 9.79 693
## 2 78.7 358. 99.1 56.3 8.33 37944. 72.7 9.99 982
## 3 83.7 451. 99.3 49.6 6.04 32378. 73.3 9.51 212
## 4 77.3 366. 99.2 40.1 6.84 80058. 73.5 9.54 389
## 5 72.5 328. 98.1 33.3 7.7 44536. 72.1 9.07 203
## 6 70.9 347. 98.6 37.3 12.0 39677. 70.9 8.82 340
## 7 79.3 360. 97.8 32.6 14.3 24230. 72.2 9.28 175
## 8 71.1 317. 97.2 31.3 11.4 28064. 70.4 8.61 225
## 9 68.4 422. 98.2 56 4.61 38674. 72.2 8.57 23
## 10 84.5 334. 99.0 83.3 6.03 87238. 76.5 10.5 31
## # ℹ 24 more rows
summary(data)
## y x1 x2 x3
## Min. :65.93 Min. :198.6 Min. :81.19 Min. : 23.00
## 1st Qu.:70.83 1st Qu.:288.1 1st Qu.:95.25 1st Qu.: 33.52
## Median :74.43 Median :341.6 Median :98.13 Median : 42.10
## Mean :75.14 Mean :343.7 Mean :96.69 Mean : 47.64
## 3rd Qu.:78.94 3rd Qu.:364.9 3rd Qu.:98.92 3rd Qu.: 55.67
## Max. :89.95 Max. :576.8 Max. :99.81 Max. :100.00
## x4 x5 x6 x7
## Min. : 4.530 Min. : 13299 Min. :65.89 Min. : 7.310
## 1st Qu.: 6.388 1st Qu.: 28139 1st Qu.:70.32 1st Qu.: 8.580
## Median : 8.495 Median : 37164 Median :72.23 Median : 9.225
## Mean :10.299 Mean : 45361 Mean :72.43 Mean : 9.247
## 3rd Qu.:12.213 3rd Qu.: 41988 3rd Qu.:73.31 3rd Qu.: 9.777
## Max. :26.800 Max. :182909 Max. :81.65 Max. :11.300
## x8
## Min. : 8.0
## 1st Qu.:109.0
## Median :209.5
## Mean :295.7
## 3rd Qu.:389.8
## Max. :982.0
model <- lm(y ~ x1+x2+x3+x4+x5+x6+x7+x8, data=data)
model
##
## Call:
## lm(formula = y ~ x1 + x2 + x3 + x4 + x5 + x6 + x7 + x8, data = data)
##
## Coefficients:
## (Intercept) x1 x2 x3 x4 x5
## 15.7040209 0.0158719 -0.5700555 -0.1055390 0.1588718 -0.0000745
## x6 x7 x8
## 0.5541543 8.3259564 -0.0042476
summary(model)
##
## Call:
## lm(formula = y ~ x1 + x2 + x3 + x4 + x5 + x6 + x7 + x8, data = data)
##
## Residuals:
## Min 1Q Median 3Q Max
## -7.0249 -2.7384 -0.3461 1.9034 9.0973
##
## Coefficients:
## Estimate Std. Error t value Pr(>|t|)
## (Intercept) 1.570e+01 3.156e+01 0.498 0.6231
## x1 1.587e-02 1.168e-02 1.358 0.1865
## x2 -5.701e-01 3.275e-01 -1.741 0.0940 .
## x3 -1.055e-01 6.934e-02 -1.522 0.1405
## x4 1.589e-01 1.941e-01 0.818 0.4208
## x5 -7.450e-05 2.821e-05 -2.641 0.0140 *
## x6 5.542e-01 2.615e-01 2.119 0.0442 *
## x7 8.326e+00 1.668e+00 4.990 3.82e-05 ***
## x8 -4.248e-03 2.849e-03 -1.491 0.1485
## ---
## Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
##
## Residual standard error: 4.009 on 25 degrees of freedom
## Multiple R-squared: 0.644, Adjusted R-squared: 0.5301
## F-statistic: 5.653 on 8 and 25 DF, p-value: 0.0003781
anova(model)
## Analysis of Variance Table
##
## Response: y
## Df Sum Sq Mean Sq F value Pr(>F)
## x1 1 0.12 0.12 0.0072 0.93284
## x2 1 67.27 67.27 4.1865 0.05140 .
## x3 1 31.67 31.67 1.9709 0.17265
## x4 1 74.65 74.65 4.6455 0.04096 *
## x5 1 4.39 4.39 0.2734 0.60565
## x6 1 101.30 101.30 6.3047 0.01887 *
## x7 1 411.61 411.61 25.6161 3.181e-05 ***
## x8 1 35.71 35.71 2.2223 0.14854
## Residuals 25 401.71 16.07
## ---
## Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
boxplot(data$y, col='blue')
car::vif(model)
## x1 x2 x3 x4 x5 x6 x7 x8
## 1.826024 2.975033 3.400991 2.162116 1.889130 1.735735 3.819614 1.115202
library(mctest)
imcdiag(model, method = "VIF", vif=10)
##
## Call:
## imcdiag(mod = model, method = "VIF", vif = 10)
##
##
## VIF Multicollinearity Diagnostics
##
## VIF detection
## x1 1.8260 0
## x2 2.9750 0
## x3 3.4010 0
## x4 2.1621 0
## x5 1.8891 0
## x6 1.7357 0
## x7 3.8196 0
## x8 1.1152 0
##
## NOTE: VIF Method Failed to detect multicollinearity
##
##
## 0 --> COLLINEARITY is not detected by the test
##
## ===================================
mc.plot(model, vif = 10)
library(olsrr)
##
## Attaching package: 'olsrr'
## The following object is masked from 'package:datasets':
##
## rivers
ols_vif_tol(model)
## Variables Tolerance VIF
## 1 x1 0.5476381 1.826024
## 2 x2 0.3361307 2.975033
## 3 x3 0.2940320 3.400991
## 4 x4 0.4625099 2.162116
## 5 x5 0.5293443 1.889130
## 6 x6 0.5761249 1.735735
## 7 x7 0.2618065 3.819614
## 8 x8 0.8966988 1.115202
plot(model, which=5)
olsrr:: ols_plot_diagnostics(model)
ols_plot_resid_lev(model)
#menghitung s, ei,n, dan p
s = sqrt(16.07)
s #s adalah akar dari KTG
## [1] 4.00874
ei = model$residuals
ei
## 1 2 3 4 5
## 3.7017200701 1.9180751264 5.2618096126 2.9301184082 -1.4829850779
## 6 7 8 9 10
## -0.3332973169 0.0958480839 -0.3588524251 -1.2561917436 4.9863298306
## 11 12 13 14 15
## -7.0248618843 -2.4138814839 -3.0913864156 4.8113214322 0.2201472886
## 16 17 18 19 20
## -4.4433830509 1.0101372613 1.8593127532 4.3250833567 4.2634455842
## 21 22 23 24 25
## -3.3215160084 -1.2242131449 9.0973429737 -0.0007716985 -2.8675858041
## 26 27 28 29 30
## -0.3070349555 -2.8465429078 -5.7996880159 -0.3588824871 -3.1542853457
## 31 32 33 34
## -3.2049617562 1.2891920047 -1.4300473322 -0.8495149320
n = dim(data)[1]
n
## [1] 34
p = length(model$coefficients)
p
## [1] 9
# menghitung hii dan ri
xbar = mean(data$x1+data$x2+data$x3+data$x4+data$x5+data$x6+data$x7+data$x8)
hii=hatvalues(model)
ri = ei/(s*sqrt(1-hii))
Obs = c(1:n)
summ <- cbind.data.frame(Obs, hii)
View(summ)
#Hapus Pencilan
model_tanpa_11 = lm((y) ~ x1+x2+x3+x4+x5+x6+x7+x8, data=data[-c(23),])
summary(model_tanpa_11)
##
## Call:
## lm(formula = (y) ~ x1 + x2 + x3 + x4 + x5 + x6 + x7 + x8, data = data[-c(23),
## ])
##
## Residuals:
## Min 1Q Median 3Q Max
## -6.2103 -2.1795 -0.2243 1.2244 6.5421
##
## Coefficients:
## Estimate Std. Error t value Pr(>|t|)
## (Intercept) 3.664e-01 2.724e+01 0.013 0.989377
## x1 1.487e-02 9.938e-03 1.496 0.147616
## x2 -6.122e-01 2.787e-01 -2.197 0.037951 *
## x3 -1.247e-01 5.924e-02 -2.106 0.045878 *
## x4 1.456e-01 1.651e-01 0.882 0.386574
## x5 -1.167e-04 2.726e-05 -4.281 0.000258 ***
## x6 8.182e-01 2.366e-01 3.458 0.002046 **
## x7 8.655e+00 1.422e+00 6.087 2.75e-06 ***
## x8 -3.726e-03 2.428e-03 -1.535 0.137920
## ---
## Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
##
## Residual standard error: 3.408 on 24 degrees of freedom
## Multiple R-squared: 0.7438, Adjusted R-squared: 0.6583
## F-statistic: 8.708 on 8 and 24 DF, p-value: 1.626e-05
anova(model_tanpa_11)
## Analysis of Variance Table
##
## Response: (y)
## Df Sum Sq Mean Sq F value Pr(>F)
## x1 1 0.11 0.11 0.0096 0.9228727
## x2 1 56.95 56.95 4.9042 0.0365371 *
## x3 1 20.90 20.90 1.8000 0.1922721
## x4 1 75.77 75.77 6.5250 0.0174034 *
## x5 1 17.84 17.84 1.5360 0.2271925
## x6 1 168.08 168.08 14.4736 0.0008624 ***
## x7 1 441.94 441.94 38.0567 2.252e-06 ***
## x8 1 27.35 27.35 2.3555 0.1379197
## Residuals 24 278.70 11.61
## ---
## Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
model_tanpa_23 = lm((y) ~ x1+x2+x3+x4+x5+x6+x7+x8, data=data[-c(11),])
summary(model_tanpa_23)
##
## Call:
## lm(formula = (y) ~ x1 + x2 + x3 + x4 + x5 + x6 + x7 + x8, data = data[-c(11),
## ])
##
## Residuals:
## Min 1Q Median 3Q Max
## -5.6821 -2.3169 -0.3876 1.7406 5.8432
##
## Coefficients:
## Estimate Std. Error t value Pr(>|t|)
## (Intercept) 5.539e+00 2.733e+01 0.203 0.8411
## x1 1.709e-02 1.006e-02 1.699 0.1022
## x2 -5.760e-01 2.816e-01 -2.045 0.0520 .
## x3 -8.576e-02 5.997e-02 -1.430 0.1656
## x4 2.209e-01 1.681e-01 1.314 0.2014
## x5 -2.214e-05 2.947e-05 -0.752 0.4596
## x6 6.186e-01 2.258e-01 2.739 0.0114 *
## x7 8.520e+00 1.436e+00 5.932 4.03e-06 ***
## x8 -2.944e-03 2.486e-03 -1.185 0.2478
## ---
## Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
##
## Residual standard error: 3.448 on 24 degrees of freedom
## Multiple R-squared: 0.7451, Adjusted R-squared: 0.6601
## F-statistic: 8.768 on 8 and 24 DF, p-value: 1.536e-05
anova(model_tanpa_23)
## Analysis of Variance Table
##
## Response: (y)
## Df Sum Sq Mean Sq F value Pr(>F)
## x1 1 0.40 0.40 0.0333 0.856744
## x2 1 76.38 76.38 6.4260 0.018179 *
## x3 1 81.84 81.84 6.8860 0.014869 *
## x4 1 87.57 87.57 7.3679 0.012101 *
## x5 1 18.30 18.30 1.5396 0.226665
## x6 1 124.61 124.61 10.4840 0.003503 **
## x7 1 427.88 427.88 36.0008 3.407e-06 ***
## x8 1 16.68 16.68 1.4031 0.247806
## Residuals 24 285.25 11.89
## ---
## Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
model_tanpa_11_23 = lm((y) ~ x1+x2+x3+x4+x5+x6+x7+x8, data=data[-c(11,23),])
summary(model_tanpa_11_23)
##
## Call:
## lm(formula = (y) ~ x1 + x2 + x3 + x4 + x5 + x6 + x7 + x8, data = data[-c(11,
## 23), ])
##
## Residuals:
## Min 1Q Median 3Q Max
## -5.9983 -2.0342 -0.2959 1.3315 6.0570
##
## Coefficients:
## Estimate Std. Error t value Pr(>|t|)
## (Intercept) -6.298e-01 2.632e+01 -0.024 0.98112
## x1 1.596e-02 9.624e-03 1.658 0.11088
## x2 -6.014e-01 2.693e-01 -2.233 0.03557 *
## x3 -1.061e-01 5.835e-02 -1.818 0.08210 .
## x4 1.881e-01 1.616e-01 1.164 0.25631
## x5 -7.026e-05 3.860e-05 -1.820 0.08179 .
## x6 7.676e-01 2.307e-01 3.328 0.00293 **
## x7 8.662e+00 1.374e+00 6.305 1.96e-06 ***
## x8 -3.105e-03 2.375e-03 -1.307 0.20403
## ---
## Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
##
## Residual standard error: 3.292 on 23 degrees of freedom
## Multiple R-squared: 0.769, Adjusted R-squared: 0.6887
## F-statistic: 9.571 on 8 and 23 DF, p-value: 9.58e-06
anova(model_tanpa_11_23)
## Analysis of Variance Table
##
## Response: (y)
## Df Sum Sq Mean Sq F value Pr(>F)
## x1 1 0.36 0.36 0.0336 0.856138
## x2 1 65.08 65.08 6.0039 0.022302 *
## x3 1 62.45 62.45 5.7614 0.024870 *
## x4 1 87.54 87.54 8.0761 0.009236 **
## x5 1 9.52 9.52 0.8779 0.358506
## x6 1 145.82 145.82 13.4519 0.001279 **
## x7 1 440.67 440.67 40.6528 1.661e-06 ***
## x8 1 18.53 18.53 1.7090 0.204029
## Residuals 23 249.31 10.84
## ---
## Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
##Uji Asumsi
#uji kehomogenan ragam
library(ggplot2)
library(dplyr)
##
## Attaching package: 'dplyr'
## The following objects are masked from 'package:stats':
##
## filter, lag
## The following objects are masked from 'package:base':
##
## intersect, setdiff, setequal, union
data.frame(rstandard(model_tanpa_11_23),
model_tanpa_11_23$fitted.values) %>%
ggplot(aes(x = model_tanpa_11_23$fitted.values, y = rstandard(model_tanpa_11_23))) +
geom_point() +
geom_hline(yintercept = 0, linetype = "dotted") +
labs(title = "Standardized Residuals vs Fitted Values Plot")
plot(model_tanpa_11_23,1)
library(lmtest)
## Loading required package: zoo
##
## Attaching package: 'zoo'
## The following objects are masked from 'package:base':
##
## as.Date, as.Date.numeric
bptest(model_tanpa_11_23)
##
## studentized Breusch-Pagan test
##
## data: model_tanpa_11_23
## BP = 3.2343, df = 8, p-value = 0.9188
#nilai harapan = nol
t.test(resid(model_tanpa_11_23), mu = 0,)
##
## One Sample t-test
##
## data: resid(model_tanpa_11_23)
## t = 1.2057e-17, df = 31, p-value = 1
## alternative hypothesis: true mean is not equal to 0
## 95 percent confidence interval:
## -1.022456 1.022456
## sample estimates:
## mean of x
## 6.044427e-18
#h0: nilai harapan sisaan=0
#cek autokorelasi
lmtest::dwtest(data$y~data$x1 + data$x2+data$x3+data$x4+data$x5+data$x6+data$x7+data$x8) #h0:tidak ada auto korelasi
##
## Durbin-Watson test
##
## data: data$y ~ data$x1 + data$x2 + data$x3 + data$x4 + data$x5 + data$x6 + data$x7 + data$x8
## DW = 1.83, p-value = 0.2098
## alternative hypothesis: true autocorrelation is greater than 0
plot(x = 1:dim(data)[1],
y = model$residuals,
type = 'b',
ylab = "Residuals",
xlab = "Observation") # plot sisaan vs urutan
# Uji kenormalan
plot(model_tanpa_11_23,2)
shapiro.test(residuals(model_tanpa_11_23))
##
## Shapiro-Wilk normality test
##
## data: residuals(model_tanpa_11_23)
## W = 0.97586, p-value = 0.6736
#ho: sisaan menyebar normal
###Pemilihan model terbaik
library(MASS)
##
## Attaching package: 'MASS'
## The following object is masked from 'package:dplyr':
##
## select
## The following object is masked from 'package:olsrr':
##
## cement
#---Stepwise Regression Model----
step.model<- stepAIC(model_tanpa_11_23, direction = "both", trace = FALSE)
summary(step.model)
##
## Call:
## lm(formula = (y) ~ x1 + x2 + x3 + x5 + x6 + x7, data = data[-c(11,
## 23), ])
##
## Residuals:
## Min 1Q Median 3Q Max
## -6.2499 -1.9316 0.1917 1.3188 5.2738
##
## Coefficients:
## Estimate Std. Error t value Pr(>|t|)
## (Intercept) 1.187e+01 2.186e+01 0.543 0.59199
## x1 1.680e-02 9.730e-03 1.727 0.09653 .
## x2 -7.330e-01 2.229e-01 -3.288 0.00299 **
## x3 -1.353e-01 5.453e-02 -2.480 0.02021 *
## x5 -7.124e-05 3.783e-05 -1.883 0.07138 .
## x6 7.359e-01 2.330e-01 3.158 0.00412 **
## x7 9.168e+00 1.324e+00 6.924 2.94e-07 ***
## ---
## Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
##
## Residual standard error: 3.338 on 25 degrees of freedom
## Multiple R-squared: 0.7419, Adjusted R-squared: 0.68
## F-statistic: 11.98 on 6 and 25 DF, p-value: 2.513e-06
anova(step.model)
## Analysis of Variance Table
##
## Response: (y)
## Df Sum Sq Mean Sq F value Pr(>F)
## x1 1 0.36 0.36 0.0327 0.857946
## x2 1 65.08 65.08 5.8416 0.023278 *
## x3 1 62.45 62.45 5.6057 0.025950 *
## x5 1 1.41 1.41 0.1265 0.725027
## x6 1 137.31 137.31 12.3251 0.001719 **
## x7 1 534.14 534.14 47.9447 2.941e-07 ***
## Residuals 25 278.52 11.14
## ---
## Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
#---Backward Regression Model----
model1_tanpa_11_23 = glm((y) ~ x1+x2+x3+x4+x5+x6+x7+x8, data=data[-c(11,23),])
summary(model1_tanpa_11_23)
##
## Call:
## glm(formula = (y) ~ x1 + x2 + x3 + x4 + x5 + x6 + x7 + x8, data = data[-c(11,
## 23), ])
##
## Coefficients:
## Estimate Std. Error t value Pr(>|t|)
## (Intercept) -6.298e-01 2.632e+01 -0.024 0.98112
## x1 1.596e-02 9.624e-03 1.658 0.11088
## x2 -6.014e-01 2.693e-01 -2.233 0.03557 *
## x3 -1.061e-01 5.835e-02 -1.818 0.08210 .
## x4 1.881e-01 1.616e-01 1.164 0.25631
## x5 -7.026e-05 3.860e-05 -1.820 0.08179 .
## x6 7.676e-01 2.307e-01 3.328 0.00293 **
## x7 8.662e+00 1.374e+00 6.305 1.96e-06 ***
## x8 -3.105e-03 2.375e-03 -1.307 0.20403
## ---
## Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
##
## (Dispersion parameter for gaussian family taken to be 10.83978)
##
## Null deviance: 1079.28 on 31 degrees of freedom
## Residual deviance: 249.31 on 23 degrees of freedom
## AIC: 176.51
##
## Number of Fisher Scoring iterations: 2
back.model <- stepAIC(model_tanpa_11_23, direction = "backward", trace = FALSE)
summary(back.model)
##
## Call:
## lm(formula = (y) ~ x1 + x2 + x3 + x5 + x6 + x7, data = data[-c(11,
## 23), ])
##
## Residuals:
## Min 1Q Median 3Q Max
## -6.2499 -1.9316 0.1917 1.3188 5.2738
##
## Coefficients:
## Estimate Std. Error t value Pr(>|t|)
## (Intercept) 1.187e+01 2.186e+01 0.543 0.59199
## x1 1.680e-02 9.730e-03 1.727 0.09653 .
## x2 -7.330e-01 2.229e-01 -3.288 0.00299 **
## x3 -1.353e-01 5.453e-02 -2.480 0.02021 *
## x5 -7.124e-05 3.783e-05 -1.883 0.07138 .
## x6 7.359e-01 2.330e-01 3.158 0.00412 **
## x7 9.168e+00 1.324e+00 6.924 2.94e-07 ***
## ---
## Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
##
## Residual standard error: 3.338 on 25 degrees of freedom
## Multiple R-squared: 0.7419, Adjusted R-squared: 0.68
## F-statistic: 11.98 on 6 and 25 DF, p-value: 2.513e-06
anova(back.model)
## Analysis of Variance Table
##
## Response: (y)
## Df Sum Sq Mean Sq F value Pr(>F)
## x1 1 0.36 0.36 0.0327 0.857946
## x2 1 65.08 65.08 5.8416 0.023278 *
## x3 1 62.45 62.45 5.6057 0.025950 *
## x5 1 1.41 1.41 0.1265 0.725027
## x6 1 137.31 137.31 12.3251 0.001719 **
## x7 1 534.14 534.14 47.9447 2.941e-07 ***
## Residuals 25 278.52 11.14
## ---
## Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
#---Forward Regression Model----
fwd.model <- stepAIC(model_tanpa_11_23, direction = "forward", trace = FALSE)
summary(fwd.model)
##
## Call:
## lm(formula = (y) ~ x1 + x2 + x3 + x4 + x5 + x6 + x7 + x8, data = data[-c(11,
## 23), ])
##
## Residuals:
## Min 1Q Median 3Q Max
## -5.9983 -2.0342 -0.2959 1.3315 6.0570
##
## Coefficients:
## Estimate Std. Error t value Pr(>|t|)
## (Intercept) -6.298e-01 2.632e+01 -0.024 0.98112
## x1 1.596e-02 9.624e-03 1.658 0.11088
## x2 -6.014e-01 2.693e-01 -2.233 0.03557 *
## x3 -1.061e-01 5.835e-02 -1.818 0.08210 .
## x4 1.881e-01 1.616e-01 1.164 0.25631
## x5 -7.026e-05 3.860e-05 -1.820 0.08179 .
## x6 7.676e-01 2.307e-01 3.328 0.00293 **
## x7 8.662e+00 1.374e+00 6.305 1.96e-06 ***
## x8 -3.105e-03 2.375e-03 -1.307 0.20403
## ---
## Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
##
## Residual standard error: 3.292 on 23 degrees of freedom
## Multiple R-squared: 0.769, Adjusted R-squared: 0.6887
## F-statistic: 9.571 on 8 and 23 DF, p-value: 9.58e-06
anova(fwd.model)
## Analysis of Variance Table
##
## Response: (y)
## Df Sum Sq Mean Sq F value Pr(>F)
## x1 1 0.36 0.36 0.0336 0.856138
## x2 1 65.08 65.08 6.0039 0.022302 *
## x3 1 62.45 62.45 5.7614 0.024870 *
## x4 1 87.54 87.54 8.0761 0.009236 **
## x5 1 9.52 9.52 0.8779 0.358506
## x6 1 145.82 145.82 13.4519 0.001279 **
## x7 1 440.67 440.67 40.6528 1.661e-06 ***
## x8 1 18.53 18.53 1.7090 0.204029
## Residuals 23 249.31 10.84
## ---
## Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
#sintaks lain untuk mencari pemodelan terbaik
olsrr::ols_step_all_possible(model_tanpa_11_23)
## Index N Predictors R-Square Adj. R-Square Mallow's Cp
## 7 1 1 x7 0.4922477873 0.4753227135 22.555123
## 6 2 1 x6 0.1839733368 0.1567724480 53.248938
## 3 3 1 x3 0.0626628750 0.0314183041 65.327399
## 2 4 1 x2 0.0603690794 0.0290480487 65.555784
## 8 5 1 x8 0.0241353159 -0.0083935069 69.163454
## 5 6 1 x5 0.0190427984 -0.0136557750 69.670498
## 1 7 1 x1 0.0003376008 -0.0329844792 71.532910
## 4 8 1 x4 0.0001095233 -0.0332201592 71.555619
## 20 9 2 x2 x7 0.5737438368 0.5443468600 16.440844
## 34 10 2 x6 x7 0.5581486176 0.5276761084 17.993606
## 29 11 2 x4 x7 0.5460095109 0.5146998220 19.202255
## 14 12 2 x1 x7 0.5070379531 0.4730405705 23.082517
## 32 13 2 x5 x7 0.5026842532 0.4683866154 23.516000
## 36 14 2 x7 x8 0.4936931393 0.4587754248 24.411214
## 25 15 2 x3 x7 0.4922562404 0.4572394294 24.554281
## 19 16 2 x2 x6 0.2180050148 0.1640743261 51.860522
## 28 17 2 x4 x6 0.2095942986 0.1550835605 52.697948
## 35 18 2 x6 x8 0.2030697701 0.1481090646 53.347572
## 13 19 2 x1 x6 0.1968669341 0.1414784467 53.965167
## 24 20 2 x3 x6 0.1861134735 0.1299833683 55.035852
## 31 21 2 x5 x6 0.1852762906 0.1290884486 55.119207
## 16 22 2 x2 x3 0.1065442228 0.0449265830 62.958286
## 17 23 2 x2 x4 0.0903755207 0.0276427980 64.568147
## 26 24 2 x3 x8 0.0853372155 0.0222570234 65.069794
## 22 25 2 x3 x4 0.0811567280 0.0177882265 65.486030
## 10 26 2 x1 x3 0.0786256802 0.0150826236 65.738038
## 23 27 2 x3 x5 0.0718924802 0.0078850650 66.408439
## 21 28 2 x2 x8 0.0695615126 0.0053933411 66.640526
## 18 29 2 x2 x5 0.0681729042 0.0039089666 66.778784
## 9 30 2 x1 x2 0.0606375598 -0.0041460567 67.529052
## 33 31 2 x5 x8 0.0361538820 -0.0303182641 69.966807
## 30 32 2 x4 x8 0.0266981870 -0.0404260760 70.908278
## 15 33 2 x1 x8 0.0243583566 -0.0429272740 71.141247
## 27 34 2 x4 x5 0.0217767039 -0.0456869717 71.398293
## 12 35 2 x1 x5 0.0200354318 -0.0475483315 71.571665
## 11 36 2 x1 x4 0.0005969036 -0.0683274479 73.507092
## 86 37 3 x4 x6 x7 0.6564433611 0.6196337213 10.206740
## 70 38 3 x2 x6 x7 0.6353603322 0.5962917964 12.305904
## 41 39 3 x1 x2 x7 0.6002558764 0.5574261489 15.801133
## 89 40 3 x5 x6 x7 0.5992191952 0.5562783947 15.904351
## 50 41 3 x1 x4 x7 0.5908809805 0.5470467998 16.734558
## 65 42 3 x2 x4 x7 0.5850499760 0.5405910448 17.315131
## 68 43 3 x2 x5 x7 0.5849556767 0.5404866421 17.324520
## 72 44 3 x2 x7 x8 0.5828414299 0.5381458689 17.535029
## 61 45 3 x2 x3 x7 0.5750767040 0.5295492081 18.308135
## 80 46 3 x3 x6 x7 0.5748023949 0.5292455087 18.335447
## 92 47 3 x6 x7 x8 0.5596568565 0.5124772340 19.843436
## 55 48 3 x1 x6 x7 0.5593242573 0.5121089992 19.876552
## 75 49 3 x3 x4 x7 0.5543971285 0.5066539637 20.367129
## 88 50 3 x4 x7 x8 0.5538933783 0.5060962402 20.417285
## 84 51 3 x4 x5 x7 0.5490546487 0.5007390753 20.899061
## 46 52 3 x1 x3 x7 0.5163791121 0.4645625884 24.152451
## 53 53 3 x1 x5 x7 0.5163163788 0.4644931337 24.158697
## 57 54 3 x1 x7 x8 0.5080778154 0.4553718670 24.978982
## 91 55 3 x5 x7 x8 0.5056059587 0.4526351686 25.225096
## 78 56 3 x3 x5 x7 0.5026947498 0.4494120444 25.514955
## 82 57 3 x3 x7 x8 0.4936945709 0.4394475607 26.411071
## 64 58 3 x2 x4 x6 0.3115701429 0.2378098011 44.544568
## 87 59 3 x4 x6 x8 0.2433947044 0.1623298513 51.332559
## 40 60 3 x1 x2 x6 0.2293883265 0.1468227901 52.727125
## 71 61 3 x2 x6 x8 0.2269847531 0.1441616910 52.966441
## 67 62 3 x2 x5 x6 0.2226051053 0.1393127952 53.402507
## 74 63 3 x3 x4 x6 0.2212821681 0.1378481147 53.534227
## 60 64 3 x2 x3 x6 0.2188301091 0.1351333351 53.778370
## 49 65 3 x1 x4 x6 0.2166301079 0.1326976195 53.997417
## 56 66 3 x1 x6 x8 0.2163040968 0.1323366787 54.029877
## 83 67 3 x4 x5 x6 0.2096483096 0.1249677713 54.692570
## 45 68 3 x1 x3 x6 0.2081988701 0.1233630348 54.836886
## 90 69 3 x5 x6 x8 0.2072357012 0.1222966691 54.932785
## 81 70 3 x3 x6 x8 0.2052177394 0.1200624972 55.133707
## 52 71 3 x1 x5 x6 0.2011627965 0.1155730961 55.537443
## 58 72 3 x2 x3 x4 0.1943817978 0.1080655619 56.212604
## 77 73 3 x3 x5 x6 0.1873270694 0.1002549697 56.915018
## 76 74 3 x3 x4 x8 0.1188226794 0.0244108236 63.735762
## 37 75 3 x1 x2 x3 0.1185019983 0.0240557838 63.767692
## 62 76 3 x2 x3 x8 0.1166367036 0.0219906361 63.953412
## 59 77 3 x2 x3 x5 0.1098664658 0.0144950157 64.627501
## 63 78 3 x2 x4 x5 0.1066643074 0.0109497689 64.946329
## 66 79 3 x2 x4 x8 0.1048333964 0.0089226889 65.128627
## 47 80 3 x1 x3 x8 0.1018566356 0.0056269894 65.425012
## 73 81 3 x3 x4 x5 0.0986484563 0.0020750766 65.744440
## 38 82 3 x1 x2 x4 0.0961676090 -0.0006715757 65.991449
## 43 83 3 x1 x3 x4 0.0951291552 -0.0018212925 66.094844
## 79 84 3 x3 x5 x8 0.0899440635 -0.0075619298 66.611106
## 44 85 3 x1 x3 x5 0.0836073137 -0.0145776170 67.242034
## 69 86 3 x2 x5 x8 0.0751444142 -0.0239472557 68.084655
## 42 87 3 x1 x2 x8 0.0697687458 -0.0298988886 68.619892
## 39 88 3 x1 x2 x5 0.0688063144 -0.0309644376 68.715718
## 85 89 3 x4 x5 x8 0.0426695700 -0.0599015475 71.318063
## 54 90 3 x1 x5 x8 0.0368341580 -0.0663621822 71.899074
## 51 91 3 x1 x4 x8 0.0276051276 -0.0765800373 72.817977
## 48 92 3 x1 x4 x5 0.0243324529 -0.0802033557 73.143826
## 158 93 4 x4 x5 x6 x7 0.6834395098 0.6365416594 9.518827
## 144 94 4 x2 x5 x6 x7 0.6767534021 0.6288650172 10.184540
## 141 95 4 x2 x4 x6 x7 0.6749077226 0.6267459038 10.368308
## 121 96 4 x1 x4 x6 x7 0.6714688202 0.6227975342 10.710707
## 161 97 4 x4 x6 x7 x8 0.6686233027 0.6195304587 10.994026
## 135 98 4 x2 x3 x6 x7 0.6616684631 0.6115452725 11.686495
## 151 99 4 x3 x4 x6 x7 0.6578092868 0.6071143663 12.070740
## 147 100 4 x2 x6 x7 x8 0.6443293726 0.5916374278 13.412888
## 105 101 4 x1 x2 x6 x7 0.6416958668 0.5886137729 13.675097
## 96 102 4 x1 x2 x3 x7 0.6329176547 0.5785350850 14.549113
## 100 103 4 x1 x2 x4 x7 0.6274777156 0.5722892291 15.090749
## 154 104 4 x3 x5 x6 x7 0.6222664170 0.5663058862 15.609620
## 103 105 4 x1 x2 x5 x7 0.6099089512 0.5521176847 16.840010
## 107 106 4 x1 x2 x7 x8 0.6087061153 0.5507366509 16.959772
## 162 107 4 x5 x6 x7 x8 0.6044887986 0.5458945466 17.379675
## 123 108 4 x1 x4 x7 x8 0.5997351815 0.5404366899 17.852976
## 124 109 4 x1 x5 x6 x7 0.5992405627 0.5398687942 17.902224
## 146 110 4 x2 x5 x7 x8 0.5978019617 0.5382170671 18.045460
## 143 111 4 x2 x4 x7 x8 0.5973159855 0.5376590945 18.093847
## 139 112 4 x2 x4 x5 x7 0.5918280644 0.5313581480 18.640261
## 110 113 4 x1 x3 x4 x7 0.5917865810 0.5313105189 18.644391
## 119 114 4 x1 x4 x5 x7 0.5916715533 0.5311784501 18.655844
## 115 115 4 x1 x3 x6 x7 0.5900289099 0.5292924521 18.819396
## 133 116 4 x2 x3 x5 x7 0.5858745916 0.5245226792 19.233027
## 130 117 4 x2 x3 x4 x7 0.5854279043 0.5240098161 19.277502
## 137 118 4 x2 x3 x7 x8 0.5840202201 0.5223935860 19.417661
## 157 119 4 x3 x6 x7 x8 0.5758654102 0.5130306562 20.229607
## 153 120 4 x3 x4 x7 x8 0.5648780095 0.5004154924 21.323584
## 127 121 4 x1 x6 x7 x8 0.5607005869 0.4956191924 21.739515
## 160 122 4 x4 x5 x7 x8 0.5581898740 0.4927365220 21.989498
## 149 123 4 x3 x4 x5 x7 0.5572407696 0.4916468095 22.083997
## 113 124 4 x1 x3 x5 x7 0.5237638542 0.4532103512 25.417177
## 126 125 4 x1 x5 x7 x8 0.5185828108 0.4472617458 25.933036
## 117 126 4 x1 x3 x7 x8 0.5169234055 0.4453565026 26.098257
## 156 127 4 x3 x5 x7 x8 0.5056445606 0.4324067178 27.221252
## 129 128 4 x2 x3 x4 x6 0.3324823526 0.2335908493 44.462412
## 142 129 4 x2 x4 x6 x8 0.3308702602 0.2317399284 44.622922
## 138 130 4 x2 x4 x5 x6 0.3127638333 0.2109510679 46.425716
## 99 131 4 x1 x2 x4 x6 0.3124480998 0.2105885591 46.457152
## 152 132 4 x3 x4 x6 x8 0.2593166036 0.1495857301 51.747271
## 122 133 4 x1 x4 x6 x8 0.2492616437 0.1380411465 52.748408
## 159 134 4 x4 x5 x6 x8 0.2447728171 0.1328873085 53.195345
## 109 135 4 x1 x3 x4 x6 0.2405517211 0.1280408650 53.615625
## 106 136 4 x1 x2 x6 x8 0.2387996962 0.1260292809 53.790068
## 102 137 4 x1 x2 x5 x6 0.2386355307 0.1258407945 53.806413
## 95 138 4 x1 x2 x3 x6 0.2365482817 0.1234443234 54.014233
## 145 139 4 x2 x5 x6 x8 0.2340915852 0.1206236719 54.258838
## 136 140 4 x2 x3 x6 x8 0.2279562759 0.1135794279 54.869710
## 116 141 4 x1 x3 x6 x8 0.2278118055 0.1134135544 54.884094
## 125 142 4 x1 x5 x6 x8 0.2255662892 0.1108353691 55.107672
## 132 143 4 x2 x3 x5 x6 0.2232678568 0.1081964282 55.336519
## 148 144 4 x3 x4 x5 x6 0.2212922345 0.1059281211 55.533225
## 118 145 4 x1 x4 x5 x6 0.2177098017 0.1018149576 55.889915
## 131 146 4 x2 x3 x4 x8 0.2167818303 0.1007495088 55.982310
## 112 147 4 x1 x3 x5 x6 0.2138792466 0.0974169127 56.271310
## 155 148 4 x3 x5 x6 x8 0.2092213049 0.0920689056 56.735086
## 128 149 4 x2 x3 x4 x5 0.2060438906 0.0884207633 57.051450
## 93 150 4 x1 x2 x3 x4 0.1996145750 0.0810389565 57.691594
## 111 151 4 x1 x3 x4 x8 0.1326975265 0.0042082712 64.354292
## 150 152 4 x3 x4 x5 x8 0.1300357498 0.0011521571 64.619316
## 97 153 4 x1 x2 x3 x8 0.1294366856 0.0004643427 64.678963
## 94 154 4 x1 x2 x3 x5 0.1198082355 -0.0105905445 65.637634
## 134 155 4 x2 x3 x5 x8 0.1184435644 -0.0121573890 65.773510
## 140 156 4 x2 x4 x5 x8 0.1176717857 -0.0130435053 65.850353
## 98 157 4 x1 x2 x4 x5 0.1167778479 -0.0140698783 65.939359
## 101 158 4 x1 x2 x4 x8 0.1110742179 -0.0206184906 66.507250
## 108 159 4 x1 x3 x4 x5 0.1066487639 -0.0256995673 66.947877
## 114 160 4 x1 x3 x5 x8 0.1034851078 -0.0293319133 67.262871
## 104 161 4 x1 x2 x5 x8 0.0756355473 -0.0613073346 70.035755
## 120 162 4 x1 x4 x5 x8 0.0455973582 -0.0957956258 73.026553
## 204 163 5 x2 x3 x5 x6 x7 0.7111564356 0.6556095963 8.759150
## 208 164 5 x2 x4 x5 x6 x7 0.7057887296 0.6492096392 9.293593
## 170 165 5 x1 x2 x3 x6 x7 0.7053365569 0.6486705101 9.338615
## 218 166 5 x4 x5 x6 x7 x8 0.7015080623 0.6441057665 9.719805
## 212 167 5 x2 x5 x6 x7 x8 0.6937017732 0.6347982680 10.497050
## 193 168 5 x1 x4 x5 x6 x7 0.6908810502 0.6314350983 10.777899
## 176 169 5 x1 x2 x4 x6 x7 0.6908351735 0.6313803992 10.782467
## 211 170 5 x2 x4 x6 x7 x8 0.6903338373 0.6307826522 10.832383
## 213 171 5 x3 x4 x5 x6 x7 0.6874109533 0.6272976750 11.123405
## 186 172 5 x1 x3 x4 x6 x7 0.6843241877 0.6236173007 11.430743
## 196 173 5 x1 x4 x6 x7 x8 0.6838391308 0.6230389636 11.479039
## 201 174 5 x2 x3 x4 x6 x7 0.6823934939 0.6213153197 11.622976
## 179 175 5 x1 x2 x5 x6 x7 0.6784330627 0.6165932671 12.017302
## 207 176 5 x2 x3 x6 x7 x8 0.6698380687 0.6063453896 12.873076
## 216 177 5 x3 x4 x6 x7 x8 0.6691798138 0.6055605473 12.938616
## 182 178 5 x1 x2 x6 x7 x8 0.6503431404 0.5831014366 14.814118
## 165 179 5 x1 x2 x3 x4 x7 0.6427116533 0.5740023558 15.573959
## 178 180 5 x1 x2 x4 x7 x8 0.6407649221 0.5716812533 15.767788
## 172 181 5 x1 x2 x3 x7 x8 0.6398899227 0.5706379848 15.854908
## 168 182 5 x1 x2 x3 x5 x7 0.6389870717 0.5695615086 15.944802
## 174 183 5 x1 x2 x4 x5 x7 0.6305240468 0.5594709789 16.787436
## 189 184 5 x1 x3 x5 x6 x7 0.6303374632 0.5592485138 16.806014
## 217 185 5 x3 x5 x6 x7 x8 0.6268646684 0.5551078738 17.151788
## 181 186 5 x1 x2 x5 x7 x8 0.6217413354 0.5489992845 17.661900
## 210 187 5 x2 x4 x5 x7 x8 0.6067939444 0.5311773953 19.150160
## 197 188 5 x1 x5 x6 x7 x8 0.6046074799 0.5285704568 19.367859
## 195 189 5 x1 x4 x5 x7 x8 0.6012317066 0.5245454963 19.703973
## 188 190 5 x1 x3 x4 x7 x8 0.6000006342 0.5230776792 19.826546
## 206 191 5 x2 x3 x5 x7 x8 0.5985113613 0.5213020077 19.974828
## 203 192 5 x2 x3 x4 x7 x8 0.5982971045 0.5210465477 19.996161
## 184 193 5 x1 x3 x4 x5 x7 0.5924796586 0.5141103621 20.575384
## 199 194 5 x2 x3 x4 x5 x7 0.5920023261 0.5135412350 20.622910
## 192 195 5 x1 x3 x6 x7 x8 0.5904783933 0.5117242381 20.774643
## 215 196 5 x3 x4 x5 x7 x8 0.5691055820 0.4862412708 22.902659
## 191 197 5 x1 x3 x5 x7 x8 0.5252169415 0.4339125072 27.272499
## 202 198 5 x2 x3 x4 x6 x8 0.3552922881 0.2313100358 44.191306
## 164 199 5 x1 x2 x3 x4 x6 0.3411982585 0.2145056159 45.594599
## 209 200 5 x2 x4 x5 x6 x8 0.3339947697 0.2059168408 46.311825
## 198 201 5 x2 x3 x4 x5 x6 0.3329585746 0.2046813774 46.414996
## 177 202 5 x1 x2 x4 x6 x8 0.3316257417 0.2030922305 46.547701
## 173 203 5 x1 x2 x4 x5 x6 0.3144327524 0.1825928971 48.259547
## 187 204 5 x1 x3 x4 x6 x8 0.2784782556 0.1397240740 51.839412
## 214 205 5 x3 x4 x5 x6 x8 0.2600286907 0.1177265158 53.676371
## 194 206 5 x1 x4 x5 x6 x8 0.2530452187 0.1094000685 54.371691
## 180 207 5 x1 x2 x5 x6 x8 0.2519272418 0.1080670960 54.483004
## 167 208 5 x1 x2 x3 x5 x6 0.2470333506 0.1022320718 54.970272
## 171 209 5 x1 x2 x3 x6 x8 0.2466253029 0.1017455534 55.010899
## 183 210 5 x1 x3 x4 x5 x6 0.2418507106 0.0960527703 55.486289
## 190 211 5 x1 x3 x5 x6 x8 0.2391834007 0.0928725162 55.751864
## 205 212 5 x2 x3 x5 x6 x8 0.2348622485 0.0877203732 56.182106
## 200 213 5 x2 x3 x4 x5 x8 0.2246811634 0.0755813871 57.195801
## 166 214 5 x1 x2 x3 x4 x8 0.2223913793 0.0728512599 57.423787
## 163 215 5 x1 x2 x3 x4 x5 0.2084320593 0.0562074553 58.813668
## 185 216 5 x1 x3 x4 x5 x8 0.1391107989 -0.0264448167 65.715745
## 169 217 5 x1 x2 x3 x5 x8 0.1297959692 -0.0375509598 66.643190
## 175 218 5 x1 x2 x4 x5 x8 0.1278113731 -0.0399172090 66.840789
## 225 219 6 x1 x2 x3 x5 x6 x7 0.7419392960 0.6800047270 7.694207
## 245 220 6 x2 x4 x5 x6 x7 x8 0.7288261044 0.6637443695 8.999842
## 244 221 6 x2 x3 x5 x6 x7 x8 0.7276762521 0.6623185526 9.114329
## 222 222 6 x1 x2 x3 x4 x6 x7 0.7244550367 0.6583242456 9.435054
## 240 223 6 x2 x3 x4 x5 x6 x7 0.7207857922 0.6537743823 9.800388
## 229 224 6 x1 x2 x4 x5 x6 x7 0.7134319670 0.6446556391 10.532583
## 228 225 6 x1 x2 x3 x6 x7 x8 0.7119046910 0.6427618168 10.684648
## 239 226 6 x1 x4 x5 x6 x7 x8 0.7083485104 0.6383521528 11.038725
## 232 227 6 x1 x2 x4 x6 x7 x8 0.7065653375 0.6361410185 11.216269
## 234 228 6 x1 x3 x4 x5 x6 x7 0.7051572038 0.6343949327 11.356472
## 246 229 6 x3 x4 x5 x6 x7 x8 0.7039440081 0.6328905700 11.477266
## 243 230 6 x2 x3 x4 x6 x7 x8 0.6959422542 0.6229683952 12.273973
## 233 231 6 x1 x2 x5 x6 x7 x8 0.6948433998 0.6216058157 12.383382
## 237 232 6 x1 x3 x4 x6 x7 x8 0.6936424517 0.6201166401 12.502956
## 224 233 6 x1 x2 x3 x4 x7 x8 0.6530788592 0.5698177855 16.541732
## 227 234 6 x1 x2 x3 x5 x7 x8 0.6485197708 0.5641645158 16.995664
## 220 235 6 x1 x2 x3 x4 x5 x7 0.6457277406 0.5607023983 17.273657
## 231 236 6 x1 x2 x4 x5 x7 x8 0.6457152152 0.5606868669 17.274904
## 238 237 6 x1 x3 x5 x6 x7 x8 0.6336246726 0.5456945940 18.478718
## 242 238 6 x2 x3 x4 x5 x7 x8 0.6074282616 0.5132110444 21.087003
## 236 239 6 x1 x3 x4 x5 x7 x8 0.6014082073 0.5057461771 21.686399
## 223 240 6 x1 x2 x3 x4 x6 x8 0.3645044249 0.2119854869 45.274085
## 241 241 6 x2 x3 x4 x5 x6 x8 0.3572178468 0.2029501300 45.999584
## 219 242 6 x1 x2 x3 x4 x5 x6 0.3435362469 0.1859849462 47.361814
## 230 243 6 x1 x2 x4 x5 x6 x8 0.3360074186 0.1766491991 48.111433
## 235 244 6 x1 x3 x4 x5 x6 x8 0.2830259345 0.1109521588 53.386615
## 226 245 6 x1 x2 x3 x5 x6 x8 0.2614861058 0.0842427712 55.531261
## 221 246 6 x1 x2 x3 x4 x5 x8 0.2277794890 0.0424465664 58.887312
## 251 247 7 x1 x2 x3 x5 x6 x7 x8 0.7553878988 0.6840427027 8.355177
## 247 248 7 x1 x2 x3 x4 x5 x6 x7 0.7518338690 0.6794520808 8.709039
## 254 249 7 x2 x3 x4 x5 x6 x7 x8 0.7413872746 0.6659585631 9.749170
## 252 250 7 x1 x2 x4 x5 x6 x7 x8 0.7357998678 0.6587414958 10.305489
## 250 251 7 x1 x2 x3 x4 x6 x7 x8 0.7357290625 0.6586500391 10.312539
## 253 252 7 x1 x3 x4 x5 x6 x7 x8 0.7189184505 0.6369363319 11.986313
## 249 253 7 x1 x2 x3 x4 x5 x7 x8 0.6577692031 0.5579518873 18.074731
## 248 254 7 x1 x2 x3 x4 x5 x6 x8 0.3697742025 0.1859583449 46.749392
## 255 255 8 x1 x2 x3 x4 x5 x6 x7 x8 0.7689986635 0.6886503725 9.000000
olsrr::ols_step_forward_p(model_tanpa_11_23)
##
## Selection Summary
## -------------------------------------------------------------------------
## Variable Adj.
## Step Entered R-Square R-Square C(p) AIC RMSE
## -------------------------------------------------------------------------
## 1 x7 0.4922 0.4753 22.5551 187.7097 4.2740
## 2 x2 0.5737 0.5443 16.4408 184.1112 3.9829
## 3 x6 0.6354 0.5963 12.3059 181.1150 3.7490
## 4 x5 0.6768 0.6289 10.1845 179.2592 3.5946
## 5 x3 0.7112 0.6556 8.7591 177.6582 3.4627
## 6 x1 0.7419 0.6800 7.6942 176.0521 3.3378
## 7 x8 0.7554 0.6840 8.3552 176.3395 3.3167
## 8 x4 0.7690 0.6887 9.0000 176.5074 3.2924
## -------------------------------------------------------------------------
olsrr::ols_step_backward_p(model_tanpa_11_23)
## [1] "No variables have been removed from the model."
olsrr::ols_step_both_p(model_tanpa_11_23)
##
## Stepwise Selection Summary
## -------------------------------------------------------------------------------------
## Added/ Adj.
## Step Variable Removed R-Square R-Square C(p) AIC RMSE
## -------------------------------------------------------------------------------------
## 1 x7 addition 0.492 0.475 22.5550 187.7097 4.2740
## 2 x2 addition 0.574 0.544 16.4410 184.1112 3.9829
## 3 x6 addition 0.635 0.596 12.3060 181.1150 3.7490
## 4 x5 addition 0.677 0.629 10.1850 179.2592 3.5946
## 5 x3 addition 0.711 0.656 8.7590 177.6582 3.4627
## 6 x1 addition 0.742 0.680 7.6940 176.0521 3.3378
## -------------------------------------------------------------------------------------
##Uji asumsi model terbaik##
#uji kehomogenan ragam stepwise
library(ggplot2)
library(dplyr)
data.frame(rstandard(step.model),
step.model$fitted.values) %>%
ggplot(aes(x = step.model$fitted.values, y = rstandard(step.model))) +
geom_point() +
geom_hline(yintercept = 0, linetype = "dotted") +
labs(title = "Standardized Residuals vs Fitted Values Plot")
plot(step.model,1)
library(lmtest)
bptest(step.model)
##
## studentized Breusch-Pagan test
##
## data: step.model
## BP = 4.0201, df = 6, p-value = 0.674
#uji kehomogenan ragam backward
library(ggplot2)
library(dplyr)
data.frame(rstandard(back.model),
back.model$fitted.values) %>%
ggplot(aes(x = back.model$fitted.values, y = rstandard(back.model))) +
geom_point() +
geom_hline(yintercept = 0, linetype = "dotted") +
labs(title = "Standardized Residuals vs Fitted Values Plot")
plot(back.model,1)
library(lmtest)
bptest(back.model)
##
## studentized Breusch-Pagan test
##
## data: back.model
## BP = 4.0201, df = 6, p-value = 0.674
#nilai harapan = nol stepwise
t.test(resid(step.model), mu = 0,)
##
## One Sample t-test
##
## data: resid(step.model)
## t = -3.2411e-16, df = 31, p-value = 1
## alternative hypothesis: true mean is not equal to 0
## 95 percent confidence interval:
## -1.080683 1.080683
## sample estimates:
## mean of x
## -1.717376e-16
#h0: nilai harapan sisaan=0
#nilai harapan = nol backwared
t.test(resid(back.model), mu = 0,)
##
## One Sample t-test
##
## data: resid(back.model)
## t = -3.2411e-16, df = 31, p-value = 1
## alternative hypothesis: true mean is not equal to 0
## 95 percent confidence interval:
## -1.080683 1.080683
## sample estimates:
## mean of x
## -1.717376e-16
#h0: nilai harapan sisaan=0
#cek autokorelasi stepwise dan backward
sisaan1 <- step.model$residuals
sisaan2 <- back.model$residuals
plot(x=1:dim(data[-c(11,23),])[1],
y=sisaan1,type='b',
ylab="Sisaan",xlab="Urutan")
plot(x=1:dim(data[-c(11,23),])[1],
y=sisaan2,type='b',
ylab="Sisaan",xlab="Urutan")
# Uji kenormalan stepwise
plot(step.model,2)
shapiro.test(residuals(step.model))
##
## Shapiro-Wilk normality test
##
## data: residuals(step.model)
## W = 0.96202, p-value = 0.3116
#ho: sisaan menyebar normal
# Uji kenormalan stepwise
plot(back.model,2)
shapiro.test(residuals(back.model))
##
## Shapiro-Wilk normality test
##
## data: residuals(back.model)
## W = 0.96202, p-value = 0.3116
#ho: sisaan menyebar normal