Model Fitting to Data - Scaling x Values & Shifting Parameters

In summary, the individual is facing difficulties in fitting their data using NonlinearModelFit due to memory failures when using large x values. They have found a solution by scaling down the x values and then adjusting the constants accordingly, but are now facing a problem with shifting the function to fit the original x values. They are considering using a logarithm for the independent variable instead of the exponential function and fitting a modified function to potentially solve this issue.
  • #1
acusick
8
0
I have some (x,y) data with x in the range of 1e10 and 1e13, y is between 0 and 1. I am fitting this data using several theoretical models to gain an understanding of underlying mechanisms (by which model fits best).

Using NonlinearModelFit in Mathematica, I get memory failures and cannot complete the fitting. As a solution, I scaled down the x values by 10^10 so the range is now from about 1 to 1000, and that is now OK with Mathematica. So I just get my functions and scale the constants to get back up to where the x values should be and it is fitting my data well. Now I have a problem shifting the function to where my x values are because it is more complicated mathematically. The function is:

f = 1 - Exp[ -R*G^(m-1)*(x)^m ]

Where I'm fitting R, G, and m and my variable is x. So this question is in 2 parts:

1: Is there a way I can get Mathematica to take my very large x values and have it fit this and similar function models? Is there a trick to this? Or are the values just too large to do the fitting to data?

2. If not possible, if I scale my x values down 10^10 as a solution, how may I shift the R, G, and M values accordingly in this case to get it back up to the x values that will fit my data?

So far I have not been able to do this mathematically and feel maybe it is not possible with an equation in this form... But not sure! Here's what I got so far: The solution of the fitting is in this form:

Exp[-a*x^b]

So scaling to accept my x values I get:

Exp[-a*{x*10^-10}^b]

Exp[-a*x^b*10^(-10b)]

But this does not seem to be working to scale properly... Any ideas? Thanks.
 
Mathematics news on Phys.org
  • #2
Instead of using the exponential function for the independent variable, why don't you use a logarithm? Log(x) will be between 10 and 13, which seems eminently practical, given the range of y values.
 
  • #3
Instead of fitting f = 1 - Exp[ -R*G^(m-1)*(x)^m ], try to fit y= -R*G^(m-1)*(x)^m where y=ln(1-f)
 

1. How do I scale x values in model fitting?

In order to scale x values in model fitting, you can use a technique called normalization. This involves subtracting the mean of the x values from each individual value, and then dividing by the standard deviation of the x values. This will result in scaled x values with a mean of 0 and a standard deviation of 1.

2. Can scaling x values affect the accuracy of the model?

Yes, scaling x values can affect the accuracy of the model. If the range of your x values is very large, it can cause numerical instability and lead to inaccuracies in the model. Scaling the x values can help to avoid this issue and improve the accuracy of the model.

3. Is it necessary to scale x values before fitting a model?

It is not always necessary to scale x values before fitting a model. If your x values have a small range and are already centered around 0, then scaling may not be necessary. However, if your x values have a large range or are not centered around 0, scaling can improve the performance and accuracy of the model.

4. How can I shift parameters in model fitting?

In order to shift parameters in model fitting, you can use a technique called translation. This involves adding a constant value to each parameter in the model. This can be useful if you need to adjust the model to better fit the data or to account for any external factors that may be influencing the data.

5. What is the purpose of scaling x values and shifting parameters in model fitting?

The purpose of scaling x values and shifting parameters in model fitting is to improve the accuracy and performance of the model. Scaling x values helps to avoid numerical instability and shifting parameters can help to better fit the data or account for external factors. These techniques can also help to make the model more interpretable and easier to compare with other models.

Similar threads

  • General Math
Replies
2
Views
728
  • General Math
Replies
1
Views
735
  • General Math
Replies
19
Views
1K
Replies
4
Views
1K
  • General Math
Replies
5
Views
1K
  • General Math
Replies
7
Views
972
  • STEM Educators and Teaching
Replies
5
Views
671
  • General Math
Replies
3
Views
965
Replies
4
Views
3K
  • Programming and Computer Science
Replies
9
Views
2K
Back
Top