How to Convert a Nonlinear Function into Linear for Quadratic to Linear Fit?

  • Context: Graduate 
  • Thread starter Thread starter Igor_S
  • Start date Start date
  • Tags Tags
    Fit Linear Quadratic
Click For Summary
SUMMARY

The discussion focuses on converting the nonlinear function y = √(ax² + bx + c) into a linear form suitable for least squares fitting. The transformation involves squaring both sides to yield y² = ax² + bx + c, allowing for the application of ordinary least squares (OLS) methods. The user seeks to determine the coefficients a, b, and c using a FORTRAN program, noting that standard regression software like SAS can also be employed. The key takeaway is that by structuring the problem correctly, one can utilize the formula β̂ = (Z'Z)⁻¹Z'(y²) where β = (a, b, c) and Z = (x², x, 1) to solve for the coefficients.

PREREQUISITES
  • Understanding of nonlinear regression and least squares methods
  • Familiarity with the transformation of functions (e.g., squaring both sides)
  • Knowledge of ordinary least squares (OLS) regression techniques
  • Proficiency in programming with FORTRAN for statistical computations
NEXT STEPS
  • Implement the OLS routine in FORTRAN to calculate coefficients a, b, and c
  • Explore the use of SAS for regression analysis on transformed variables
  • Study the application of logarithmic transformations in regression
  • Research advanced nonlinear fitting techniques for complex models
USEFUL FOR

Statisticians, data analysts, and programmers working with regression analysis, particularly those interested in nonlinear function fitting and implementation in programming languages like FORTRAN.

Igor_S
Messages
98
Reaction score
0
I have a function [tex]y = \sqrt{ax^2 + bx +c}[/tex], and 2 sets of points [tex]{x_i},{y_i}[/tex] that need to be fit on this curve. First in this problem, I need to somehow convert this nonlinear function into linear and then apply least square methods to determine a,b,c.
What I came up is ofcouse squaring both sides, removing root. Now I have: [tex]y^2 = ax^2 + bx + c[/tex]. I tried factoring this into [tex]a(x-x_1)(x-x_2)[/tex] but don't think this is better form. I'm not sure how is this even possible, there are 3 numbers to be determined as I can find only 2 equations from least square method (slope & intercept). How to determine a,b,c ? I know how to do it in eg. Mathematica, but I'm writing this as a FORTRAN program, so I need to write exact procedure. I don't know how to do nonlinear fits "by hand".

Thanks.P.S. Simpler example of what is supposed to be done (at least I think) is function y = ax^n. Here you just take log of both sides to get: log(y) = nlog(x) + log(a), then calculate log(y_i) and log(x_i) and slope of the line with log(x) and log(y) as variables is n, with intercept log(a).
 
Last edited:
Physics news on Phys.org
Somewhat similar to the Log example, you have 3 var's in the quadratic problem: y^2, x^2 and x. You can calculate a, b and c by inputting these 3 var's into a standard regression software (E.g. SAS); or you can write your own OLS routine to calculate them by using the formula [tex]\hat\beta = (Z'Z)^{-1}Z'(y^2)[/tex] where [itex]\beta = (a,b,c)\text{ and }Z=(x^2,x,1)[/itex].
 
Last edited:

Similar threads

  • · Replies 22 ·
Replies
22
Views
4K
  • · Replies 4 ·
Replies
4
Views
2K
  • · Replies 28 ·
Replies
28
Views
3K
  • · Replies 8 ·
Replies
8
Views
2K
  • · Replies 6 ·
Replies
6
Views
3K
  • · Replies 11 ·
Replies
11
Views
3K
  • · Replies 6 ·
Replies
6
Views
4K
  • · Replies 9 ·
Replies
9
Views
2K
Replies
3
Views
3K
  • · Replies 7 ·
Replies
7
Views
3K