Saturday, September 19, 2020

Casio fx-9750GIII: Beta Curve Fit

 Casio fx-9750GIII:  Beta Curve Fit


The program BETAFIT will fit data to the curve

Y = A * x^B * (1-x)^C

Restrictions:  0 < x < 1 and y > 0


Derivation


General Equation:

Y = A * x^B * (1-x)^C


The equation can be transformed into a multilinear regression form by:

Y = A * x^B * (1-x)^C

ln Y = ln (A * x^B * (1-x)^C)

ln Y = ln A + ln (x^B) + ln (1-x)^C

ln Y = ln A + B * ln x + C * ln (1 - x)


y' = a' + b * x1 + c * x2

where:

y = ln Y

a = ln A,  A = e^a

x1 = ln x

x2 = ln(1 - x)


To find a Beta regression fit:

1.  Enter the x data.  Take two transformations:  ln x and ln(1 - x).   Recall 0 < x < 1.

2.  Enter the y data.  The the transformation ln y.  Recall y > 0.

3.  Execute multilinear regression: y' = a + b * x1 + c * x2.   See the notes above.  

4.  Solve for the coefficients:


A = e^A

B = b

C = c


Matrix Setup:


X a = y


X Columns:  [ 1, ln x, ln(1 - x) ]

y Columns: [ ln y ]


Casio fx-9750GIII Program:  BETAFIT

Size: 300 Bytes


"2020-08-30 EWS"

"X DATA"? → List 1

"Y DATA"? → List 2

List 1 → List 3

Fill(1, List 3)

ln List 1 → List 4

ln (1 - List 1) → List 5

ln List 2 → List 6

List→Mat(List 3, List 4, List 5) → Mat B

List→Mat(List 6)→Mat C

(Trn Mat B × Mat B)^-1 × Trn Mat B × Mat C → Mat A

e^Mat A[1,1] → A

Mat A[2, 1] → B

Mat A[3, 1] → C

ClrText 

Locate 1,3,"Y = A X^B (1-X)^C"

Locate 1,4,"A="

Locate 4,4,A

Locate 1,5,"B="

Locate 4,5,B

Locate 1,6,"C="

Locate 4,6,C


Examples


Graphs are not included in the program. 


Example 1:

Data:

(0.1, 0.74)

(0.3, 0.7681)

(0.5, 0.55)

(0.7, 0.2779)

(0.9, 0.053)


A = 2.199360522

B = 0.3998640121

C = 1.599725605



Example 2:

Data:

(0.1, 0.015)

(0.3, 0.228)

(0.5, 1.24)

(0.7, 6.75)

(0.9, 100.44)


A = 1.261477517

B = 2.015236182

C = -1.992644053


Source:

Kolb, William M.  Curve Fitting For Programmable Calculators IMTEC.  Bowie, MD 20716.  1982.  ISBN-10:  0-943494-00-01


Stay safe and sane everyone.  Happy Birthday Press Your Luck (no whammies) Blessings,

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.