Vous êtes sur la page 1sur 10

SIMULASI MEMBANGKITKAN DATA

REGRESI LINEAR SEDERHANA & BERGANDA

(Tugas Analisis Regresi Terapan)

Disusun Oleh :
Nathanael Manogari (1517031063)
Anis Mahfud Alafi (1517031114)

JURUSAN MATEMATIKA
FAKULTAS MATEMATIKA DAN ILMU PENGETAHUAN ALAM
UNIVERSITAS LAMPUNG
2017
1. Bangkitkan data sebanyak 50 untuk analisis regresi dengan kriteria sbb :
~ N(0,1) X1 ~ uniform (1,10)
0 = 0 1 = 5
Y = log (0 + 1 X1 + )
= log (0 + 5 X1 + )

Jawab :

X1 Y
(Uniform) (Normal)

7,02969 -1,23966 1,53031

3,04227 2,13610 1,23924

3,49752 -0,03366 1,24189

3,74840 1,17957 1,29932

1,59697 -0,34083 0,88332

9,03892 -0,44314 1,65081

3,82837 1,67876 1,31849

4,66225 -1,10131 1,34655

8,08092 0,01434 1,60659

1,60036 -1,46639 0,81527

4,25867 -1,73174 1,29140

2,91503 1,08559 1,19481

2,36723 0,43668 1,08895

4,69854 -1,15439 1,34905

8,43987 0,18498 1,62721

8,74065 -0,84778 1,63201

7,23922 -1,38703 1,54169

4,29045 -0,35210 1,32429

7,03363 -0,65380 1,53800

7,17320 -0,70915 1,54601


3,64924 0,11179 1,26383

5,99356 -0,29039 1,47243

5,29822 -0,20682 1,41970

3,43713 0,01301 1,23549

8,00548 -0,61723 1,59561

6,43741 -0,68902 1,49828

7,11799 0,47170 1,55705

3,69254 -0,18480 1,26193

9,29845 -2,65866 1,64181

5,39548 -0,77018 1,41842

7,85320 2,35381 1,61930

4,76091 1,08805 1,39607

7,78459 0,75604 1,59856

3,40530 -0,38643 1,22115

6,88808 -1,69389 1,51517

6,57532 0,35783 1,52159

3,39960 0,47459 1,24236

2,40395 0,76457 1,10668

3,80632 0,03331 1,28023

5,72536 -1,06464 1,44031

8,70316 0,57970 1,64439

5,90355 -1,28756 1,45071

1,83661 3,00588 1,08597

7,08794 1,21293 1,56410

5,08198 0,70394 1,41687

4,14071 0,50573 1,32653


7,21474 1,11567 1,57042

2,09683 1,26826 1,07013

4,03176 0,40215 1,31304

2. Lakukan analisis regresi terhadap data Y, X1, dan X2 dengan menggunakan model tanpa
intercept, berikan kesimpulan model tanpa intercept, berikan kesimpulan berdasarkan hasil
uji anava dan uji parsial koefisien regresi.

Jawab :
N = 50
~ N(0,1)
1 = 5 2 = 6
X1~ Uniform (1,10)
X2~ Gamma (1,10)
Y = 1X1 + 2X2 +
= 5X1 + 6X2 +

The regression equation is


Y = 0,223 X1 + 0,0577 X2

Predictor Coef SE Coef T P


Noconstant
X1 0,22260 0,01458 15,26 0,000
X2 0,057750 0,006959 8,30 0,000

Interpretasi :

Analisis Ragam

Analysis of Variance

Source DF SS MS F P
Regression 2 159,431 79,716 380,54 0,000
Residual Error 48 10,055 0,209
Total 50 169,486

Uji Kelayakan Model :

Uji Parsial Koefisien Regresi (Slope) menggunakan P-Value :

Kesimpulan :
3. Lakukan uji asumsi normalitas terhadap galat/error, berikan kesimpulan

Jawab :

Uji Anderson Darling

Probability Plot of Galat


Normal
99
Mean 0,01426
StDev 1,116
95 N 50
AD 0,174
90
P-Value 0,921
80
70
Percent

60
50
40
30
20

10

1
-3 -2 -1 0 1 2 3
Galat

Interpretasi :

Uji Kolmogorov-Smirnov

Probability Plot of Galat


Normal
99
Mean 0,01426
StDev 1,116
95 N 50
KS 0,051
90
P-Value >0,150
80
70
Percent

60
50
40
30
20

10

1
-3 -2 -1 0 1 2 3
Galat

Interpretasi :
4. Lakukan diagnose pencilan dengan membuat plot pencar antara galat dan nilai dugaan.
Bagaimana kesimpulan anda?

Jawab :

Scatterplot of Galat vs Y2

1
Galat

-1

-2

-3
1,0 1,2 1,4 1,6 1,8 2,0 2,2 2,4 2,6
Y

Kesimpulan :

5. Lakukan Uji Heteroskedastisitas menggunakan uji park dan uji glejser, analisis terhadap hasil!

Jawab :

Uji Glejser

Script :

