Questions tagged [fitting]

Questions on the use of Mathematica to construct models for approximating empirical data.

Filter by
Sorted by
Tagged with
0
votes
1answer
42 views

NonlinearModelFit failing because varible range

I'm trying to fit a specific equation to a plot of points but its failing because the equation has a square root in it and I need to keep the values of x between a certain range. I know how to do this ...
1
vote
1answer
80 views

Parameter Estimation for Gaussian Function in Gaussian noise

Mathematical model can be given as follows. $$x[n]=a\exp[-(n - k)^2/s^2]+w[n]$$ Here w[n] is a zero mean Gaussian noise process with variance $3\cdot10^{-5}$. The problem is to estimate the ...
0
votes
1answer
42 views

How is CurvatureConfidenceRegion in FittedModel from NonlinearModelFit calculated?

I have a FittedModel from NonlinearModelFit for which the determination of the ...
0
votes
1answer
53 views

goodness of fit test for grouped data

I have the following grouped data: Can someone please tell me how to run a goodness of fit test to test if this data is from a normal distribution? I would like to do this without estimating the ...
1
vote
2answers
72 views

fitting a monotonic function?

Let's say I have a few points and derivatives given for a function and I'd like to find the best fit through the data, which is monotonic. For example, if I take a polynomial ansatz, I get ...
1
vote
1answer
51 views

What is the most efficient way to use the fitted models?

I'm generating a simple linear model ($y=mx+b$) by fitting to the background of some data, and then trying to plug in the x-values of the data I'm actually interested in. I'm a bit surprised that <...
0
votes
0answers
98 views

Cannot fit data

First up, I'm quite new to Mathematica so any hints on better code would be greatly appreciated. I have already asked the question connected to this code, but later I've found a mistake. Now I need to ...
4
votes
2answers
76 views

Plotting perpendicular lines to a contour plot (electric field from equipotential curves)

I'm currently working on a experiment about Electric Fields and Equipotential Curves. The problem is that I want to plot (estimate) the curves of electric field using the fact that every one of these ...
0
votes
1answer
51 views

FindFit gives poor regression

My code is ...
1
vote
1answer
33 views

Output of the trained neural network for a set of inputs

Sorry if this was too trivial but I want to get the output of the neural network I trained for the specific inputs that I feed. The notation I often saw was of TrainedNet[inp] kind. But when I use ...
1
vote
0answers
40 views

What does the following error message mean, in the context of NonlinearModelFit?

I am deliberately not including data or a model for this question, as I want a more general answer so that I may be able to trouble shoot this myself in the future. When performing a fit, usually a ...
1
vote
1answer
51 views

Regression to fit data with an integral equation

I have a set data and I know that this data are best fitted by the following equation, assuming that f($\tau$) is a log normal distribution and $M_{eq}$ = 1.5: $M(t,\tau)= M_{eq} \int (1-e^{-t/\tau}) ...
5
votes
0answers
120 views

What are the most reliable test of goodness of fit in Mathematica

I realise this is possibly a VERY open ended question, and potentially has answers dotted around e.g. here . What are the most robust methods of testing the result of ...
3
votes
3answers
56 views

Fitting a function, a (x - 1)^b, to a given set of data

I have some data: ...
0
votes
1answer
42 views

Problems with NonlinearModelFit: “..is not a real number at ” [closed]

I am a newcomer to Mathematica. Basically I just want to fit the data shown below (ArrayFVel). Unfortunately, the model contains rather complicated integral that ...
11
votes
1answer
181 views

What is the best way to use errors in mathematica M12?

Since ErrorListPlot has been superseded by new functionality in ListPlot for Mathematica 12.0, what is the best way to handle ...
1
vote
1answer
43 views

Combining fitted parameters to make a variable and telling me the error in it

I've fit my set of data to a function of the form: $a*\cos(2\pi t)+b*\sin(2\pi t)+c*\cos(4\pi t)+d*\sin(4\pi t)+e$ with a nonlinear model fit. The parameters $a,b,c,d,e$ have errors in it that ...
2
votes
0answers
42 views

How can you set the fit tolerance in `NonlinearModelFit`?

In NonlinearModelFit how can you set the tolerances of where the fitting terminates. I know you can set MaxIterations but how ...
0
votes
1answer
72 views

Nonlinear fitting does not perform appropriately

I have a list as below one: mustbefitted={{0., 1.}, {4.4, 0.982211}, {8.9, 0.961575}, {13.3, 0.942571}, {17.8, 0.923857}, {22.2, 0.906203}, {25.1, 0.046994}}; I ...
0
votes
1answer
61 views

Fitting data with NIntegration related function

I am trying to fit experimental data with data file given below function, but I am not able to find the best fit. Constant value is A=6.26 and ...
5
votes
1answer
132 views

Assign Error bars for y-intercept

I have some data (x,y) with error bars in y direction: ...
0
votes
0answers
29 views

No progress on validation NN training set

So in short my issue is that I'am training a neural network and while the training loss reduces over time, the loss of validation set remains constant. The progress of training looks like this: I am ...
0
votes
1answer
62 views

Obtain reduced chi-squared for fit

Dear Colleagues, I have performed a fit according to the code below. The last step is to obtain the value for the reduced chi-squared for the goodness of fit. Does mathematica have a ...
0
votes
1answer
60 views

How to fit data with superposition of CDFs?

With the help of @JimB, I could fit some experimental data with a CDF using NonLinearFitModel. The set of data is the following: ...
2
votes
2answers
115 views

Fitting two-dimensional data

For this question, I cannot use random sample data. So the actual data can be found here. The data file contains three columns, where the first two are the coordinates $(x,y)$, while the third is the ...
0
votes
0answers
43 views

