Post Reply 
HP 48G Linear Regression Best Fit Line
12-26-2021, 10:42 AM (This post was last modified: 12-26-2021 11:03 AM by Rodger Rosenbaum.)
Post: #71
RE: HP 48G Linear Regression Best Fit Line
Type in a couple of programs.

Daug, which stands for de-augment. It takes the n x 2 matrix of X and Y data (which will be stored in ΣDAT) as input and splits it into the X matrix and Y matrix, with the Y matrix in stack level 2 and the X matrix in level 1.

Daug:
<< DUP SIZE 2 GET COL- DUP SIZE { 1 } + RDM SWAP >>

Setup, which expects the n x 2 matrix of X and Y data on stack level 1. It stores that matrix in ΣDAT, executes LR, separates it into X and Y matrices, adds a column of 1s to the X matrix and stores them into the X and Y variables. Everything is ready for OFIT to do its job.

Setup:
<< DUP 'ΣDAT' STO LR DROP DROP Daug →COL SWAP DUP
ROT CON 2 COL→ 'X' STO 'Y' STO >>

So, type in the X and Y data as a single n x 2 matrix, but don't store it in ΣDAT--Setup will take care of that. Execute Setup and you're done, ready to do OFIT.
Find all posts by this user
Quote this message in a reply
Post Reply 


Messages In This Thread
RE: HP 48G Linear Regression Best Fit Line - Rodger Rosenbaum - 12-26-2021 10:42 AM



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