Anda di halaman 1dari 12

Analisis Regresi Linier

Berganda
apt. Dion Notario, M.Sc.
Definis
iRegresi linear berganda adalah perluasan dari regresi linear sederhana yang melibatkan dua
variabel:
1. Beberapa variabel prediktor atau variabel bebas (x1, x2, x3, … xn)
2. Satu variabel tergantung (y).

Secara formal, hubungan antara x dan y dapat dinyatakan sebagai berikut:


𝑦= 𝛽0 + 𝛽1𝑋1 + 𝛽2𝑋2 + (17)
𝛽3𝑋3 + ⋯ + 𝛽 𝑛 𝑋 𝑛 +∈

Atau dalam bentuk matrix dapat dinyatakan sebagai : (18)


𝑦 = 𝑋𝛽 +∈
Dimana: y = predictor; X = deskriptor; 𝛽 = koefisien regresi linear; dan ∈ = residual / galat.
𝑦 = 𝑋𝛽 +∈
𝑦1 1 𝑥11 𝑥12 ⋯ 𝑥1𝑘 𝛽0 ∈1
𝑦2 1 𝑥 21 𝑥 22 ⋯ 𝑥 2𝑘 ∈
𝑦3 ⋯ 𝛽1 2
1 𝑥 31 𝑥 32 𝑥 3𝑘 ∈3
∙ = ∙ ∙ ∙ ⋯ ∙ 𝛽∙2 +
∙ ∙ ∙ ⋯ ∙ ∙ ∙
∙ ∙
∙ ∙ ∙ ∙ ⋯ ∙ ∙ ∙
𝑦𝑛 ⋯ 𝛽𝑛 ∈𝑛
1 𝑥 𝑛1 𝑥 𝑛2

𝑥 𝑛𝑘regresi linear berganda (β , β , β , …, βn)


Untuk menghitung koefisien 0 1 2

Dapat digunakan metode kuadrat terkecil yang dapat dituliskan dalam bentuk
notasi matriks sebagai berikut:
መ −1 𝑋 ′ 𝑦
𝛽 = 𝑋𝑋

Dimana X’ adalah matrix transpose dari
(19) matrix X dan (X’X) -1 adalah inversi dari

matriks X’X.
1 1 2
CONTOH DATA: 1 1 1 1 1 2 1 5 5
y X1 X 𝑋 ′𝑋 = 1 2 6 4 1 2 2 = 12
1 2 3 4 1 6 3 15 61 42
1 1 2 2 1 4 4 12 42 34
3 2 1 2 1
2 2 2 1,3135 − 0,0254 −0,4322
−1 = − 0,1102 −0,1271
9 6 3 𝑋𝑋′

0,0254 −0,1271 0,3389


5 4 4

0,4322
1,3135 − 0,0254 −0,4322 20 −0,0932
𝑋 ′ 𝑋 −1 𝑋 ′ 𝑦 = − 0,0254 0,1102 −0,1271 85 = 1,7373
− 0,4322 −0,1271 −0,4661
0,3389 56

Dengan demikian nilai β0, β1, dan β2 secara berurutan adalah -0,0932; 1,7373 dan -0,4661.
Perhitungan dengan R
> Y <- c(1, 3, 2, 9, 5) Coefficients:
> X1 <- c(1, 2, 2, 6, 4) Estimate Std. Error t value Pr(>|t|)
> X2 <- c(2, 1, 2, 3, 4) (Intercept) -0.09322 0.44137 -0.211 0.85229
> lm1 <- lm(Y~X1 + X2) X1 1.73729 0.12782 13.591 0.00537 **
> summary(lm1) X2 -0.46610 0.22422 -2.079 0.17319
---
Signif. codes: 0 ‘***’ 0.001 ‘**’ 0.01 ‘*’ 0.05 ‘.’ 0.1 ‘ ’
Call: 1
Residual standard error: 0.3851 on 2 degrees of freedom
lm(formula = Y ~ X1 + X2)
Multiple R-squared: 0.9926, Adjusted R-squared: 0.9852
Residuals: F-statistic: 133.9 on 2 and 2 DF, p-value: 0.007415
1 2 3 4 5
0.288136 0.084746 -0.449153 0.067797 0.008475
Asumsi Regresi Linear
Berganda
Untuk dapat dianalisis dengan regresi linear berganda, suatu data harus
memenuhi beberapa asumsi yaitu:
1. Residual terdisitribusi normal
2. Residual tersebar secara acak di sekitar nol dan memiliki jumlah = 0
3. Variansi residual bersifat homoskedastik atau bersifat homogen
untuk semua level
4. Tidak ditemukan autokorelasi residual
Contoh
• Berikut ini diberikan data dengan kode birthwt : birthwt: Risk
Factors Associated with Low Infant Birth Weight
• The birthwt data frame has 189 rows and 10 columns. The data were
collected at Baystate Medical Center, Springfield, Mass during 1986.
Contoh data
Keterangan data
• low = indicator of birth weight less than 2.5 kg.
• age = mother's age in years.
• lwt = mother's weight in pounds at last menstrual period.
• race = mother's race (1 = white, 2 = black, 3 = other).
• smoke = smoking status during pregnancy.
• ptl = number of previous premature labours.
• ht = history of hypertension.
• ui = presence of uterine irritability.
• ftv = number of physician visits during the first trimester.
• bwt = birth weight in grams.
Apakah ada hubungan antara status merokok
& suku dengan berat badan bayi lahir?
• Variabel sebab/bebas/independen (x)  status merokok (x1) dan suku
(x2)
• Variabel akibat/tergantung/dependen (y)  berat badan bayi lahir
• Formula regresi linier berganda : 𝑦 = 𝛽0 + 𝛽1𝑥1 + 𝛽2𝑥2
Penyelesaian dengan
R

Cek video yang diupload di elearning dan script R yang telah dibagian
di elearning.
Terimakasi
h

Anda mungkin juga menyukai