Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
45 changes: 45 additions & 0 deletions 04-RM.Rmd
Original file line number Diff line number Diff line change
Expand Up @@ -143,6 +143,51 @@ Nilai AIC memiliki interval dari -inf sampai +inf, sehingga tidak ada ketentuan

## Assumption

### **Bagaimana menguji asumsi pada linear regression menggunakan uji statistik?**

**1. Normality of Residuals **

Model linear regression diharapkan menghasilkan **error yang berdistribusi normal**. Dengan begitu, error lebih banyak berkumpul di sekitar angka nol. Asumsi normalitas dapat diuji menggunakan `shapiro.test()`, dengan uji hipotesis sebagai berikut:

* H0: error berdistribusi normal
* H1: error tidak berdistribusi normal

```{r, eval=FALSE}
shapiro.test(model$residuals)
```

Kondisi yang diharapkan adalah error berdistribusi normal (H0 tidak ditolak), yaitu p-value > 0.05 (tingkat error).

**2. Homoscedasticity of Residuals**

Diharapkan error yang dihasilkan oleh model menyebar secara acak atau dengan variasi konstan. Apabila divisualisasikan maka error tidak berpola. Kondisi ini disebut juga sebagai homoscedasticity. Homoscedasticity dapat dicek dengan uji statistik `bptest()` dari package `lmtest`

Uji hipotesis Breusch-Pagan:

* H0: error menyebar konstan atau homoscedasticity
* H1: error menyebar TIDAK konstan atau heteroscedasticity

```{r, eval=FALSE}
library(lmtest)
bptest(model)
```

Kondisi yang diharapkan adalah error menyebar konstan (H0 tidak ditolak), yaitu p-value > 0.05 (tingkat error).

**3. No Multicollinearity**

Multicollinearity adalah kondisi adanya korelasi antar prediktor yang kuat. Hal ini tidak diinginkan karena menandakan prediktor redundan pada model, yang seharusnya dapat dipilih salah satu saja dari variabel yang hubungannya amat kuat tersebut. Harapannya tidak terjadi multicollinearity

Uji VIF (Variance Inflation Factor) dengan fungsi `vif()` dari package `car`:

```{r, eval=FALSE}
library(car)
vif(model_backward)
```

* nilai VIF > 10: terjadi multicollinearity pada model
* nilai VIF < 10: tidak terjadi multicollinearity pada model

### **Mengapa pada asumsi normality yang harus berdistribusi normal adalah error/residual?**

Nilai error/residual yang diharapkan untuk setiap analisis termasuk regrsi linier adalah 0, untuk memastikan bahwa hasil prediksi untuk setiap observasi mendekati atau sama dengan 0, maka diharapkan error/residual berdistribusi normal dimana nilai rata-rata error/residual sama dengan 0. Error/residual pada regresi linier seringkali tidak berdistribusi normal disebabkan oleh beberap faktor, yaitu:
Expand Down
Binary file added assets/03-RM/homoscedasticity.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
2 changes: 2 additions & 0 deletions libs/anchor-sections-1.1.0/anchor-sections-hash.css
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
/* Styles for section anchors */
a.anchor-section::before {content: '#';font-size: 80%;}
8 changes: 8 additions & 0 deletions libs/anchor-sections-1.1.0/anchor-sections-icon.css
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
/* Styles for section anchors content */
/* From https://icons.getbootstrap.com/icons/link-45deg/
Licence: https://github.com/twbs/icons/blob/main/LICENSE.md */

