Anda di halaman 1dari 33

REGRESI LINEAR DAN LOGISTIK

OLEH

ZULAELA

PRODI STATISTIKA FAKULTAS MATEMATIKA DAN ILMU PENGETAHUAN ALAM


CLINICAL EPIDEMIOLOGY & BIOSTATISTICS UNIT (CE&BU), FK-KMK
UNIVERSITAS GADJAH MADA
REGRESI LINEAR

Analisis Regresi Linear


Regresi linear merupakan metode analisis data yang memanfaatkan hubungan
antara dua variabel atau lebih (Berat Badan dengan Umur; FEV1 dengan
Tinggi Badan; Berat Badan dengan Umur, Asupan Gizi dan Gender).

Y=variabel dependen, tak bebas, tergantung, respon, outcome.


X=variabel independen, bebas, tak tergantung, prediktor.

Tujuan:
•Menyelidiki bentuk/pola hubungan antara Y dengan X.
•Meramalkan/mengestimasi/menduga mean atau rata-rata dari Y populasi
berdasarkan X yang diberikan.
Case Summariesa

berat badan umur


1 15.00 20.00
2 13.00 16.00
3 9.00 12.00
4 6.00 6.00
5 6.00 10.00
6 18.00 34.00
7 16.00 25.00
8 11.00 20.00
9 6.00 8.00
10 12.00 14.00
11 18.00 30.00
12 22.00 36.00
13 7.00 9.00
14 10.00 10.00
15 10.00 15.00
16 14.00 24.00
17 20.00 30.00
Total N 17 17
a. Limited to first 100 cases.

Scatter Plot
Coefficientsa
Model Unstandardized Coefficients Standardized t Sig.
Coefficients

B Std. Error Beta

(Constant) 3.025 .838 3.608 .003


1
Umur .507 .040 .956 12.652 .000

a. Dependent Variable: berat badan

Berat Badan = 3.025 + 0.507 Umur

Untuk seorang anak yang berumur 18 bulan, maka berat anak tersebut dapat
diprediksi sebesar 12.151 kg
y x xy x2 y2
. . . . .
. . . . .
Σy=213 Σx=319 Σxy=4741 Σx2=7455 Σy2=3081

𝑦ො = 𝑏0 + 𝑏1 𝑥

𝑛 σ 𝑥𝑦 − σ 𝑥 σ 𝑦
𝑏1 =
𝑛 σ 𝑥 2 − (σ 𝑥)2

𝑏0 = 𝑦ത − 𝑏1 𝑥ҧ
σ𝑦
𝑦ത =
𝑛
σ𝑥
𝑥ҧ =
𝑛
Analisis Korelasi

Analisis korelasi merupakan metode analisis data yang mengukur derajat


hubungan antara dua variabel random X dan Y melalui sebuah bilangan yang
disebut koefisien korelasi r.

n xy −  x y
r=
[n x 2 − ( x) 2 ][n y 2 − ( y ) 2 ]

Kuadrat dari koefisien korelasi disebut koefisien determinasi yang


merepresentasikan besarnya proporsi variasi dalam variabel y yang dijelaskan
oleh variabel x dalam model. Dengan menggunakan pasangan data berat
badan dan umur anak balita, diperoleh nilai koefisien korelasi sebesar 0.956
dan koefisien determinasi sebesar 0.914
𝒓 ≈ +𝟏 derajat hubungan antar dua variabel random sangat
kuat dan korelasinya positif (salah satu variabel naik nilainya
variabel yang lain juga naik nilainya).

𝒓 ≈ −𝟏 derajat hubungan antar dua variabel random sangat


kuat tetapi korelasinya negatif (salah satu variabel naik
nilainya variabel yang lain turun nilainya).

𝒓 ≈ 𝟎 derajat hubungan antar dua variabel random sangat


lemah (tidak ada korelasi linear antar dua variabel).
Pearson Correlation
Correlations
Berat Badan Umur
Pearson Correlation 1 .956**
Berat Badan Sig. (2-tailed) .000
N 17 17
Pearson Correlation .956** 1
Umur Sig. (2-tailed) .000
N 17 17

**. Correlation is significant at the 0.01 level (2-tailed).

Spearman Correlation
Correlations
Berat Badan Umur

Correlation Coefficient 1.000 .957**