data class;
input X1 X2 Y;
datalines;
7.029686 11.40227 2.009971
3.042268 21.18511 2.159742
3.497517 1.326131 1.405017
3.748405 10.58342 1.921281
1.596973 24.46196 2.188692
9.038923 6.443942 1.921245
3.82837 29.44779 2.295583
4.662246 5.738159 1.753115
8.080924 7.721643 1.938264
1.600361 0.834471 1.06229
4.258666 14.27115 2.021968
2.91503 2.225685 1.46262
2.367234 2.820301 1.465303
4.698542 10.04574 1.917047
8.439869 6.659113 1.915606
8.740646 17.50588 2.169941
7.23922 1.111974 1.617848
4.290454 10.03422 1.91012
7.033633 1.069049 1.612027
7.173196 6.754968 1.879019
3.649242 7.666132 1.808581
5.993556 5.773167 1.808322
5.298217 2.550884 1.618984
3.437132 6.734091 1.760447
8.005481 5.378551 1.855407
6.437409 1.572556 1.612077
7.117991 2.337076 1.6997
3.692539 2.934993 1.554948
9.29845 6.226639 1.909521
5.395479 5.981336 1.793058
7.853197 1.278142 1.692747
4.760913 0.163842 1.412892
7.784589 2.845072 1.753961
3.405298 6.525025 1.746558
6.888084 6.975265 1.872728
6.575319 6.96568 1.875226
3.399603 21.41538 2.164248
2.403946 14.91964 2.009885
3.806315 20.76157 2.157258
5.725356 40.11277 2.428522
8.703161 14.63765 2.120315
5.903549 2.695377 1.647407
1.836608 9.220044 1.829363
7.087937 0.709898 1.611851
5.081983 1.949773 1.577635
4.140708 11.04842 1.942007
7.214745 6.392404 1.878199
2.096835 1.673504 1.338326
4.031756 10.75263 1.929811
3.59949 17.48404 2.089872
;
proc reg data=class ;
model Y =X1 X2/noint;
output out=hasil r=error;
run;
data class;
set hasil;
Ar=abs(error);
Proc reg data=class;
model Ar=X1 X2/noint;
run;

Output :

The REG Procedure


Model: MODEL1
Dependent Variable: Ar

NOTE: No intercept in model. R-Square is redefined.

Analysis of Variance

Sum of Mean
Source DF Squares Square F Value Pr > F

Model 2 5.88010 2.94005 33.80 <.0001


Error 48 4.17492 0.08698
Uncorrected Total 50 10.05502
Root MSE 0.29492 R-Square 0.5848
Dependent Mean 0.36637 Adj R-Sq 0.5675
Coeff Var 80.49665

Parameter Estimates

Parameter Standard
Variable DF Estimate Error t Value Pr > |t|

X1 1 0.02937 0.00940 3.13 0.0030


X2 1 0.01774 0.00448 3.96 0.0003

Interpretasi : output diatas menghasilkan suatu hubungan antara x1 dan x2 adalah


0.02937+0.01774. kemudian berdasar kan uji glejser diatas menghasilkan nilai hitung f
<0.0001 dengan taraf signfikan sebesar 5% maka dapat dimpulkan bahwa tidak terdapat
heterokeditisitas

Uji Park

Script :

data class;
input X1 X2 Y;
datalines;
7.029686 11.40227 2.009971
3.042268 21.18511 2.159742
3.497517 1.326131 1.405017
3.748405 10.58342 1.921281
1.596973 24.46196 2.188692
9.038923 6.443942 1.921245
3.82837 29.44779 2.295583
4.662246 5.738159 1.753115
8.080924 7.721643 1.938264
1.600361 0.834471 1.06229
4.258666 14.27115 2.021968
2.91503 2.225685 1.46262
2.367234 2.820301 1.465303
4.698542 10.04574 1.917047
8.439869 6.659113 1.915606
8.740646 17.50588 2.169941
7.23922 1.111974 1.617848
4.290454 10.03422 1.91012
7.033633 1.069049 1.612027
7.173196 6.754968 1.879019
3.649242 7.666132 1.808581
5.993556 5.773167 1.808322
5.298217 2.550884 1.618984
3.437132 6.734091 1.760447
8.005481 5.378551 1.855407
6.437409 1.572556 1.612077
7.117991 2.337076 1.6997
3.692539 2.934993 1.554948
9.29845 6.226639 1.909521
5.395479 5.981336 1.793058
7.853197 1.278142 1.692747
4.760913 0.163842 1.412892
7.784589 2.845072 1.753961
3.405298 6.525025 1.746558
6.888084 6.975265 1.872728
6.575319 6.96568 1.875226
3.399603 21.41538 2.164248
2.403946 14.91964 2.009885
3.806315 20.76157 2.157258
5.725356 40.11277 2.428522
8.703161 14.63765 2.120315
5.903549 2.695377 1.647407
1.836608 9.220044 1.829363
7.087937 0.709898 1.611851
5.081983 1.949773 1.577635
4.140708 11.04842 1.942007
7.214745 6.392404 1.878199
2.096835 1.673504 1.338326
4.031756 10.75263 1.929811
3.59949 17.48404 2.089872
;
proc reg data=class ;
model Y =X1 X2/noint;
output out=hasil r=error;
run;
Data class;
set hasil;
r2 = error ** 2;
lnr2 = log (r2);
lnX1 = log (X1);
lnX2 = log (X2);
Proc reg data=class;
model lnr2 = X1 X2/noint;
run;

Output :

The REG Procedure


Model: MODEL1
Dependent Variable: lnr2

NOTE: No intercept in model. R-Square is redefined.

Analysis of Variance

Sum of Mean
Source DF Squares Square F Value Pr > F

Model 2 442.41361 221.20681 49.57 <.0001


Error 48 214.20839 4.46267
Uncorrected Total 50 656.62200

Root MSE 2.11250 R-Square 0.6738


Dependent Mean -2.82425 Adj R-Sq 0.6602
Coeff Var -74.79871

Parameter Estimates
Parameter Standard
Variable DF Estimate Error t Value Pr > |t|

X1 1 -0.55707 0.06731 -8.28 <.0001


X2 1 0.02856 0.03212 0.89 0.3783

Interpretasi : pada output diatas dapat kita lihat model hubungan antara xi dan x2 adalah -
0.55707+0.02856X g

6. Lakukan cara terbaik yang dapat anda lakukan untuk mengatasi masalah penyimpangan
asumsi dalam model regresi anda.