a.anchor-section:before {
display: inline-block;
content: url("data:image/svg+xml,<svg xmlns='http://www.w3.org/2000/svg' width='16' height='16' fill='currentColor' class='bi bi-link-45deg' viewBox='0 0 16 16'><path d='M4.715 6.542L3.343 7.914a3 3 0 1 0 4.243 4.243l1.828-1.829A3 3 0 0 0 8.586 5.5L8 6.086a1.001 1.001 0 0 0-.154.199 2 2 0 0 1 .861 3.337L6.88 11.45a2 2 0 1 1-2.83-2.83l.793-.792a4.018 4.018 0 0 1-.128-1.287z'/><path d='M6.586 4.672A3 3 0 0 0 7.414 9.5l.775-.776a2 2 0 0 1-.896-3.346L9.12 3.55a2 2 0 0 1 2.83 2.83l-.793.792c.112.42.155.855.128 1.287l1.372-1.372a3 3 0 0 0-4.243-4.243L6.586 4.672z'/></svg>");
}
6 changes: 6 additions & 0 deletions libs/anchor-sections-1.1.0/anchor-sections-symbol.css
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
/* Styles for section anchors content */
/* Link symbol : https://codepoints.net/U+1F517
with variation selector https://graphemica.com/FE0E */
a.anchor-section::before{content: '\01F517\00FE0E';font-size: 20px;}
/* deactivate underline for link symbol */
a.anchor-section:hover {text-decoration: none;}
4 changes: 4 additions & 0 deletions libs/anchor-sections-1.1.0/anchor-sections.css
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
/* Styles for section anchors */
a.anchor-section {margin-left: 10px; visibility: hidden; color: inherit;}
.hasAnchor:hover a.anchor-section {visibility: visible;}
ul > li > .anchor-section {display: none;}
11 changes: 11 additions & 0 deletions libs/anchor-sections-1.1.0/anchor-sections.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
document.addEventListener('DOMContentLoaded', function () {
// If section divs is used, we need to put the anchor in the child header
const headers = document.querySelectorAll("div.hasAnchor.section[class*='level'] > :first-child")

headers.forEach(function (x) {
// Add to the header node
if (!x.classList.contains('hasAnchor')) x.classList.add('hasAnchor')
// Remove from the section or div created by Pandoc
x.parentElement.classList.remove('hasAnchor')
})
})
Binary file not shown.
105 changes: 105 additions & 0 deletions libs/gitbook-2.6.7/css/plugin-bookdown.css
Original file line number Diff line number Diff line change
@@ -0,0 +1,105 @@
.book .book-header h1 {
padding-left: 20px;
padding-right: 20px;
}
.book .book-header.fixed {
position: fixed;
right: 0;
top: 0;
left: 0;
border-bottom: 1px solid rgba(0,0,0,.07);
}
span.search-highlight {
background-color: #ffff88;
}
@media (min-width: 600px) {
.book.with-summary .book-header.fixed {
left: 300px;
}
}
@media (max-width: 1240px) {
.book .book-body.fixed {
top: 50px;
}
.book .book-body.fixed .body-inner {
top: auto;
}
}
@media (max-width: 600px) {
.book.with-summary .book-header.fixed {
left: calc(100% - 60px);
min-width: 300px;
}
.book.with-summary .book-body {
transform: none;
left: calc(100% - 60px);
min-width: 300px;
}
.book .book-body.fixed {
top: 0;
}
}

.book .book-body.fixed .body-inner {
top: 50px;
}
.book .book-body .page-wrapper .page-inner section.normal sub, .book .book-body .page-wrapper .page-inner section.normal sup {
font-size: 85%;
}

@media print {
.book .book-summary, .book .book-body .book-header, .fa {
display: none !important;
}
.book .book-body.fixed {
left: 0px;
}
.book .book-body,.book .book-body .body-inner, .book.with-summary {
overflow: visible !important;
}
}
.kable_wrapper {
border-spacing: 20px 0;
border-collapse: separate;
border: none;
margin: auto;
}
.kable_wrapper > tbody > tr > td {
vertical-align: top;
}
.book .book-body .page-wrapper .page-inner section.normal table tr.header {
border-top-width: 2px;
}
.book .book-body .page-wrapper .page-inner section.normal table tr:last-child td {
border-bottom-width: 2px;
}
.book .book-body .page-wrapper .page-inner section.normal table td, .book .book-body .page-wrapper .page-inner section.normal table th {
border-left: none;
border-right: none;
}
.book .book-body .page-wrapper .page-inner section.normal table.kable_wrapper > tbody > tr, .book .book-body .page-wrapper .page-inner section.normal table.kable_wrapper > tbody > tr > td {
border-top: none;
}
.book .book-body .page-wrapper .page-inner section.normal table.kable_wrapper > tbody > tr:last-child > td {
border-bottom: none;
}

div.theorem, div.lemma, div.corollary, div.proposition, div.conjecture {
font-style: italic;
}
span.theorem, span.lemma, span.corollary, span.proposition, span.conjecture {
font-style: normal;
}
div.proof>*:last-child:after {
content: "\25a2";
float: right;
}
.header-section-number {
padding-right: .5em;
}
#header .multi-author {
margin: 0.5em 0 -0.5em 0;
}
#header .date {
margin-top: 1.5em;
}
18 changes: 18 additions & 0 deletions libs/gitbook-2.6.7/css/plugin-clipboard.css
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
div.sourceCode {
position: relative;
}

.copy-to-clipboard-button {
position: absolute;
right: 0;
top: 0;
visibility: hidden;
}

.copy-to-clipboard-button:focus {
outline: 0;
}

div.sourceCode:hover > .copy-to-clipboard-button {
visibility: visible;
}
Loading