Berat Badan
Sig. (2-tailed) . .000
N 17 17
Spearman's rho
Correlation Coefficient .957** 1.000
Umur
Sig. (2-tailed) .000 .
N 17 17

**. Correlation is significant at the 0.01 level (2-tailed).


Revenue = 343.706 + 3.221 Advertisement costs

If the expenditure on advertising is 35, the expected sales result is


456.441
The square of the correlation coefficient is called the
coefficient of determination which represents the
proportion of variation in variable Y that is explained by
variable X in the model. By using a pair of sales data and
costs for advertising, the correlation coefficient is 0.635
and the determination coefficient is 0.403.
Model Regresi Linear Ganda

Estimasi model regresi linear ganda dengan p variabel


independen ditunjukkan dengan persamaan:

Y = b0 + b1X1 + b2X2 + ..... + bpXp

variabel dependen Y kontinu, sedangkan variabel-


variabel independen X dapat kontinu atau kategorik.
Seorang peneliti ingin mengetahui seberapa baik dia dapat memprediksi
length of stay seorang pasien apabila diketahui variabel independennya
number of previous admissions, age dan gender. Untuk itu telah
dikumpulkan data untuk 15 pasien sbb:
Case Summariesa
Length of Number of Age Gender
stay previous
admissions

1 15 2 21 male
2 15 0 18 male
3 21 3 22 male
4 28 0 24 male
5 30 1 25 male
6 35 4 25 female
7 40 2 26 female
8 35 2 34 female
9 30 1 25 male
10 45 2 38 female
11 50 3 44 female
12 60 4 51 female
13 45 4 39 female
14 60 3 54 female
15 50 4 55 female
Total N 15 15 15 15
a. Limited to first 100 cases.
ANOVAa
Model Sum of Squares df Mean Square F Sig.

Regression 2653.792 3 884.597 33.653 .000b


1 Residual 289.141 11 26.286
Total 2942.933 14
a. Dependent Variable: Length of stay
b. Predictors: (Constant), Gender, Number of previous admissions, Age

Coefficientsa
Model Unstandardized Standardized t Sig.
Coefficients Coefficients

B Std. Error Beta


(Constant) 16.186 7.175 2.256 .045
Number of previous
-.859 1.435 -.083 -.598 .562
1 admissions
Age .815 .164 .711 4.977 .000
Gender -10.360 4.421 -.362 -2.343 .039
a. Dependent Variable: Length of stay

Model Summary
Model R R Square Adjusted R Square Std. Error of the
Estimate

1 .950a .902 .875 5.127


a. Predictors: (Constant), Gender, Number of previous admissions, Age
Y = Length of stay
X1 = Number of previous admissions
X2 = Age
X3 = Gender

𝑌෠ = 𝑏0 + 𝑏1 𝑋1 + 𝑏2 𝑋2 + 𝑏3 𝑋3

𝑌෠ = 16.186 + −.859 𝑋1 + .815 𝑋2 + −10.360 𝑋3


Regresi Logistik

Regresi logistik digunakan untuk analisis dalam keadaan di


