Post Reply 
Statistical - Cubic Regression (Cubic Spline Fit) ?
06-03-2022, 09:42 AM
Post: #21
RE: Statistical - Cubic Regression (Cubic Spline Fit) ?
(06-01-2022 03:20 PM)Thomas Klemm Wrote:  Use a cubic spline if you want a function that goes smoothly through the given data points.
Disadvantage: The function is defined piecewise.

This is consistent with the Prime's spline command. However, some cubic spline implementations don't limit themselves to y=f(x), but instead treat x and y parametrically, finding x(t) and y(t) where t is the parametric variable. The GeoGebra help page says:

Quote:The result of the spline command is a curve. Spline algorithm is used for x and y coordinates separately: first we determine values of t that correspond to the points (based on Euclidian distances between the points), then we find cubic splines as functions t->x and t->y.

In GeoGebra, if the first and last points are the same, forming a loop, the algorithm also smooths out where they join.
Find all posts by this user
Quote this message in a reply
06-03-2022, 03:37 PM
Post: #22
RE: Statistical - Cubic Regression (Cubic Spline Fit) ?
One of my favourite resources for curve fitting per se is the one that's included with Graphpad Prism. Luckily, their help pages are available to non-customers too.

https://www.graphpad.com/guides/prism/la.../index.htm

Their general statistics guide is great for both beginners and those looking for a refresher on the principles of statistical analysis.

https://www.graphpad.com/guides/prism/la.../index.htm
Find all posts by this user
Quote this message in a reply
06-06-2022, 01:03 PM
Post: #23
RE: Statistical - Cubic Regression (Cubic Spline Fit) ?
(06-03-2022 09:42 AM)Wes Loewer Wrote:  This is consistent with the Prime's spline command. However, some cubic spline implementations don't limit themselves to y=f(x), but instead treat x and y parametrically, finding x(t) and y(t) where t is the parametric variable.

This is not a "limit". We can get same kind of results with CAS spline command.

XCAS> T,X,Y := range(5), [0,2,3,4,5], [1,0,3,5,4]
XCAS> tx := spline(T,X) :;
XCAS> ty := spline(T,Y) :;

To interpolate for x=1, we solve for t first.

XCAS> t1 := fsolve(tx[0]=1,x=.5)      → 0.451840260174
XCAS> [tx[0], ty[0]] (x=t1)               → [1.0, 0.156460522575]

We could also use complex numbers, combined 2 splines into 1

XCAS> txy := spline(T, X+i*Y) :;
XCSS> txy[0](x=t1)                          → 1.0 + 0.156460522575*i

Note: curve shape is *very* different than cubic-spline of X,Y

XCAS> spline(X,Y)[0](x=1.)               → -0.433139534884
Find all posts by this user
Quote this message in a reply
06-08-2022, 07:24 AM
Post: #24
RE: Statistical - Cubic Regression (Cubic Spline Fit) ?
(06-06-2022 01:03 PM)Albert Chan Wrote:  XCAS> T,X,Y := range(5), [0,2,3,4,5], [1,0,3,5,4]
XCAS> tx := spline(T,X) :;
XCAS> ty := spline(T,Y) :;

I think this is how I would have handled it as well. GeoGebra adds a twist by having T be based on the distance between the points instead of the point number. The result is a more intuitive curve when two points are close together.


(06-06-2022 01:03 PM)Albert Chan Wrote:  We could also use complex numbers, combined 2 splines into 1

Very interesting. I'm always fascinated by the use of complex numbers (or even quaternions) in applications that are originally intended for real numbers.
Find all posts by this user
Quote this message in a reply
06-08-2022, 11:05 AM
Post: #25
RE: Statistical - Cubic Regression (Cubic Spline Fit) ?
I took a look through my 48 book collection and found a group of programs that can be used in 48/49/50 series calculators (the book in question is Calculus on the HP-48G/GX - Grapevine Publications). The focus in the book is on calculating integrals, but the techniques/programs can be used for more general statistical curve fitting workflows too.

It's available in digital form via:
https://literature.hpcalc.org/items/1500

But here's so examples from the book.
[Image: bjkDHz]
[Image: 4JmzIV]
Find all posts by this user
Quote this message in a reply
06-11-2022, 09:11 PM (This post was last modified: 06-11-2022 09:11 PM by rprosperi.)
Post: #26
RE: Statistical - Cubic Regression (Cubic Spline Fit) ?
I'm not sure if there is interest in the 71B User Library Cubic Spline interpolation program I mentioned, however it's taken weeks to find it, and since I have it now, here's a scan of the user library program description, including an overview, a little theory review, sample problem, sample program run output and BASIC program listing.

https://1drv.ms/b/s!AiI5Ei2M2Ja2mRDm0BOo...n?e=LdBPIH

Note: The HP-71B MATH PAC ROM (or JFG's enhanced 2B version) must be installed for this to work.

--Bob Prosperi
Find all posts by this user
Quote this message in a reply
Post Reply 




User(s) browsing this thread: 9 Guest(s)