So, I'm making a simple program for drawing graphs, and I'm looking at making some simple best-fit curves using some basic regression analysis. I've happily got linear and quadratic regression working (thanks to this post), but it's not quite detailed enough. I'm aware that cubic curves can be extremely good at this, within reason (and hence why certain spline methods are constructed with them), so I've attempted to expand this into a cubic form, but it doesn't seem to work at all. I've looked around the internet for several hours, and found pretty much exclusively posts about how to do this with a graphic calculator, or a program such as MATLAB. Obviously, this isn't much help, since I'm trying to implement it from scratch. I tried using some of the general forms available on the Wikipedia page for regression analysis, but they gave me an incredibly steep curve that was wildly off from the data presented. I'm sure I'm doing something wrong, but could someone help me to discover what exactly that is?
2026-03-26 00:58:32.1774486712
Equations for Cubic Regression
5k Views Asked by Bumbble Comm https://math.techqa.club/user/bumbble-comm/detail At
1
There are 1 best solutions below
Related Questions in REGRESSION
- How do you calculate the horizontal asymptote for a declining exponential?
- Linear regression where the error is modified
- Statistics - regression, calculating variance
- Why does ANOVA (and related modeling) exist as a separate technique when we have regression?
- Gaussian Processes Regression with multiple input frequencies
- Convergence of linear regression coefficients
- The Linear Regression model is computed well only with uncorrelated variables
- How does the probabilistic interpretation of least squares for linear regression works?
- How to statistically estimate multiple linear coefficients?
- Ridge Regression in Hilbert Space (RKHS)
Related Questions in CUBICS
- Roots of a complex equation
- Cubic surfaces and 27 lines
- Polynomial Equation Problem with Complex Roots
- Cubic Discriminant
- Is it always possible to rearrange an equation desirably?
- Form an equation whose roots are $(a-b)^2,(b-c)^2,(c-a)^2.$
- if $x^3 + px^2+qx+r = 0$ has three real roots, show that $p^2 \ge 3q$
- The complex equation $x^3 = 9 + 46i$ has a solution of the form $a + bi$ where $a,b\in \mathbb Z$. Find the value of $a^3 + b^3$
- Roots of $z^3 + 3iz^2 + 3z + i = 0$?
- If the roots of the cubic equation $ax^3+bx^2+cx+d=0$ are equal, can one then establish a relationship between $a, b, c, d$?
Trending Questions
- Induction on the number of equations
- How to convince a math teacher of this simple and obvious fact?
- Find $E[XY|Y+Z=1 ]$
- Refuting the Anti-Cantor Cranks
- What are imaginary numbers?
- Determine the adjoint of $\tilde Q(x)$ for $\tilde Q(x)u:=(Qu)(x)$ where $Q:U→L^2(Ω,ℝ^d$ is a Hilbert-Schmidt operator and $U$ is a Hilbert space
- Why does this innovative method of subtraction from a third grader always work?
- How do we know that the number $1$ is not equal to the number $-1$?
- What are the Implications of having VΩ as a model for a theory?
- Defining a Galois Field based on primitive element versus polynomial?
- Can't find the relationship between two columns of numbers. Please Help
- Is computer science a branch of mathematics?
- Is there a bijection of $\mathbb{R}^n$ with itself such that the forward map is connected but the inverse is not?
- Identification of a quadrilateral as a trapezoid, rectangle, or square
- Generator of inertia group in function field extension
Popular # Hahtags
second-order-logic
numerical-methods
puzzle
logic
probability
number-theory
winding-number
real-analysis
integration
calculus
complex-analysis
sequences-and-series
proof-writing
set-theory
functions
homotopy-theory
elementary-number-theory
ordinary-differential-equations
circles
derivatives
game-theory
definite-integrals
elementary-set-theory
limits
multivariable-calculus
geometry
algebraic-number-theory
proof-verification
partial-derivative
algebra-precalculus
Popular Questions
- What is the integral of 1/x?
- How many squares actually ARE in this picture? Is this a trick question with no right answer?
- Is a matrix multiplied with its transpose something special?
- What is the difference between independent and mutually exclusive events?
- Visually stunning math concepts which are easy to explain
- taylor series of $\ln(1+x)$?
- How to tell if a set of vectors spans a space?
- Calculus question taking derivative to find horizontal tangent line
- How to determine if a function is one-to-one?
- Determine if vectors are linearly independent
- What does it mean to have a determinant equal to zero?
- Is this Batman equation for real?
- How to find perpendicular vector to another vector?
- How to find mean and median from histogram
- How many sides does a circle have?
I'm not a statistician, but here is a simple least squares implementation that works for me:
Suppose you have data: $(t_1,y_1), \ldots (t_n,y_n)$. So $t_i$ is in each case the independent parameter and $y_i$ the (measured) value at such a data point. Construct a matrix: \begin{equation}A=\begin{bmatrix} t_1^3 & t_1^2 & t_1 & 1 \\ \vdots & \vdots & \vdots & \vdots \\ t_n^3 & t_n^2 & t_n & 1 \end{bmatrix}\end{equation} and let \begin{equation}y=\begin{bmatrix} y_1 \\ \vdots \\ y_n \end{bmatrix}. \end{equation} Then \begin{equation} x=(A^*A)^{-1}A^*y=\begin{bmatrix}a\\b\\c\\d \end{bmatrix} \end{equation} is the least squares solution: $y_0=at_0^3+bt_0^2+ct_0+d$. The error $E$ may be computed as $\|Ax-y\|^2$.
The source for my method is a textbook on linear algebra: Linear Algebra, 4th edition by Friedberg et al. p.360-364. It is really used in the textbook just as a demonstration of some practical applications in terms of the theory of inner product spaces, but ever since I came across this, and when I needed to do basic regression, this has worked well for me in the case of polynomial fits.