mana variabel dependen Y mempunyai skala pengukuran
nominal, khususnya yang dikotomi (biner) terdiri atas dua
hasil yang mungkin: gagal bayar/ tidak, dead/alive, breast
cancer/not breast cancer, Berat Bayi Lahir Rendah/ Tidak,
CHD/ tidak.
Bagaimana kalau data set seperti dalam tabel berikut?
ID AGRP AGE CHD ID AGRP AGE CHD ID AGRP AGE CHD
1 1 20 No 35 3 38 No 68 6 51 No
2 1 23 No 36 3 39 No 69 6 52 No
3 1 24 No 37 3 39 Yes 70 6 52 Yes
4 1 25 No 38 4 40 No 71 6 53 Yes
5 1 25 Yes 39 4 40 Yes 72 6 53 Yes
6 1 26 No 40 4 41 No 73 6 54 Yes
7 1 26 No 41 4 41 No 74 7 55 No
8 1 28 No 42 4 42 No 75 7 55 Yes
9 1 28 No 43 4 42 No 76 7 55 Yes
10 1 29 No 44 4 42 No 77 7 56 Yes
11 2 30 No 45 4 42 Yes 78 7 56 Yes
12 2 30 No 46 4 43 No 79 7 56 Yes
13 2 30 No 47 4 43 No 80 7 57 No
14 2 30 No 48 4 43 Yes 81 7 57 No
15 2 30 No 49 4 44 No 82 7 57 Yes
16 2 30 Yes 50 4 44 No 83 7 57 Yes
17 2 32 No 51 4 44 Yes 84 7 57 Yes
18 2 32 No 52 4 44 Yes 85 7 57 Yes
19 2 33 No 53 5 45 No 86 7 58 No
20 2 33 No 54 5 45 Yes 87 7 58 Yes
21 2 34 No 55 5 46 No 88 7 58 Yes
22 2 34 No 56 5 46 Yes 89 7 59 Yes
23 2 34 Yes 57 5 47 No 90 7 59 Yes
24 2 34 No 58 5 47 No 91 8 60 No
25 2 34 No 59 5 47 Yes 92 8 60 Yes
26 3 35 No 60 5 48 No 93 8 61 Yes
27 3 35 No 61 5 48 Yes 94 8 62 Yes
28 3 36 No 62 5 48 Yes 95 8 62 Yes
29 3 36 Yes 63 5 49 No 96 8 63 Yes
30 3 36 No 64 5 49 No 97 8 64 No
31 3 37 No 65 5 49 Yes 98 8 64 Yes
32 3 37 Yes 66 6 50 No 99 8 65 Yes
33 3 37 No 67 6 50 Yes 100 8 69 Yes
34 3 38 No
Regresi Logistik Sederhana

Regresi logistik digunakan untuk analisis dalam keadaan di mana


variabel dependen Y terdiri atas dua hasil yang mungkin: CHD/not
CHD. Variabel independen X: AGE

Scatter Plot
AGRP * CHD Crosstabulation
CHD
Yes
Mean
No (proportion) Total
1 Count 9 1 10
% within AGRP 90.0% 10.0% 100.0%
2 Count 13 2 15
% within AGRP 86.7% 13.3% 100.0%
3 Count 9 3 12
% within AGRP 75.0% 25.0% 100.0%
4 Count 10 5 15
AGE_GROUP % within AGRP 66.7% 33.3% 100.0%
5 Count 7 6 13
% within AGRP 53.8% 46.2% 100.0%
6 Count 3 5 8
% within AGRP 37.5% 62.5% 100.0%
7 Count 4 13 17
% within AGRP 23.5% 76.5% 100.0%
8 Count 2 8 10
% within AGRP 20.0% 80.0% 100.0%
Count 57 43 100
Total % within AGRP 57.0% 43.0% 100.0%
Scatter Plot
Fungsi logistik:

f(z)

z
Model logistik dapat diperoleh dari fungsi logistik dengan mengganti

Sehingga probabilitas seseorang akan terkena CHD adalah

g ( x)
e 1
π = P(Y = 1) = E (Y = 1 | X i = xi ) = = − g ( x)
1+ e g ( x)
1+ e

dengan
 π 
g ( x) = ln   = β0 + β1 x + ε
1 − π 
Variables in the Equation

B S.E. Wald df Sig. Exp(B) 95% C.I.for EXP(B)

Lower Upper

AGE .111 .024 21.254 1 .000 1.117 1.066 1.171


Step 1a
Constant -5.309 1.134 21.935 1 .000 .005

a. Variable(s) entered on step 1: AGE.

1
𝑃 𝑌 = 1 = 𝑃 𝐶𝐻𝐷 =
1 + 𝑒 −(−5.309 + 0.111 AGE)
Jika seseorang mempunyai umur berturut-turut 50 tahun, 60 tahun dan 70
tahun, maka resiko atau probabilitas terkena CHD sebesar 0.560, 0.794,
dan 0.921
𝑂𝑅 = exp( 𝛽𝑖 ) = exp(0.111) = 1.117

𝑂𝑅 = exp( Δ. 𝛽𝑖 ) = exp(10*0.111) = 3.03

𝑆𝑒𝑡𝑖𝑎𝑝 𝑝𝑒𝑟𝑢𝑏𝑎ℎ𝑎𝑛 ∆ 𝑢𝑚𝑢𝑟10 𝑡𝑎ℎ𝑢𝑛,


𝑟𝑒𝑠𝑖𝑘𝑜 𝐶𝐻𝐷 𝑠𝑒𝑏𝑒𝑠𝑎𝑟 3
Variables in the Equation

