Casio
fx-CG50, TI-84 Plus CE, HP Prime: Square
Root-Linear Regression
The
program SQLINREG attempts to fit data to the curve:
Y
= √(A + B*X)
We
can use the linear transformation:
y^2
= a + b*x
This
allows us to enter each data point as (x, y^2) and execute the linear
regression function. The HP Prime
version uses the LSQ function. Both the
Casio fx-CG50 and TI-84 Plus CE versions give the correlation, r.
Casio
fx-CG50 Program: SQLINREG
“EWS
2017-07-16”
“SQUARE
ROOT FIT”
“Y=√(A+BX)”
“X:
“? → List 1
“Y:
“? → List 2
List
2^2 → L2
LinearReg(a+bx)
List 1, List 2
“A=”
◢
a ◢
“B=”
◢
b ◢
“CORR=”
◢
R
How
to access:
* LinearReg(a+bx): EXIT the main program menu, F4 (MENU), F1
(STAT), F6 (CALC), F6 ( > ), F1 ( X ), F2 (a+bx)
* a, b, r:
VARS, F3 (STAT), F3 (GRAPH), a/b/r
TI-84
Plus CE Program: SQLINREG
"EWS
2017-07-16"
Disp
"SQUARE ROOT FIT"
Disp
"√(A+BX)"
Input
"X: ",L1
Input
"Y: ",L2
L2^2→L2
LinReg(a+bx)
L1,L2
Disp
"A=",a
Disp
"B=",b
Disp
"r=",r
HP Prime
Program: SQLINREG
EXPORT
SQLINREG(L1,L2)
BEGIN
// EWS 2017-07-16
// Square Root-Linear Regression
// Y=√(A+BX)
LOCAL S:=SIZE(L1);
LOCAL L0:=MAKELIST(1,X,1,S);
L2:=L2^2;
LOCAL M1,M2,M3;
M1:=list2mat(CONCAT(L0,L1),S);
M1:=TRN(M1);
M2:=list2mat(L2,S);
M2:=TRN(M2);
M3:=CAS.LSQ(M1,M2);
RETURN
{"Y=√(A+BX)",M3};
END;
Example
x
|
y
|
y^2
|
0.9
|
2.40
|
5.76
|
1.3
|
2.68
|
7.1824
|
1.8
|
3.03
|
9.1809
|
2.4
|
3.39
|
11.4921
|
3.6
|
4.05
|
16.4025
|
5.2
|
4.77
|
22.7529
|
6.1
|
5.14
|
26.4196
|
Results:
A
= 2.03165434
B
= 3.989146461
CORR
= 0.999950438
Equation: y = √(2.03165434 + 3.98914641*x)
Predicted
Values:
y(2)
= 3.163850053
y(4)
= 4.241254529
Eddie
This
blog is property of Edward Shore, 2017