Anda di halaman 1dari 33

STATISTIKA

SESI 5
CORRELATIONS AND REGRESSIONS
Scatter Plots
Coefficient of Correlation
• Coefficient of correlation adalah angka yang menunjukkan arah dan besar
hubungan antara dua variabel
• Bila mendekati angka 1, maka kedua variabel memiliki hubungan positif yang kuat
• Bila mendekati angka -1, maka kedua variabel memiliki hubungan negatif yang kuat
• Bila mendekati angka 0, maka kedua variabel tidak memiliki hubungan
• Rumus Coefficient of Correlation (Pearson):
• Korelasi untuk angka ratio/interval
𝐶𝑜𝑣(𝑥,𝑦) • Pearson
• Untuk populasi: 𝑅 =
𝜎𝑥 𝜎𝑦
• Korelasi untuk angka ordinal
• Spearman
𝐶𝑜𝑣(𝑥,𝑦) • Kendall
• Untuk sampel: 𝑟 =
𝑠𝑥 𝑠𝑦
• Korelasi untuk angka nominal (kategori)
• Koefisien Kontingensi
Contoh Menghitung Correlation Coefficient

Coefficient of correlation populasi:


117.25
𝑅= = 0.984
14.36 × 8.30
Coefficient of correlation sampel:
130.28
𝑟= = 0.984
15.14 × 8.75
Uji Hipotesis Correlations
• Berdasarkan pasangan hipotesis yang dibuat, maka ada tiga tipe
uji hipotesis
1. Two-Tail Test Test Statistics
• 𝐻0 : 𝜌 = 𝑎
• 𝐻1 : 𝜌 ≠ 𝑎 𝑟 𝑛−2
2. One-Tail Test Kanan 𝑡=
1 − 𝑟2
• 𝐻0 : 𝜌 ≤ 𝑎
• 𝐻1 : 𝜌 > 𝑎 𝑑𝑓 = 𝑛 − 2

3. One-Tail Test Kiri


• 𝐻0 : 𝜌 ≥ 𝑎
• 𝐻1 : 𝜌 < 𝑎
Uji Hipotesis Correlations
• Pennsylvania Refining Company is studying the relationship between
the pump price of gasoline and the number of gallons sold. For a
sample of 20 stations last Tuesday, the correlation was - 0.78. At the
0.01 significance level, is the correlation in the population greater
than zero?
Linear Regression
• Regresi linier adalah model matematika yang menunjukkan hubungan garis
lurus antara suatu variabel penyebab dengan suatu variabel akibat

Model regresi linier di tingkat populasi

𝑦 = 𝛼 + 𝛽𝑥
Model regresi linier di tingkat sampel

𝑦ො = 𝑎 + 𝑏 𝑥
𝑦 =𝑎+𝑏𝑥+𝑒
https://www.jmp.com/en_ch/statistics-knowledge-portal/what-is-multiple-regression/fitting-multiple-
regression-model.html
Linear Regression
• Regresi linier adalah model matematika yang menunjukkan hubungan
garis lurus antara suatu variabel penyebab dengan variabel akibat
• Variabel x disebut sebagai independent variabel atau variabel
Model regresi linier di tingkat populasi bebas.
• Variabel y disebut sebagai dependent variabel atau variabel
𝑦 = 𝛼 + 𝛽𝑥 terikat.
• Variabel x dan y memiliki hubungan sebab dan akibat.
• Koefisien 𝛼 (di tingkat populasi) atau a (di tingkat sampel) disebut
Model regresi linier di tingkat populasi dengan intercept; menunjukkan nilai variabel y ketika variabel x

𝑦ො = 𝑎 + 𝑏 𝑥 bernilai nol.
• Koefisien 𝛽 (di tingkat sampel) atau b (di tingkat populasi) disebut
dengan slope atau gradient; menunjukkan besar pengaruh nilai x
terhadap nilai y.
𝑦 =𝑎+𝑏𝑥+𝑒 • Statistics a menjadi estimator bagi parameter 𝛼
• Statistic b menjadi estimator bagi parameter β
• 𝑦ො adalah perkiraan nilai y
• e adalah error atau selisih antara aktual nilai y dengan perkiraan 𝑦
Linear Regression
Model regresi linier di tingkat populasi
• Nilai 𝛽 atau b menunjukkan besar dan
𝑦 = 𝛼 + 𝛽𝑥 arah hubungan antara variabel x dan y

Model regresi linier di tingkat populasi

𝑦ො = 𝑎 + 𝑏 𝑥
𝑦 =𝑎+𝑏𝑥+𝑒
Gambar Pak Martoyo
Linear Regression
𝑦ො = 𝑎 + 𝑏𝑥
𝑠𝑦
 𝑏=𝑟
𝑠𝑥
 𝑎 = 𝑦ത − 𝑏𝑥ҧ
 r: correlation coefficient
 𝑠𝑦 : sample standard deviation of variable y
 𝑠𝑥 : sample standard deviation of variable x
 𝑏: slope (expected marginal increase/decrease in y per marginal
increase/decrease in x)
 𝑎: intercept (the expected value of y when x is zero).
