Data yang akan digunakan pada metode regresi linier berganda adalah data sekunder tentang pengaruh total biaya untuk produsen listrik di negara Amerika Serikat pada tahun 1955 dengan faktor yang mempengaruhinya dengan cost sebagai variabel respon dan output, pl, pk, pf sebagai variabel prediktor.
cost = Total Cost (in 1970 Million USD).
output = Total Output (Billion KwH).
pl = Price of Labor (Wages).
pf = Price of Fuel.
pk = Price of Capital.
Data disajikan dalam tabel sebagai berikut.
| No | Cost (Y) | Output (X1) | Pl (X2) | Pk (X3) | Pf (X4) |
|---|---|---|---|---|---|
| 1 | 0,082 | 2 | 2,09 | 183 | 17,9 |
| 2 | 0,661 | 3 | 2,05 | 174 | 35,1 |
| 3 | 0,99 | 4 | 2,05 | 171 | 35,1 |
| 4 | 0,315 | 4 | 1,83 | 166 | 32,2 |
| 5 | 0,197 | 5 | 2,12 | 233 | 28,6 |
| 6 | 0,098 | 9 | 2,12 | 195 | 28,6 |
| 7 | 0,949 | 11 | 1,98 | 206 | 35,5 |
| 8 | 0,675 | 13 | 2,05 | 150 | 35,1 |
| . | . | . | . | . | . |
| . | . | . | . | . | . |
| . | . | . | . | . | . |
| 156 | 12,483 | 2106 | 1,77 | 156 | 21,3 |
| 157 | 5,817 | 895 | 2,27 | 174,36 | 28,56 |
| 158 | 12,072 | 1787 | 2,11 | 178 | 30 |
| 159 | 9,391 | 2050 | 1,8 | 157,98 | 22,5 |
Data diatas akan di analisis statistik sederhana meliputi statistika deskriptif, visualisasi data, analisis korelasi, dan analisis regresi berganda. Berikut analisis pada data total biaya untuk produsen listrik di negara Amerika Serikat pada tahun 1955 dengan faktor yang mempengaruhinya.
Statistika deskriptif yang akan digunakan adalah nilai minimum, quartil 1, median, rata-rata, quartil 3, dan nilai maksimum. Berikut hasil analisa statistika deskriptif pada data nilai IPK dan lama belajar:
data <- read.csv("./Nerlove.csv")
summary(data)
## cost output pl pk
## Min. : 0.082 Min. : 2.0 Min. :1.450 Min. :138
## 1st Qu.: 2.520 1st Qu.: 292.5 1st Qu.:1.760 1st Qu.:161
## Median : 7.185 Median : 1156.0 Median :2.040 Median :170
## Mean : 14.717 Mean : 2420.3 Mean :1.977 Mean :174
## 3rd Qu.: 17.005 3rd Qu.: 2931.5 3rd Qu.:2.185 3rd Qu.:183
## Max. :139.422 Max. :19170.0 Max. :2.320 Max. :233
## pf
## Min. :10.30
## 1st Qu.:22.46
## Median :26.90
## Mean :26.33
## 3rd Qu.:32.80
## Max. :42.80
Dari statistika deskriptif diatas dapat diketahui bahwa rata-rata total biaya untuk produsen listrik di Amerika Serikat sebesar 14,717 Million USD, dengan total biaya terbesar adalah 139,422 Million USD dan total biaya terkecil adalah 0,082 Million USD. Median total biaya sebesar 7,185 Million USD. Rata-rata total pemakaian listrik di negara Amerika Serikat sebesar 2420,3 Billion KwH, dengan total terbesar adalah 19170 Billion KwH dan total pemakaian terkecil adalah 2 Billion KwH. Median total pemakaian adalah 1156 Billion KwH
Berikut hasil visualisasi data pada data total biaya untuk produsen listrik di negara Amerika Serikat pada tahun 1955 dengan faktor yang mempengaruhinya:
library(plotly)
p1 <- plot_ly(data,
x = ~pl,
y = ~cost,
text = paste("pl:", data$pl,
"cost:",
data$cost),
type = "bar") %>%
layout(xaxis = list(title = "Price of Labor"),
yaxis = list(title = "Cost"))
p1
p2 <- plot_ly(data,
x = ~pf,
y = ~cost,
text = paste("pf:", data$pf,
"cost:",
data$cost),
type = "bar") %>%
layout(xaxis = list(title = "Price of Fuel"),
yaxis = list(title = "Cost"))
p2
p3 <- plot_ly(data,
x = ~output,
y = ~cost,
text = paste("output:", data$output,
"cost:",
data$cost),
type = "bar") %>%
layout(xaxis = list(title = "Output"),
yaxis = list(title = "Cost"))
p3
p4 <- plot_ly(data,
x = ~pk,
y = ~cost,
text = paste("pk:", data$pk,
"cost:",
data$cost),
type = "bar") %>%
layout(xaxis = list(title = "Price of Capital"),
yaxis = list(title = "Cost"))
p4
Dari visualisasi diatas dapat diketahui bahwa semakin banyak price of labor maka cost nya akan semakin naik, begitu juga dengan variabel output, semakin banyak output maka cost nya juga akan semakin naik. Pada variabel price of fuel dan price of capital bentuknya berada di tengah atau tidak memiliki hubungan dengan cost.
Pengujian korelasi dilakukan untuk mengetahui bagaimana hubungan antar variabel. Berikut adalah uji korelasi antara variabel cost dengan faktor yang mempengaruhi.
scatterplot untuk cost dengan output
p5 <- plot_ly(data, x = ~output) %>%
add_markers(y = ~cost,
text = ~paste("Cost: ", cost),
showlegend = FALSE) %>%
add_lines(y = ~fitted(loess(cost ~ output)),
name = "Loess Smoother",
color = I("#FFC125"),
showlegend = TRUE,
line = list(width = 5)) %>%
layout(xaxis = list(title = "Output"),
yaxis = list(title = "Cost"))
p5
Dari scatterplot diatas diketahui bahwa plot berada pada garis kuning, hal ini menunjukkan bahwa secara visual variabel cost dan output saling berhubungan. selanjutnya akan dilakukan uji korelasi sebagai berikut.
library(GGally)
ggcorr(data)
Hasil korelasi diatas menunjukkan bahwa variabel cost memiliki hubungan dengan output dan Price of labor karena nilai pearson correlation yang tinggi.
y=data$cost
output=data$output
pl=data$pl
pk=data$pk
pf=data$pf
cor.test(output,y)
##
## Pearson's product-moment correlation
##
## data: output and y
## t = 42.523, df = 157, p-value < 2.2e-16
## alternative hypothesis: true correlation is not equal to 0
## 95 percent confidence interval:
## 0.9446068 0.9700430
## sample estimates:
## cor
## 0.9592237
cor.test(pl,y)
##
## Pearson's product-moment correlation
##
## data: pl and y
## t = 3.2389, df = 157, p-value = 0.001464
## alternative hypothesis: true correlation is not equal to 0
## 95 percent confidence interval:
## 0.09845602 0.39069623
## sample estimates:
## cor
## 0.250268
cor.test(pk,y)
##
## Pearson's product-moment correlation
##
## data: pk and y
## t = 0.030854, df = 157, p-value = 0.9754
## alternative hypothesis: true correlation is not equal to 0
## 95 percent confidence interval:
## -0.1532435 0.1580491
## sample estimates:
## cor
## 0.002462429
cor.test(pf,y)
##
## Pearson's product-moment correlation
##
## data: pf and y
## t = 0.10608, df = 157, p-value = 0.9157
## alternative hypothesis: true correlation is not equal to 0
## 95 percent confidence interval:
## -0.1473754 0.1638973
## sample estimates:
## cor
## 0.008466029
\(\text{H}_0: \rho_{xy} = 0\) (Tidak ada korelasi antara variabel Y dengan X(i))
\(\text{H}_1: \rho_{xy}\) \(\neq\) \(0\) (Terdapat korelasi antara variabel Y dengan X(i))
\(\alpha =5\%\)
Tolak \(\text{H}_0\) jika \(\text{p-value} \leq \alpha\) atau \(T\) > \(T_{\alpha/2;n-1}\)
\(Tx1\) = 42.523
\(Tx2\) = 3.2389
\(Tx3\) = 0.0308
\(Tx4\) = 0.1061
\(T_{\alpha/2;n-1}\) = 1.9
Tolak \(\text{H}_0\), karena \(Tx1\)(42.523) dan \(Tx2\)(3.2389) > \(T_{\alpha/2;n-1}\)(1.9). Jadi dapat disimpulkan bahwa terdapat korelasi antara variabel cost dengan output dan pl, sedangkan variabel pk dan pf gagal tolak \(\text{H}_0\) sehingga tidak ada korelasi dengan variabel cost.
NILAI KORELASI
cost vs output = \(\rho_{xy} = 0.959\) cost vs pl = \(\rho_{xy} = 0.2502\)
Nilai korelasi sebesar 0.959 menunjukkan bahwa terdapat korelasi positif yang kuat antara variabel cost dengan variabel output, sedangkan nilai korelasi sebesar 0.2502 menunjukkan bahwa terdapat korelasi positif yang lemah antara variabel cost dengan variabel pl.
lm <- lm(cost ~ output + pl + pk + pf, data=data)
residual <- resid(lm)
summary(lm)
##
## Call:
## lm(formula = cost ~ output + pl + pk + pf, data = data)
##
## Residuals:
## Min 1Q Median 3Q Max
## -18.252 -1.688 -0.256 2.220 45.070
##
## Coefficients:
## Estimate Std. Error t value Pr(>|t|)
## (Intercept) -23.006025 6.534631 -3.521 0.000567 ***
## output 0.006291 0.000140 44.925 < 2e-16 ***
## pl 6.914919 2.161739 3.199 0.001676 **
## pk 0.019354 0.026313 0.736 0.463129
## pf 0.207289 0.064396 3.219 0.001569 **
## ---
## Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
##
## Residual standard error: 5.723 on 154 degrees of freedom
## Multiple R-squared: 0.9342, Adjusted R-squared: 0.9325
## F-statistic: 547 on 4 and 154 DF, p-value: < 2.2e-16
Model regresi yang didapat adalah sebagai berikut. cost = -23.006025 + 0.0062 output + 6.9149 pl + 0.0194 pk + 0.2072 pf
Interpretasi :
Apabila semua variabel prediktor = 0, maka total biaya listrik akan turun sebesar 23.006025 Million USD.
Apabila output naik 1 satuan maka total biaya listrik akan naik sebesar 0,0026 kali, dengan syarat variabel lain konstan.
Apabila pl naik 1 satuan maka total biaya listrik akan naik sebesar 6,9149 kali, dengan syarat variabel lain konstan.
Apabila pk naik 1 satuan maka total biaya listrik akan naik sebesar 0,0194 kali, dengan syarat variabel lain konstan.
Apabila pf naik 1 satuan maka total biaya listrik akan naik sebesar 0,2072 kali, dengan syarat variabel lain konstan.
\(H_{0}\): \(\beta_{1}\) = 0 (Variabel X tidak berpengaruh signifikan terhadap Y)
\(H_{1}\): \(\beta_{1}\) \(\neq\) 0 (Minimal ada satu variabel X yang berpengaruh signifikan terhadap Y)
\(\alpha =5\%\)
Tolak \(H_{0}\) jika \(F\) > \(F_{\alpha;k,n-k-1}\). \(F_{\alpha;k,n-k-1}\) = 2.36
Statistik Uji: \(F\) = 547
Tolak \(H_{0}\) karena \(F\)(547) > \(F_{\alpha;k,n-k-1}\)(2.36). Jadi dapat disimpulkan bahwa minimal ada satu variabel X yang berpengaruh signifikan terhadap Y
Nilai \(R^{2}\)
\(R^{2}\) = 0.9342
Nilai sebesar 0.9342 menunjukkan bahwa variabilitas total biaya dapat dijelaskan oleh variabel output, pl, pk, dan pf adalah sebesar 93.42%, sedangkan sisanya dijelaskan oleh variabel diluar model.
\(H_{0}\): \(\beta_{1}\) = 0 (Variabel X1 tidak berpengaruh signifikan terhadap Y)
\(H_{1}\): \(\beta_{1}\) \(\neq\) 0 (Variabel X1 berpengaruh signifikan terhadap Y)
\(H_{0}\): \(\beta_{1}\) = 0 (Variabel X2 tidak berpengaruh signifikan terhadap Y)
\(H_{1}\): \(\beta_{1}\) \(\neq\) 0 (Variabel X2 berpengaruh signifikan terhadap Y)
\(H_{0}\): \(\beta_{1}\) = 0 (Variabel X3 tidak berpengaruh signifikan terhadap Y)
\(H_{1}\): \(\beta_{1}\) \(\neq\) 0 (Variabel X3 berpengaruh signifikan terhadap Y)
\(H_{0}\): \(\beta_{1}\) = 0 (Variabel X4 tidak berpengaruh signifikan terhadap Y)
\(H_{1}\): \(\beta_{1}\) \(\neq\) 0 (Variabel X4 berpengaruh signifikan terhadap Y)
\(\alpha =5\%\)
Tolak \(H_{0}\) jika \(\text{p-value} \leq \alpha\) atau \(T\) > \(T_{\alpha/2;n-1}\)
\(Tx1\) = 44.925 \(Tx2\) = 3.199 \(Tx3\) = 0.736 \(Tx4\) = 3.219
\(T_{\alpha/2;n-1}\) = 1.9
Tolak \(\text{H}_0\), karena \(Tx1\)(42.523), \(Tx2\)(3.2389) dan \(Tx4\)(3.219) > \(T_{\alpha/2;n-1}\)(1.9). Jadi dapat disimpulkan bahwa variabel X1, X2, dan X4 berpengaruh signifikan terhadap Y, sedangkan X3 tidak berpengaruh signifikan terhadap Y.