Category : Recently Uploaded Files
Archive   : PAPCW10.ZIP
Filename : REGRESS.PRG

 
Output of file : REGRESS.PRG contained in archive : PAPCW10.ZIP
; simple linear regression y = a + bx
; b = (n*sum(xy) - sum(y)*sum(x))/(n*sum(sqr(x)) - sqr((sum(x)))
; a = mean(y)-b*mean(x)
; R1 sum(x)
; R2 sum(y)
; R3 sum(sqr(x))
; R4 sum(sqr(y))
; R5 sum(x*y)
; R6 n

LBL regress
; clear registers 1-6
1.00601 0 sto
LBL clear
0 rcl 0 swap sto
0 isg
GTO clear

LBL dataentry
PROMPT "Enter x and y: "
GTO calc ; only if a null line is entered
1 6 STO+
DUP 2 STO+
DUP SQR 4 STO+
SWAP
DUP 1 STO+
DUP SQR 3 STO+
* 5 STO+
GTO dataentry

LBL calc ;
; calculate b = (n*sum(xy) - sum(y)*sum(x))/(n*sum(sqr(x)) - sqr((sum(x)))
6 RCL 5 RCL * 2 RCL 1 RCL * - 6 RCL 3 RCL * 1 RCL SQR - /
; calculate a = mean(y)-b*mean(x)
2 RCL 6 RCL / OVER 1 RCL 6 RCL / * -
PUTS "a = " 0 WIDTH PUTSTACK PUTS "\n"
8 STO
PUTS "b = " 0 WIDTH PUTSTACK PUTS "\n"
9 STO
; calculate RSQ = (a*sum(y) + b*sum(xy) - mean(sqr(sum(y))))/ (sum(sqr(y)) - mean(sqr(sum(y)))
8 RCL 2 RCL * 9 RCL 5 RCL * + 2 RCL SQR 6 RCL / DUP 0 STO - 4 RCL 0 RCL - /
4 FIX PUTS "RSQ = " 0 WIDTH PUTSTACK PUTS "\n"
CLST
END


  3 Responses to “Category : Recently Uploaded Files
Archive   : PAPCW10.ZIP
Filename : REGRESS.PRG

  1. Very nice! Thank you for this wonderful archive. I wonder why I found it only now. Long live the BBS file archives!

  2. This is so awesome! 😀 I’d be cool if you could download an entire archive of this at once, though.

  3. But one thing that puzzles me is the “mtswslnkmcjklsdlsbdmMICROSOFT” string. There is an article about it here. It is definitely worth a read: http://www.os2museum.com/wp/mtswslnk/