Linear Regression
• The owner of Haverty’s Furniture Company was studying the
relationship between sales and the amount spent on advertising.
The advertising expense and sales revenue, both in millions of
dollars, for the last 4 months are repeated below.

Month Advertising Expense Sales Revenue


July 2 7
August 1 3
September 3 8
October 4 10
Linear Regression
 Determine the regression equation
o Tetapkan advertising expense sebagai “x” dan “sales revenue” sebagai “y”
o Hitung nilai 𝑥ҧ = 2.5 dan 𝑦ത = 7.
o Hitung nilai standard deviasi untuk variabel x dan variabel y:

 𝑠𝑥 =
σ 𝑥−𝑥ҧ 2
= 1.29
o Hitung nilai slope dan intercept:
𝑛−1
𝑠𝑦 2.94
σ 𝑦−𝑦ത 2
𝑏=𝑟 = 0.96 = 2.2
𝑠𝑥 1.29
 𝑠𝑦 = = 2.94
𝑛−1
 𝑎 = 𝑦ത − 𝑏𝑥ҧ = 7 − 2.2 × 2.5 = 1.5
o Hitung correlation coefficient:
σ 𝑥−𝑥ҧ 𝑦−𝑦ത
o Tuliskan persamaan regresi:
 𝑟= = 0.96
𝑛−1 𝑠𝑥 𝑠𝑦  𝑦ො = 𝑎 + 𝑏𝑥 = 1.5 + 2.2𝑥
o Nilai a = 1.5 (juta), menunjukkan ekspektasi nilai penjualan yang akan diperoleh bila advertising
expense nol.
o Nilai b = 2.2 (juta) menunjukkan eskpektasi peningkatan penjualan yang akan diperoleh setiap 1 (juta)
penambahan advertising expense.
Linear Regression
Sample 1 Garis regresi
yang sebenarnya

• Nilai b yang tidak nol


Sample 2
(signifikan) berarti ada
hubungan antara variabel x dan
y
• Nilai b yang tidak nol pada
tingkat sampel tidak menjamin
bahwa pada tingkat
populasinya juga tidak nol
Persamaan garis regresi yang dihasilkan adalah garis regresi
• Perlu dilakukan uji hipotesis
sample.
untuk memastikan
Sample yang berbeda menghasilkan persamaan garis yang
berbeda
 “a” dan “b” adalah estimator, bukan parameter
Bahan Pak Martoyo
Uji Hipotesis Untuk Signifikansi Nilai 𝛽
Untuk mengetahui apakah X berpengaruh terhadap Y pada garis
regresi yang sebenarnya (true regression line)  test hipothesis
tidak ada hubungan (x tidak mempengaruhi y)
H0 : β = 0
H1 : β ≠ 0

Ho ditolak bila t > angka kritis


atau bila t < - angka kritis
B - βH0 B
Test Statistik = =
σb σb

Dengan perhitungan computer, H0 ditolak bila p-value < α

Bahan Pak Martoyo


Uji Hipotesis Untuk Signifikansi Nilai 𝛽
• The regression equation is
𝑦ො = 29.29 − 0.96𝑥
• The sample size is 8 and the standard error of the slope is 0.22. Use
the 0.05 significance level. Can we conclude that the slope of the
regression line (of the population) is less than zero?
Confidence Interval Untuk Nilai Y
Confidence Interval untuk rata-rata Yc pada harga X tertentu

(X – 𝑥)ҧ 2 Y
Garis
𝑦ො ± t.Sy.x 1/n + regresi
∑(X - 𝑥)ҧ 2 sample
Interval Y
pada Garis Interval
Prediction Interval untuk individual Yc pada harga X tertentu regresi individual Y
populasi

(X – 𝑥)ҧ 2
𝑦ො ± t.Sy.x 1 + 1/n +
∑(X - 𝑥)ҧ 2

df – degree of freedom = n-2 X

Standard error untuk y:


Interval Y Interval
∑ (Y - 𝑦)2
ො pada garis < individual Y
Syx = regresi
(n-2)
Bahan Pak Martoyo
Seberapa besr nilai x mempengaruhi nilai y
Computer NAMA Penghasilan Pengeluaran
Koefisien korelasi

Output A 10 15
Interval untuk intercept
B 18 23 coefficient of = 5,2796 ± t . 2,911
C 28 25 detemination
D 7 12,5
E 13 13
F 16 12
G 22 19
jumlah data
H 15 16
I 20 21 p-value
J 10 8

Test Hipothesis untuk β


H0 : β = 0
H1 : β ≠ 0
Bisa juga dilakukan test apakakah nilai b = 0,72
Pada α = 0,01 tolak H0 karena sebenarnya terlalu besar. Mungkin di bawah 0,4
p = 0,003
H0 : β ≤ 0,4
 Β > 0  penghasilan H1 : β > 0,4
