-[[.:start]]
====== DM15L : Non-linear Curve Fit ======
** Using DM15L/HP15C built-in L.R function to fit non-linear curves **
===== Background =====
The idea is that the 3 different non-linear function forms can be expressed as linear expression ''y = m.x + c'' if we manipulate the ''x'' or ''y'' values before adding them to the statistics accumulator.
The different curves require different treatment of the data to linearize, and the resulting coefficients may require treatment too.
===== Tl;dr =====
==== Method for Exponential====
**y = b.eax**
'' Ln(y) = a.x + Ln(b) ''
|Enter Accumulation data | '' yi 'g''Ln' xi '∑+'''|
|Calculate coefficients | '''f''L.R.''e'x''|
|Estimate ŷ & r for a new ''x'' | ''x 'f''ŷ.r' 'e'x''|
==== Method for Logarithmic ====
**y=a.ln(x)+b**
''y = a.Ln(x) + b ''
|Enter Accumulation data | '' yi Enter xi 'g'Ln'∑+'''|
|Calculate coefficients |'f'L.R. |
|Estimate ŷ & r for a new ''x'' |''x'g'Ln 'f'ŷ.r'' |
==== Method for Power ====
**y=b.xa**
'' Ln(y) = a.Ln(x) + Ln(b) ''
|Enter Accumulation data |'' yi 'g'Ln xi 'g'Ln'∑+'''|
|Calculate coefficients |'f'L.R.'e'x |
|Estimate ŷ & r for a new ''x'' |''x 'g'Ln'f'ŷ.r'e'x'' |
===== Exponential =====
''y = b.eax''
This can be expressed as '' Ln(y) = Ln(b) + a.x ''
or
'' Ln(y) = a.x + ln(b) ''
compare with a linear expression ''y = m.x + c''
Using ''Ln(y)'' and ''x'' as data points and running the ''L.R.'' function will give coefficients equal to ''a'' and ''ln(b)''
You can obtain the actual value of ''b'' finding its antilog with 'e'x.
Once the L.R. has run you can find estimates of ''ŷ'' by running the 'f''ŷ.r' to get the estimate of ''Ln(y)'' and then finding its antilog with 'e'x
==== Mechanism ====
To enter the data points you convert the ''y'' data to its ''Ln'' first, then accumulate as normal
'' yi 'g''Ln' xi '∑+' ''
Once all the data has been entered you get the Linear Regression coefficients ''a'' & ''b'' 'f''L.R.' and 'e'x to correct the ''b'' LR coefficient.
==== Example Data ====
|**y**|2.8|3.6|5.8|8.0|
|**x**|0.8|1.1|1.7|2.1|
'f'clear ∑
''2.8 'g''Ln' 0.8 '∑+' ''
''3.6 'g''Ln' 1.1 '∑+' ''
''5.8 'g''Ln' 1.7 '∑+' ''
''8.0 'g''Ln' 2.1 '∑+' ''
All data is in the accumulator, now do the ''Linear Regression'' 'f''L.R.'
This gives ''a'' and ''Ln b'' coefficients
''Y: 0.805'' = ''a''
''X: 0.3897'' = ''ln b''
so we need to find ''b'' so 'e'x
''Y: 0.805'' = ''a''
''X: 1.476'' = ''b''
**Equation** estimation is therefore ''y = 1.476 e 0.805x''
I made the data table by using the equation ''y = 1.5 e 0.8x'' and then used approx. ''y'' values for the data table.... so the estimate looks pretty good
To do an estimation of ''y'' when ''x'' = ''0.9''
''0.9'' 'f''ŷ.r' 'e'x
''Y: 0.999962'' = r correlation coefficient
''X: 3.047425'' = ŷ estimation
==== Method for Exponential ====
|Enter Accumulation data | '' yi 'g''Ln' xi '∑+'''|
|Calculate coefficients | '''f''L.R.''e'x''|
|Estimate ŷ & r for a new ''x'' | ''x 'f''ŷ.r' 'e'x''|
===== Logarithmic =====
''y = a.ln(x) + b ''
Compare to a linear expression '' y = m.x + c '' shows the logarithmic curve is linear if we use ''Ln(x)'' as we accumulate data points.
The ''L.R.'' will provide the //actual// ''a'' and ''b'' coefficients.
To estimate ''ŷ'' first find the ''Ln'' of ''x'' then use the 'f'ŷ.r
==== Mechanism ====
'' yi Enter xi 'g'Ln'∑+' ''
Calculate LR Coefficients
'f'L.R.
Calculate estimated ''ŷ'' by finding the ''Ln'' of your ''x'' value first and then using 'f'ŷ.r
''x'''g'Ln'f'ŷ.r
==== Example Data ====
|**y**|1.5|1.7|1.8|2.1|
|**x**|0.8|1.7|2.6|4.9|
'f'clear ∑
'' 1.5 Enter 0.8 'g'Ln'∑+'''
'' 1.7 Enter 1.7 'g'Ln'∑+'''
'' 1.8 Enter 2.6 'g'Ln'∑+'''
'' 2.1 Enter 4.9 'g'Ln'∑+'''
Linear Regression Coefficients : 'f'L.R.
''X: 0.324'' = ''a''
''Y: 1.544'' = ''b''
**Equation** ''y = 0.324 . Ln(x) + 1.544 ''
Estimate ŷ for ''X = 3''
''3 'g'Ln 'f'ŷ.r ''
''Y: 0.985'' = r, correlation coefficient
''X: 1.900'' = ŷ, estimation
==== Method for Logarithmic ====
|Enter Accumulation data | '' yi Enter xi 'g'Ln'∑+'''|
|Calculate coefficients |'f'L.R. |
|Estimate ŷ & r for a new ''x'' |''x'g'Ln 'f'ŷ.r'' |
===== Power =====
'' y = b.xa ''
This can be rearranged as '' Ln(y) = Ln(b) + a.Ln(x) '' or '' Ln(y) = a.Ln(x) + Ln(b) ''
Compare to a linear expression '' y = m.x + c ''
Our expression will be a straight line if we accumulate ''Ln(y)'' and ''Ln(x)''
The coefficients given by the ''L.R.'' function will be ''a'' and ''Ln(b)'' - so to get the real ''b'' coefficient we find its antilog 'e'x
We get the estimate for ''ŷ'' we first find the ''Ln'' of our chosen ''x'' and then use the ŷ.r to get ''Ln(ŷ) and then 'e'x'' to get ''ŷ''
==== Mechanism ====
Accumulate using
'' yi 'g'Ln xi 'g'Ln'∑+'''
Calculate LR Coefficients
'f'L.R.'e'x
Calculate estimated ŷ
''x'g'Ln'f'ŷ.r'e'x''
==== Example Data ====
|**y**|1.3|2.2|3.3|4.4|
|**x**|0.6|1.3|2.4|3.6|
'f'clear ∑
'' 1.3 'g'Ln 0.6 'g'Ln'∑+'''
'' 2.2 'g'Ln 1.3 'g'Ln'∑+'''
'' 3.3 'g'Ln 2.4 'g'Ln'∑+'''
'' 4.4 'g'Ln 3.6 'g'Ln'∑+'''
Linear Regression Coefficients : 'f'L.R.'e'x
''Y: 0.678'' = ''a''
''X: 1.837'' = ''b''
**Equation** : ''y = 1.837x0.678 ''
Estimate ŷ for ''X = 3''
''3 'g'Ln'f'ŷ.r'e'x''
''Y: 1.000'' = r, correlation coefficient
''X: 3.869'' = ŷ, estimation
==== Method for Power ====
|Enter Accumulation data |'' yi 'g'Ln xi 'g'Ln'∑+'''|
|Calculate coefficients |'f'L.R.'e'x |
|Estimate ŷ & r for a new ''x'' |''x 'g'Ln'f'ŷ.r'e'x'' |
--- //John Pumford-Green 01/02/26 08:42 GMT//
===== Further Information =====
{{tag>calculator dm15l }}