Fitting data points with a function obtained by ParametricNDSolve+Integrate

My question concerns fitting data points to a function that is a solution of a set of parametric differential equations, then integrated over time. More specifically, I have these parametric ...
1
vote
2answers
83 views

Getting error General::munfl from NonlinearModelFit [duplicate]

I am trying to fit data to a sum of Gaussians. This data is found in a file called lpeff.txt. So I write the following code: ...
0
votes
2answers
53 views

How to find the best quadratic fit for a set of data?

I'm trying to find a degree-2 polynomial fit with x-intercepts of x=0 and x=1 for the below set of data: ...
34
votes
1answer
1k views

How to fit a linear model in the Bayesian way in Mathematica?

Basically, I'm looking for the Bayesian equivalent of LinearModelFit. As of the moment of writing, Mathematica has no real (documented) built-in functionality for ...
1
vote
0answers
42 views

Best Way For Estimating Parameters Of Hidden Markov Process

Parameter estimation is not stable. First, make a model. ...
0
votes
1answer
45 views

Using NonlinearModelFit function with polynomial I have defined

I have a data set that I wish to write a loop for to fit polynomials to. I want to be able to type in the max order polynomial I want it to calculate the fit for and have it solve each along the way. ...
3
votes
1answer
68 views

Choosing the best fit from given plots

I have some data: x={1,2,3,4,5,6,7,8,9,10} y={3.05,21.05,69.05,162.05,315.05,543.05,861.05,1284.05,1827.05,2505.05} That I plot with ...
1
vote
1answer
79 views

Fitting tail of distribution to Generalized Pareto Distribution

Hello, I have a problem in Mathematica and I don’t know if you could help me. I’m trying to compare the “performance” of a Laplace distribution and a Generalized Pareto Distribution (GPD) for the tail ...
2
votes
1answer
54 views

Put error bars in a plot from a non-linear fit together with confidence level

I want to ask you a problem that I have. I make a non linear fit with some data, and I want to know how can I put the error bars in the plot together with the confidence level of the fit that I ...
0
votes
2answers
61 views

FindDistributionParamters vs. NonlinearModelFit for NormalDistribution

I have the following data: dat["Sag"] ={1.277, 1.913, 1.48, 1.472, 1.787, 1.736, 1.896, 1.715, 1.131} I want to fit a normal Distribution to it and get the ...
4
votes
1answer
46 views

Partial and semipartial correlation

I am interested to know if there are built-in Mathematica functions that performs partial and semipartial computations. If not, what would be a simple and efficient way to compute them from the ...
3
votes
1answer
115 views

Fitting a mixture of two normal distributions for a data set?

EDIT: Raw data can be found here: https://gist.github.com/Kagaratsch/65a931d8d78fcdd81f7e346429a02afd Consider the following binned example data: ...
0
votes
1answer
66 views

Fitting nonlinear function does not converge but looks close to best fit

I'm having trouble fitting this transition temperature equation to my data. Physically speaking, the intensity should flatten out for T>Tc, which seems to be the biggest problem here. The equation I'...
0
votes
1answer
74 views

Getting errors from ParametricNDSolveValue

I am a newcomer to Mathematica (use ver 9.0). I just want to fit the experimental data to a system of odes' by using NonlinearModelFit. The data, contains time in the first column and product ...
0
votes
0answers
82 views

Problem with fitting

So I have a very simple question related to a simple topic, but also directly related to a fitting problem. I see that my question is related to this question but I don't manage to make the bridge ...
0
votes
1answer
71 views

Goodness of fit : how to perform weighted Pearson test (or equivalent)?

I wish to perform goodness of fit. Currently I use NonLinearModelFit : ...
1
vote
1answer
60 views

Finding a fit with a specific mean squared error

I have a fit a data set to the following equation ...
0
votes
2answers
92 views

FindFit or Integration Making Use of NumericQ Not Converging

Hello Mathematica Users, I'm using ?NumericQ to solve an integral numerically and then fit the data to give me values for certain parameters. The integrals involved appear in: $$ \alpha = \frac{...
1
vote
2answers
167 views

Dynamic number of parameter fits in Mathematica

I am trying to learn if in Mathematica one can perform fits of analytic functions that are expanded and written as power series. In particular, we can consider the following generic form: $$ f(B,x) = ...
2
votes
1answer
111 views

Why doesn't Mathematica completely draw the fit?

I have a question, and I really need your help, because I think I'm not understanding the reason... I have a potential model.. F[x_] := k x^n for the next ...
1
vote
0answers
47 views

Fitting a Curie-Weiss law function with a diverging point to a data

I would like to fit a function to some experimental data such that the extracted value of Curie temperature (Tc) describes the temperature at which the response flattens out to a constant value. ...
1
vote
1answer
58 views

How to fit a list of points to a certain form given error bands?

I am trying to fit a list of points to the form F[0]/(1 - a*q^2 + b*q^4), where F[0] is the value at zero of a function, which ...
0
votes
0answers
65 views

Why does ListSurfacePlot3D yield a different surface fit than using Python code for best-fit quadratic curve (2nd-order)?

Using the same data, I obtain different surface fits on Mathematica (using ListSurfacePlot3D) and Python (using a code for best-fit quadratic curve (2nd-order)). Here's my code on Mathematica: ...
0
votes
1answer
44 views

How to extract parameters from fitted model for ListSurfacePlot3D?

I would like to obtain the parameters used by Mathematica to create this surface fit of 3d data: ...
3
votes
0answers
47 views

BSpline vs natural spline [closed]

The BSpline in mathematica is defined mathematically here. These BSplines constitute basis for any Spline. But how do I define natural splines in mathematica, i.e. splines that are linear left of the ...