(15C) Quadratic Regression
|
07-24-2023, 03:47 AM
(This post was last modified: 07-29-2023 05:49 PM by Eddie W. Shore.)
Post: #1
|
|||
|
|||
(15C) Quadratic Regression
Setup, Normal Equations, and Registers Used
This program fits bivariate date (x,y) to the quadratic polynomial: y = c + b * x + a * x^2 This program uses the matrix feature of the HP 15C. The normal equations that are solved are: n * c + Σx * b + Σx^2 * a = Σy Σx *c + Σx^2 * b + Σx^3 *a = Σxy Σx^2 * c + Σx^3 * b + Σx^4 * a = Σ(x^2 y) Matrix A = [ [ n, Σx, Σx^2 ] [ Σx, Σx^2, Σx^3 ] [ Σx^2, Σx^3, Σx^4 ] ] Matrix B = [ [ Σy ] [ Σxy ] [ Σ(x^2 y) ] ] Matrix C = (Matrix B)^-1 Matrix A [ [ c ] [ b ] [ a ] ] Registers Used: R0: x data point, row pointer R1: y data point, column pointer Default Statistics Registers: R2: n R3: Σx R4: Σx^2 R5: Σy R6: Σy^2 R7: Σxy Additional Statistics Registers: R8: Σx^3 R9: Σx^4 R.0: Σ(x^2 y) ("register point zero": press the decimal point before the 0) Instructions 1. Run label A to clear the matrices and registers. This needs to be done in order to get the most accurate results. Zero is displayed to indicate when the calculator is ready. 2. For each point, enter y data point, press [ ENTER ], x data point, and run label B. The number of data points (n) will be displayed. 3. To calculate the coefficients, run label C. The coefficients c, b, and a are displayed in order. Matrix Operations Used MATRIX 0: clear all the matrices MATRIX 1: sets the row and counter pointer to 1,1. User Mode Set: automatically advances the pointer to the right row by row. In programs, turning on and off User Mode is not a step. However, storage and recall operations in User Mode are marked with a "u" after the step number. HP 15C Program Code: Quadratic Regression Program Memory: 67 steps, 90 bytes Needs 15 additional memory registers to store the three matrices. Comments begin with a hash symbol. # Code: # Label A: Initialization (Typos pointed to me by Torsten. The key codes are now correct.) Examples Example 1: (3, 1.3) (4, 1.6) (5, 1.5) (6, 1.4) c = -0.54 b = 0.92 a = -0.1 y = -0.54 + 0.92 x - 0.1 x^2 Example 2: (0, 99.856) (3, 97.232) (5, 93.481) (7, 96.005) (10, 102.008) c ≈ 100.3437 b ≈ -2.5318 a ≈ 0.2495 y ≈ 100.3437 - 2.5318 x + 0.2495 x^2 |
|||
« Next Oldest | Next Newest »
|
Messages In This Thread |
(15C) Quadratic Regression - Eddie W. Shore - 07-24-2023 03:47 AM
RE: (15C) Quadratic Regression - Namir - 07-25-2023, 11:04 PM
RE: (15C) Quadratic Regression - Eddie W. Shore - 07-26-2023, 04:59 AM
RE: (15C) Quadratic Regression - Eddie W. Shore - 07-29-2023, 05:47 PM
RE: (15C) Quadratic Regression - Thomas Klemm - 07-29-2023, 06:18 PM
RE: (15C) Quadratic Regression - Thomas Klemm - 08-01-2023, 10:04 AM
RE: (15C) Quadratic Regression - Eddie W. Shore - 08-03-2023, 01:53 PM
|
User(s) browsing this thread: 1 Guest(s)