# Uncertanty in a non-linear regression with least squares method

• VictorH
In summary, the conversation revolved around fitting a set of 21000 data points to a sine function using the equation Y = A*sin(ωt). The speaker used NumPy to obtain the parameters A and ω with the least squares method, but lacked the uncertainty values for these parameters. They asked for recommendations on literature or websites that cover this topic, specifying a preference for content suitable for a freshman undergrad level of computer expertise and experimentation skill. In response, they were advised to read Numerical Recipes and check for practical problems such as aliasing. The speaker then provided more details about the data they measured and their use of NumPy, but still expressed a need for error propagation in non-linear regression.
VictorH

## Homework Statement

Ok, so I'm trying to fit a set of data (21000 points to be exact) to a sine function.

Y = A*sin(ωt)

## The Attempt at a Solution

I used NumPy to get the parameters A and ω with the least squares method. So far, so good. However, i appear to have reached an impass, this values don't have an uncertainty that accompanies them.

My question is: how do i propagate the error in the amplitude and the frecuency? In a quick web search I have not found any helpful inside in anything different of uncertainty of slopes in linear regressions. Can you recommend literature or websites that cover this topic? Bear in mind a freshman undergrad level of computer expertise and experimentation skill.

Don't give a list of 21000 points, but:
Tell us a bit more about what was measured, and how.
Approximate frequency, sampling frequency,
Then write out what you did with numpy.
Did you get a ##\chi^2## out?

Alright. So, i measured the movement of a vibrating table with a LVDT sensor, the approximate frecuency is around 30 Hz and a sampling frecuency of 1000 samples per second. Hopefully i can show it behaves like a harmonic oscillator. I looked at tha data, the graph is pretty nice and definitive to a sine function, so $\chi^2$ is a given, plus Python says so. I did least squares with Numpy (don't have the exact code at hand) and got some values for amplitude and frecuency.
Now, this numbers come very close of what i can see and measured in the lab. But, as in any experiment, this numbers mean nothing without uncertanties. My question is: how do i do error propagation in a non-linear regression using least squares?

Uncertainty in non-linear regression can be more complex compared to linear regression, as it involves finding the best fit curve for the data. In this case, you can use the least squares method to find the parameters A and ω, but it is important to also consider the uncertainty in these values. There are a few approaches you can take to propagate the error in the amplitude and frequency. One option is to use the bootstrap method, which involves repeatedly sampling from your data and calculating the parameters to get a distribution of values. Another approach is to use a Monte Carlo simulation, where you randomly generate values within a certain range for the parameters and calculate the best fit curve for each set of parameters. This will give you a distribution of possible curves and you can use this to estimate the uncertainty in the amplitude and frequency.

As for literature or websites that cover this topic, I recommend checking out statistical textbooks or online resources that discuss non-linear regression and error propagation. Some examples include "Data Analysis: A Bayesian Tutorial" by Sivia and Skilling, "An Introduction to Error Analysis" by Taylor, or the website "Stat Trek" which has a section on non-linear regression and error propagation. It may also be helpful to consult with a professor or teaching assistant for guidance on this topic. Good luck with your analysis!

## 1. What is uncertainty in a non-linear regression with least squares method?

Uncertainty in a non-linear regression with least squares method refers to the range of possible values for the regression coefficients that could accurately represent the relationship between the variables in the model. It takes into account the errors or variability in the data and provides a measure of how confident we can be in the estimated coefficients.

## 2. How is uncertainty calculated in a non-linear regression with least squares method?

Uncertainty in a non-linear regression with least squares method is typically calculated using statistical techniques such as confidence intervals or standard errors. These methods take into account the variability in the data and the number of data points to determine the range of possible values for the regression coefficients.

## 3. Why is uncertainty important in a non-linear regression with least squares method?

Uncertainty is important in a non-linear regression with least squares method because it provides a measure of the reliability of the estimated coefficients. It allows us to assess the strength of the relationship between the variables and make informed decisions about the significance of the results.

## 4. How does non-linearity affect uncertainty in a least squares regression?

Non-linearity can increase uncertainty in a least squares regression as it makes it more difficult to accurately estimate the relationship between the variables. This is because non-linear relationships are more complex and require more data points to accurately determine the regression coefficients. As a result, the uncertainty in the estimated coefficients may be higher.

## 5. Can uncertainty in a non-linear regression with least squares method be reduced?

Yes, uncertainty in a non-linear regression with least squares method can be reduced by increasing the number of data points or using more sophisticated statistical techniques. Additionally, selecting an appropriate functional form for the model can also help reduce uncertainty. However, it is important to note that some degree of uncertainty is expected in any regression analysis and it is important to assess the significance of the results in the context of the uncertainty.

Replies
6
Views
2K
Replies
4
Views
1K
Replies
1
Views
1K
Replies
8
Views
2K
Replies
7
Views
1K
Replies
7
Views
1K
Replies
4
Views
6K
Replies
1
Views
3K
Replies
5
Views
2K
Replies
5
Views
1K