berpengaruh terhadap
pengeluaran 𝑏−β 0,702 −0,4
t= = =1,753
σ𝑝 0,1722

Apakah x mempengaruhi y? α = 0,01 t = 2,896


apakah beta tidak sama dengan 0? df = 10-2
 Terima H0  b tidak lebih dari 0,4$

Bahan Pak Martoyo


Computer
Output

Bahan Pak Martoyo


Computer
Output

Bahan Pak Martoyo


Computer RESIDUAL OUTPUT
Output X Variable 1 Residual Plot
Observation X Y Predicted Y Residuals (Y-Yc)2 20,0000
1 20 30 42,6316 -12,6316 159,5568
10,0000

Residuals
2 40 60 66,3158 -6,3158 39,8892
3 20 40 42,6316 -2,6316 6,9252 0,0000
0 10 20 30 40 50
4 30 60 54,4737 5,5263 30,5402 -10,0000
5 10 30 30,7895 -0,7895 0,6233
-20,0000
6 10 40 30,7895 9,2105 84,8338 X Variable 1
7 20 40 42,6316 -2,6316 6,9252
8 20 50 42,6316 7,3684 54,2936
9 20 30 42,6316 -12,6316 159,5568
10 30 70 54,4737 15,5263 241,0665
Se = 9,9008
X Variable 1 Line Fit Plot
80
60
40

Y
Y
20
0 Predicted Y
0 20 40 60
Sε atau Syx X Variable 1

Bahan Pak Martoyo


Computer
Output Standard error untuk b

𝑺𝒚𝒙
Sb =
σ 𝑿𝟐 − σ𝑿 𝟐/𝒏

𝑆𝑦𝑥 9,908
Sb = = = 0,359
σ 𝑋2 − σ𝑋 2/𝑛 5600−2202/10

Bahan Pak Martoyo


Koefisien Determinasi

Unexplained
variation
Total
variation

Explained
variation
Y

Explained Variation
R2 = koefisien determinasi =
Total Variation

Bahan Pak Martoyo


Lihat box Anova

Regression Sum of Square = SSR = ∑ (Yc – Y)2


Residual or Error Sum of Square = SSE = ∑ (Y - Yc)2
Total Sum of Square = SST = ∑ (Y - Y)2
𝑆𝑆𝑅 𝑆𝑆𝐸
R2 = 𝑆𝑆𝑇 = 1 − 𝑆𝑆𝑇
57,6% penyimpangan dari raata-rata Y
784,211 disebabkan oleh garis regresi.
R2 = 1 − = 1 – 0,242 = 0,576 Sisanya oleh factor lain dan unsur
1850,00
random

Bahan Pak Martoyo


Asumsi untuk regresi

1. Ada hubungan linear antara independent dan dependent


variable
2. Variasi residual tetap sama untuk Yc kecil maupun besar
3. Residual (Y – Yc) mengikuti distribusi normal
4. Independent variable tidak saling berkorelasi (tidak ada
multicollinearity)
5. Residual independent satu terhadap yang lain.

Pengujian asumsi di atas akan


dibahas pada mata kuliah
Metodologi Riset

Bahan Pak Martoyo


Linear Regression
• The owner of Haverty’s Furniture Company was studying the
relationship between sales and the amount spent on advertising.
The advertising expense and sales revenue, both in millions of
dollars, for the last 4 months are repeated below.

Month Advertising Expense Sales Revenue


July 2 7
August 1 3
September 3 8
October 4 10
Computer Output
Multiple Regression
Tugas
• Kerjakan soal-soal berikut:
Latihan
Latihan
Latihan
• Determine the regression equation: y=1,5+2,2x

• Calculate the coefficient of determination: nilai r square


• Calculate the correlation coefficient: multiple r
• Calculate the standard error of estimate: 0,949
• Calculate the standard error of the slope: 0,424
• What are the hypotheses for the above ANOVA table?
• What are the decision rules to conclude whether the advertising expense
significantly affect sales?
• For significance level 0.05, what is the decision regarding the impact of
advertising expense to sales?
Latihan

p-value
Latihan
 Ada berapa independent variables? 5
 Faktor-faktor apa saja yang menjadi independent variables?
 Ada berapa jumlah data yang digunakan (ukuran sampel)? 10
 Tuliskan persamaan regresinya
 Berapa nilai coefficient of multiple determination? 0,99433
 Berapa nilai adjusted coefficient of determination? 0,987
 Tuliskan rumusan hipotesis untuk tabel ANOVA di atas
 Lakukan global test dengan significance level 5% untuk menyimpulkan apakah ada sebagian dari
faktor-faktor yang diteliti yang mempengaruhi nilai tahunan penjualan mobil?
 Lakukan individual test dengan significance level 5% untuk menyimpulkan apakah faktor
“personal income” mempengaruhi nilai tahunan penjualan mobil?

Anda mungkin juga menyukai