Your SlideShare is downloading. ×
Program Pascal Regresi Linier Sederhana
Upcoming SlideShare
Loading in...5
×

Thanks for flagging this SlideShare!

Oops! An error has occurred.

×

Introducing the official SlideShare app

Stunning, full-screen experience for iPhone and Android

Text the download link to your phone

Standard text messaging rates apply

Program Pascal Regresi Linier Sederhana

1,383
views

Published on


0 Comments
0 Likes
Statistics
Notes
  • Be the first to comment

  • Be the first to like this

No Downloads
Views
Total Views
1,383
On Slideshare
0
From Embeds
0
Number of Embeds
0
Actions
Shares
0
Downloads
101
Comments
0
Likes
0
Embeds 0
No embeds

Report content
Flagged as inappropriate Flag as inappropriate
Flag as inappropriate

Select your reason for flagging this presentation as inappropriate.

Cancel
No notes for slide

Transcript

  • 1. program regresi_linier;uses wincrt;type data=array[1..100] of real;vari,n:integer; k,l,m:integer;totx,toty,totxy,totx2,toty2,ratax,ratay,b,a,Jxx,Jyy,Jxy,JKR,JKG,JKT,s2,f,korelasi,determinasi,p: real;x,y,z,x2,y2:data;start,prediktor,respon,coba,pilih:string[15];pilihantampil,pilihan:char;label ulang,akhir;beginfor k:=3 downto 1 dobeginfor l:=1 to 1000 dobegingotoxy(1,1); write(k);end;for m:=1 to 500 doclrscr;end;for k:=1 to 1000 dobegingotoxy(1,1);
  • 2. writeln( ****** ***** * ** *** *** ** ******* );writeln( ** * * * * * * * * * * * );writeln( ** ***** * * ** * * ** * * ** * * );writeln( ** * * * * * * * * * );writeln( ****** ***** ***** * ** ** * * );end;clrscr;for l:=1 to 1000 dobegingotoxy(1,1);writeln( *** ** ******* ** ** * ****** );writeln( * * * * * * * ** * * );writeln( * * * ** * * * ** * * * * * ***** );writeln( * * * * * * * * ** * * );writeln( *** * * * * * * ** ****** );end;beginclrscr; writeln(----------------------------------------------); writeln(| program persamaan regresi linear sederhana |); writeln(| Created By S1 Statistika B-Genap |); writeln(----------------------------------------------); writeln; write(Prediktor = ); readln(prediktor); write(Respon = ); readln(respon); writeln(Data maksimal 100 sampel); write(masukkan jumlah sampel (n) : );
  • 3. readln (n);writeln ( masukkan data x dan y : );for i:=1 to n do begin write(x,i,=);readln(x[i]); write(y,i,=);readln(y[i]); totx:=totx+x[i]; toty:=toty+y[i]; end;totxy:=0;for i:=1 to n do begin z[i]:=x[i]*y[i]; totxy:=totxy+z[i]; end;totx2:=0;for i:=1 to n do begin x2[i]:=sqr(x[i]); totx2:=totx2+x2[i]; end;toty2:=0;for i:=1 to n do begin y2[i]:=sqr(y[i]); toty2:=toty2+y2[i]; end;
  • 4. clrscr;writeln(===================================================);writeln( ANALISIS REGRESI LINIER );writeln(| x | y | xy | x2 | y2 |);for i:=1 to n dowriteln(x[i]:5:2,y[i]:10:2,z[i]:12:2,x2[i]:11:2,y2[i]:10:2);beginwriteln(=================================================);writeln(totx:5:2,toty:10:2,totxy:12:2,totx2:12:2,toty2:10:2);writeln;writeln;b:=((n*totxy)-(totx*toty))/((n*totx2)-(sqr(totx)));a:=(toty-b*totx)/n;Jxx:=totx2-(sqr(totx)/n);Jyy:=toty2-(sqr(toty)/n);Jxy:=totxy-(totx*toty/n);JKR:=b*Jxy;JKG:=Jyy-JKR;JKT:=JKR+JKG;writeln(Persamaan Regresinya : );if b>0 thenwriteln(respon,=,a:3:2,+,b:3:2,prediktor)elsewriteln(respon,=,a:3:2,b:3:2,prediktor);if (a>=0) and (b>0) thenwriteln(==> Jadi, dari model diatas dapat diketahui apabila x bertambah 1 maka nilai y,
  • 5. akan bertambah sebesar ,b:3:2, dan ketika x sama dengan 0 maka y akan bernilai ,a:3:2)else if (a>=0) and (b<0) thenwriteln(==> Jadi, dari model diatas dapat diketahui apabila x bertambah 1 maka nilai y, akan berkurang sebesar ,b:3:2, dan ketika x sama dengan 0 maka y akan bernilai ,a:3:2)else if (a<0) and (b>0) thenwriteln(==> Jadi, dari model diatas dapat diketahui apabila x bertambah 1 maka nilai y, akan bertambah sebesar ,b:3:2, dan ketika x sama dengan 0 maka y akan bernilai ,a:3:2)elsewriteln(==> Jadi, dari model diatas dapat diketahui apabila x bertambah 1 maka nilai y, akan berkurang sebesar ,b:3:2, dan ketika x sama dengan 0 maka y akan bernilai ,a:3:2);end; writeln; write(Mau menguji regresi?); write(press “enter” to start !); readln(start); ulang: clrscr;writeln(---------------------------------);writeln( Uji Regresi Linier );writeln(---------------------------------);writeln( created by S1 Statistika B-GENAP);writeln( ================================);writeln( Daftar Yang Ingin Ditampilkan );writeln( 1) Koefisien Korelasi );writeln( 2) Koefisien Determinasi );writeln( 3) Tabel Anova );writeln( which one do you want ? );
  • 6. writeln( masukan pilihan : ); writeln(_________________________________); readln(pilihantampil); case pilihantampil of 1: begin korelasi:=Jxy/(sqrt(Jxx*Jyy)); writeln(koefisien korelasi dari regresi tersebut adalah r=,korelasi:2:2); end; 2: begin Determinasi:=(JKR/JKT)*100; p:=(JKG/JKT)*100; writeln(koefisien determinasi dari regresi tersebut adalah R^2=,determinasi:2:2,%); writeln(==> Jadi model ini mampu menjelaskan variansi dari data sebesar ,determinasi:2:2,%, , sedangkan sisanya sebesar ,p:2:2,% dijelaskan oleh variabel lain); writeln(ingin uji model(ya/tidak) ? :); readln(coba); if coba =ya then begin if (determinasi>=75) then begin writeln(------------------------------------------); writeln(model ini termasuk model regresi yang baik); writeln(------------------------------------------); end
  • 7. else begin writeln(-------------------------------------------------); writeln(model ini termasuk model regresi yang kurang baik); writeln(-------------------------------------------------); end end else goto akhir; writeln; end; 3: begins2:=JKG/(n-2);f:=JKR/s2;writeln;writeln(============================Analisis Variansi===========================);writeln(------------------------------------------------------------------------);writeln(| Sumber | Jumlah | Derajat | Rataan | f |);writeln(| Variasi | Kuadrat | Kebebasan | Kuadrat | hitungan|);writeln(--------------------------------------------------------);writeln(| Regresi | 1 | ,JKR:0:3, | ,JKR:0:3, | ,f:0:3, |);writeln(| Galat | ,n-2:3, | ,JKG:0:3, | ,s2:0:3, | |);writeln(| Total | ,n-1:3, | ,JKT:0:3, | | |);writeln(--------------------------------------------------------); writeln; end;
  • 8. elsewriteln(sorry..incorrect action !!!!);writeln(——————————————————–);end;writeln(ingin coba lagi(ya/tidak) ? :);readln(coba);if coba =ya then goto ulangelsegoto akhir;end; akhir : clrscr; for l:=1 to 1000 do begin gotoxy(1,1); writeln(*********************selesai*********************); writeln(** Terima kasih anda telah mencoba program ini **); writeln( untuk kritik dan saran silahkan kirim e-mail ke ); writeln(__________ statistika_b.class@yahoo.co.id ________); end;for k:=1 to 50 dobeginfor l:=1 to 50 dobegingotoxy(k,7);
  • 9. writeln( *** ******** ****** );gotoxy(k,8);writeln( *** ******** **** );gotoxy(k,9);writeln( *** *** *** );gotoxy(k,10);writeln( *** *** **** );gotoxy(k,11);writeln( *** *** ****** );end;end;end.