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

Click For Summary
In least squares fitting for a natural log function, the index 'i' in the summations represents the same range from 1 to n, where n is the number of data points. The numerator for coefficient b cannot be simplified as suggested; it must follow the specific formula provided by Wolfram, which includes calculating three distinct summations. The correct approach involves multiplying the first summation by n and then subtracting the product of the second and third summations. For visualization, plotting y against x on a log scale will yield a straight line, allowing the graphics package to determine the best fit equation. Proper adherence to the summation formulas is crucial for accurate results.
JoJoQuinoa
Messages
17
Reaction score
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
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
@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:
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.
 
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.
 
Here is a little puzzle from the book 100 Geometric Games by Pierre Berloquin. The side of a small square is one meter long and the side of a larger square one and a half meters long. One vertex of the large square is at the center of the small square. The side of the large square cuts two sides of the small square into one- third parts and two-thirds parts. What is the area where the squares overlap?

Similar threads

  • · Replies 12 ·
Replies
12
Views
2K
  • · Replies 15 ·
Replies
15
Views
3K
  • · Replies 4 ·
Replies
4
Views
3K
  • · Replies 4 ·
Replies
4
Views
2K
  • · Replies 5 ·
Replies
5
Views
2K
  • · Replies 6 ·
Replies
6
Views
1K
  • · Replies 2 ·
Replies
2
Views
1K
  • · Replies 19 ·
Replies
19
Views
7K
  • · Replies 6 ·
Replies
6
Views
2K
  • · Replies 9 ·
Replies
9
Views
2K