Fit a non-linear function to this time series

In summary, the conversation discusses finding the best fit for a non-linear function to a time series using Excel. The function in question is n(t) = n_max - (n_max - n_start)*exp(-t/tau), and the goal is to find values for n_start, n_max, and tau that will provide the best fit to the data. The conversation also mentions using fminsearch in Matlab and manually calculating the fit quality to determine the parameters, as Excel's trendline and solver functions are not effective in this scenario.
  • #1
MacIntoShiba
7
1
TL;DR Summary
Fit non-linear function to a time series
I have an experimantally obtained time series: n_test(t) with about 5500 data points. Now I assume that this n_test(t) should follow the following equation:
n(t) = n_max - (n_max - n_start)*exp(-t/tau).

How can I find the values for n_start, n_max and tau so as to find the best fit to the n_test(t) time series? I am aware that with Matlab this could be accomplished with fminsearch, however I would like to implement something in Excel.
 
Physics news on Phys.org
  • #2
Excel should find exponential fit functions, too. Not sure about the offset, however.
You can also define "best fit" manually by calculating the fit quality as function of these parameters (in any way you like) and then use the solver to minimize that cell by changing the three parameters.
 
  • #3
Excel is not really working along, doesn't have a usefull trendline I can plot through it. The solver doesn't really work either. Ill now finding the paramters by hand. For now that will suffice, this is not a daily recurring task.
 
  • #4
MacIntoShiba said:
Summary:: Fit non-linear function to a time series

I have an experimantally obtained time series: n_test(t) with about 5500 data points. Now I assume that this n_test(t) should follow the following equation:
n(t) = n_max - (n_max - n_start)*exp(-t/tau).

How can I find the values for n_start, n_max and tau so as to find the best fit to the n_test(t) time series? I am aware that with Matlab this could be accomplished with fminsearch, however I would like to implement something in Excel.
I don't get the formula - is nmax supposed to be the max between start and t? if so, when is the max ever anything but the start as you begin by subtracting n start from itself? Then if nstart >0 each iteration of the exponential term remains zero - you never get a value to multiply by the exponential.
 
Last edited:
  • #5
BWV said:
I don't get the formula - is nmax supposed to be the max between start and t? if so, when is the max ever anything but the start as you begin by subtracting n start from itself? Then if nstart >0 each iteration of the exponential term remains zero - you never get a value to multiply by the exponential.
A better name for n_max is n_end. Thus in the beginning the concentration is n_start, after an infinite amount of time it's n_max (or n_end, better name).
 
  • #6
MacIntoShiba said:
A better name for n_max is n_end. Thus in the beginning the concentration is n_start, after an infinite amount of time it's n_max (or n_end, better name).
Why the minus term? Can’t you model it as simple exponential decay, then you can linearize by taking the log
 
  • #7
MacIntoShiba said:
Excel is not really working along, doesn't have a usefull trendline I can plot through it. The solver doesn't really work either. Ill now finding the paramters by hand. For now that will suffice, this is not a daily recurring task.
That problem description doesn't help understanding what went wrong.
 

FAQ: Fit a non-linear function to this time series

What is a non-linear function?

A non-linear function is a mathematical function that does not follow a straight line. It can have a curved or irregular shape, and the output does not change at a constant rate with the input.

Why is it important to fit a non-linear function to a time series?

Fitting a non-linear function to a time series can help to better understand and predict the behavior of the data over time. It can also reveal patterns and relationships that may not be apparent with a linear function.

What are some common non-linear functions used in time series analysis?

Some common non-linear functions used in time series analysis include exponential, logarithmic, polynomial, and sigmoid functions. These functions can be adjusted to fit different types of data and patterns.

How is a non-linear function fitted to a time series?

A non-linear function is fitted to a time series by using mathematical techniques such as least squares regression or maximum likelihood estimation. These methods help to find the best parameters for the function that minimize the difference between the predicted values and the actual data points.

What are the benefits of using a non-linear function in time series analysis?

Using a non-linear function in time series analysis can provide more accurate and flexible models for predicting future trends and patterns. It can also help to identify outliers and anomalies in the data that may be missed with a linear function.

Back
Top