B S.E. Wald df Sig. Exp(B) 95% C.I.for EXP(B)

Lower Upper

2.099 .479 19.217 1 .000 8.157 3.191 20.848


AGE_1_2(1)

Step 1a -1.038 .282 13.526 1 .000 .354

Constant

a. Variable(s) entered on step 1: AGE_1_2.


Variables in the Equation

B S.E. Wald df Sig. Exp(B) 95% C.I.for


EXP(B)

Lower Upper

21.003 2 .000
AGE_1_2_3

1.411 .553 6.502 1 .011 4.100 1.386 12.128


AGE_1_2_3(1)
Step 1a
2.568 .574 20.016 1 .000 13.045 4.234 40.191
AGE_1_2_3(2)

-1.316 .340 15.013 1 .000 .268


Constant

a. Variable(s) entered on step 1: AGE_1_2_3.


Regresi Logistik Ganda
Model regresi logistik ganda dengan p variabel independen
dinyatakan dengan persamaan:
 0 + 1 X 1 +  2 X 2 +......+  p X p
e
P(Y = 1) =  0 + 1 X 1 +  2 X 2 +......+  p X p
1+ e

atau 1
P(Y = 1) = − (  0 + 1 X 1 +  2 X 2 +......+  p X p )
1+ e
Transformasi logit dinyatakan sebagai:

P (Y = 1)
ln[ ] =  0 +  1 X 1 +  2 X 2 + ..... +  p X p
1 − P (Y = 1)

yang merupakan fungsi linier.


Untuk variabel independen yang dikotomus, OR dinyatakan dengan:

OR = exp(  i )

dengan interval konfidensi 95% nya adalah:

exp[  i  1.96.( s tan dard _ error _ of _  i )]

Untuk variabel independen yang kontinu, OR dinyatakan:

OR = exp( . i )

dengan interval konfidensi 95% untuk perubahan  unit dari variabel


independen adalah:

exp[ . i  1.96..( s tan dard _ error _ of _  i )]


Sebagai ilustrasi analisis regresi logistik ganda digunakan
sebagian variabel dari data studi tentang low birth weight
(berat badan lahir rendah). Tujuan dari studi ini adalah
untuk mengidentifikasi faktor resiko yang berhubungan
dengan kelahiran bayi yang low birth weight (berat < 2500
gram). Seratus delapan puluh sembilan ibu yang ikut
penelitian, 130 melahirkan bayi normal, sedangkan 59
melahirkan bayi dengan low birth weight.
Empat faktor resiko yang diduga berpengaruh terhadap
kelahiran bayi dengan low birth weight adalah:

o AGE: Age of the Mother in Years.


o LWT: Weight in Pounds at the Last Mentrual Period.
o RACE: Race (1 = White, 2 = Black, 3 = Other).
o FTV: Number of Physician Visits During the First
Trimester.
Output Regresi Logistik Ganda:
BBLR vs AGE, LWT, RACE & FTV
Dengan menggunakan koefisien regresi (dari tabel di atas),
probabilitas akan terjadinya kelahiran bayi dengan low birth weight
adalah

1
P (Y = 1) =
1 + e −(1.295 −.024 AGE −.014 LWT +1.004 RACE (1) +.433 RACE ( 2 ) −.049 FTV )

Jika seorang ibu dengan karakteristik: AGE=30, LWT =140,


RACE(1)=1, RACE(2)=0 & FTV (2), maka resiko akan melahirkan
bayi dengan low birth weight sebesar P(Y=1)=0.3825=38.25%. Jika
terdapat 10000 ibu dengan karakteristik seperti itu, maka 3825
diantaranya akan melahirkan bayi dengan low birth weight.
OR untuk RACE(1) = 2.729 (tabel output regresi logistik
dengan 4 faktor resiko) menunjukkan bahwa race ibu yang
black mempunyai resiko akan melahirkan bayi yang low
birth weight 2.729 kali dibanding dengan race ibu yang white
setelah mengontrol variabel AGE, LWT dan FTV dalam
model. Interval konfidensi 95% untuk OR dari RACE(1) tidak
memuat angka 1, hal ini menunjukkan bahwa RACE(1) itu
berpengaruh terhadap resiko terjadinya kelahiran bayi yang
low birth weight, di samping Weight in Pounds at the Last
Mentrual Period.

Anda mungkin juga menyukai