Can I Use a Natural Log Function for Least Square Fitting?

In summary, the conversation is about using Wolfram to do a least square fitting with multiple summations in the equations. The index, i, is the same in both equations and runs from 1 to n. For coefficient b, the numerator cannot be simplified and all three summations must be calculated. Plotting y vs x on a log scale should result in a straight line and the graphics package will determine the best least squares fit equation.
  • #1
JoJoQuinoa
17
0
Hello,

I'm trying to follow Wolfram to do a least square fitting. There are multiple summations in the two equations to find the coefficients. Are the i's the same in this case?

Thanks!
 
Mathematics news on Phys.org
  • #2
JoJoQuinoa said:
Hello,

I'm trying to follow Wolfram to do a least square fitting. There are multiple summations in the two equations to find the coefficients. Are the i's the same in this case?

Thanks!
In both equations, i is the index of all of the summations. These summations run for i = 1, 2, 3, and so on, up to n. Here n is the number of points you're fitting to the log curve.
 
  • Like
Likes JoJoQuinoa
  • #3
@Mark44

Sorry I just looked at it and got confused again. So for coefficient b, can I write the numerator as
##\Sigma_{i=1}^n (n*y_i*ln(x_i)-y_i*ln(x_i))##.
 
Last edited:
  • #4
JoJoQuinoa said:
@Mark44

Sorry I just looked at it and got confused again. So for coefficient b, can I write the numerator as
##\Sigma_{i=1}^n (n*y_i*ln(x_i)-y_i*ln(x_i))##.
No. The formula shown in the Wolfram page for the numerator of b is
$$n\sum_{i =1}(y_i\ln(x_i)) - (\sum_{i = 1}y_i)(\sum_{i = 1}\ln(x_i)$$
You can't simplify things as you have done. You need to calculate all three summations. Once you have these numbers, multiply the first summation by n, multiply the second and third summations together, and then subtract as shown.
 
  • #5
Just plot y vs x, with x plotted on a log scale (by your graphics package). The result should be a straight line, and the graphics package should automatically determine the best least squares fit equation to the data.
 

FAQ: Can I Use a Natural Log Function for Least Square Fitting?

What is the natural log function?

The natural log function, also known as the logarithm with base e, is a mathematical function that is the inverse of the exponential function. It is denoted as ln(x) and is commonly used to solve exponential equations.

How is the natural log function used for fitting data?

The natural log function can be used to fit data by transforming the data into a linear form. This is done by taking the natural log of both the independent and dependent variables. The resulting linear equation can then be used to find the best-fit line for the data.

What are the advantages of using the natural log function for data fitting?

One advantage of using the natural log function for data fitting is that it can handle a wide range of data, including both small and large values. It also helps to reduce the influence of outliers and makes the data easier to interpret.

Can the natural log function be used for all types of data?

No, the natural log function is most commonly used for data that follows an exponential growth or decay pattern. It may not be suitable for other types of data, such as linear or quadratic relationships.

How can I determine the goodness of fit for a natural log function?

The goodness of fit for a natural log function can be determined by calculating the coefficient of determination, also known as R-squared. This value represents the proportion of the variation in the data that is explained by the natural log function. A higher R-squared value indicates a better fit for the data.

Similar threads

Replies
12
Views
1K
Replies
15
Views
3K
Replies
5
Views
2K
Replies
6
Views
1K
Replies
2
Views
995
Replies
6
Views
2K
Replies
19
Views
6K
Replies
9
Views
2K
Back
Top