TI 84 Plus CE and Casio fx-CG 50: Distribution Regression
Introduction: Distribution Regression
The program DISTREG attempts to fit a curve to the form:
y = B * e^(A * x^2)
This is based off the normal distribution curve: y = 1 / √(2 * π) * e^(-x^2 / 2)
It is required that all the y data is positive (y > 0).
Setting Up the Equation
y = B * e^(A * x^2)
Let B = e^b and A = a. Then:
y = e^b * e^(a * x^2)
y = e^(b + a*x^2)
ln y = b + a*x^2
This is in the form of linear regression where:
x' = x^2
y' = ln y
The program will perform executes the required transformations.
TI-84 Plus CE Program: DISTREG
"2020-03-31 EWS"
ClrHome
Disp "DISTRIBUTION",
"REGRESSION",
"Y=B*e^(-A*X²)"
Input "X DATA: ",L₁
Input "Y DATA: ",L₂
L₁² → L₃
ln(L₂) → L₄
LinReg(ax+b) L₃,L₄
-a → A
e^(b) → B
Disp "Y=B*e^(-A*X²)"
Disp "A: ", A, "B: ", B
Pause
"B*e^(-A*X²)" → Y₁
Disp "EQN IN Y₁"
Download the program here: https://drive.google.com/open?id=13EDowrH2NdTSuEm8M_68mu1oxRtDvZwv
Casio fx-CG 50 Program: DISTREG
"2020-03-31 EWS"
ClrText
"DISTRIBUTION"
"REGRESSION"
"X DATA"? → List 1
"Y DATA"? → List 2
List 1^2 → List 3
ln List 2 → List 4
LinearReg(ax+b) List 3, List 4
-a → A
e^b → B
ClrText
Locate 1, 4, "Y=Be^(-Ax²)"
Locate 1, 5, "A: "
Locate 4, 5, A
Locate 1, 6, "B: "
Locate 4, 6, B ◢
"Be^(-Ax²)" → Y1
"EQN IN Y1"
Download the program here: https://drive.google.com/open?id=1pXzj_Qp1D-mUgR2-Mht-IR03fNvFPGHk
Example
Data (x, y):
(0, 2)
(1.5, 0.8253)
(3, 0.0555)
(4.5, 6.186*10^-4)
(6, 1.14*10^-6)
Results:
A = 0.3995755227
B = 2.016036126
Equation: y = 2.016036126 * e^(-0.3995755227x^2)
r^2 = 0.999991936 (can be recalled from the Vars menu)
See the above picture for a graph of the example.
Enjoy everyone, please stay healthy, safe, and sane!
Eddie
All original content copyright, © 2011-2020. Edward Shore. Unauthorized use and/or unauthorized distribution for commercial purposes without express and written permission from the author is strictly prohibited. This blog entry may be distributed for noncommercial purposes, provided that full credit is given to the author.
Introduction: Distribution Regression
The program DISTREG attempts to fit a curve to the form:
y = B * e^(A * x^2)
This is based off the normal distribution curve: y = 1 / √(2 * π) * e^(-x^2 / 2)
It is required that all the y data is positive (y > 0).
Setting Up the Equation
y = B * e^(A * x^2)
Let B = e^b and A = a. Then:
y = e^b * e^(a * x^2)
y = e^(b + a*x^2)
ln y = b + a*x^2
This is in the form of linear regression where:
x' = x^2
y' = ln y
The program will perform executes the required transformations.
TI-84 Plus CE Program: DISTREG
"2020-03-31 EWS"
ClrHome
Disp "DISTRIBUTION",
"REGRESSION",
"Y=B*e^(-A*X²)"
Input "X DATA: ",L₁
Input "Y DATA: ",L₂
L₁² → L₃
ln(L₂) → L₄
LinReg(ax+b) L₃,L₄
-a → A
e^(b) → B
Disp "Y=B*e^(-A*X²)"
Disp "A: ", A, "B: ", B
Pause
"B*e^(-A*X²)" → Y₁
Disp "EQN IN Y₁"
Download the program here: https://drive.google.com/open?id=13EDowrH2NdTSuEm8M_68mu1oxRtDvZwv
Casio fx-CG 50 Program: DISTREG
"2020-03-31 EWS"
ClrText
"DISTRIBUTION"
"REGRESSION"
"X DATA"? → List 1
"Y DATA"? → List 2
List 1^2 → List 3
ln List 2 → List 4
LinearReg(ax+b) List 3, List 4
-a → A
e^b → B
ClrText
Locate 1, 4, "Y=Be^(-Ax²)"
Locate 1, 5, "A: "
Locate 4, 5, A
Locate 1, 6, "B: "
Locate 4, 6, B ◢
"Be^(-Ax²)" → Y1
"EQN IN Y1"
Download the program here: https://drive.google.com/open?id=1pXzj_Qp1D-mUgR2-Mht-IR03fNvFPGHk
Example
Data (x, y):
(0, 2)
(1.5, 0.8253)
(3, 0.0555)
(4.5, 6.186*10^-4)
(6, 1.14*10^-6)
Results:
A = 0.3995755227
B = 2.016036126
Equation: y = 2.016036126 * e^(-0.3995755227x^2)
r^2 = 0.999991936 (can be recalled from the Vars menu)
See the above picture for a graph of the example.
Enjoy everyone, please stay healthy, safe, and sane!
Eddie
All original content copyright, © 2011-2020. Edward Shore. Unauthorized use and/or unauthorized distribution for commercial purposes without express and written permission from the author is strictly prohibited. This blog entry may be distributed for noncommercial purposes, provided that full credit is given to the author.