Questions tagged [fitting]
Questions on the use of Mathematica to construct models for approximating empirical data.
1,574
questions
2
votes
1
answer
54
views
Goodness of fit
I want to evaluate the goodness of two sets or more fitting parameters, using Rsquared and RMSE (root mean square error), Then how to code?)
...
1
vote
1
answer
55
views
Finding fit parameters for a 2-dimensional matrix of data if the value of some parameters depend on the row and others on the column
I have some 2-dimensional data of dimension n x m that I suspect has the following structure:
...
1
vote
1
answer
110
views
Find the parameter in NDSolve giving the desired solution
EDIT: I've edited many times because the system gives errors when the body is modified all at once.
I've simplified the problem. The simplification consists of having reduced the number of parameters ...
4
votes
1
answer
109
views
FindDistribution and parameters
If I generate some data using
data = RandomVariate[NormalDistribution[5, 3], 100]
Then find the distribution using
(1) ...
0
votes
0
answers
32
views
Norm adding up residual
For FindFit I want to have a norm that just sums up all residuals.
For the sum of absolute values there is NormFunction -> (Norm[#, 1] &), but I don't know ...
2
votes
1
answer
150
views
1
vote
2
answers
67
views
FindFit; not a valid variable [closed]
I am trying to fit the function in model, however I get
General::ivar: 5000.` is not a valid variable.
this error.
My code is that and
...
0
votes
1
answer
47
views
Interpreting Confidence Intervals From NonLinearModelFit
I recently applied a model to some example data using nonlinearmodelfit and, while the fit was seemingly good (R^2=0.987) and the returned parameters were mostly in line with expectations without ...
1
vote
0
answers
35
views
Nonlinear Model Fit - Force a Constrain
I am trying to achieve the best fit for a non linear model, yet I need to ensure that certain coefficients return as positive values. I have been looking for similar questions but I have found nothing ...
0
votes
1
answer
75
views
Memory problems when fitting large (correlated) datasets
I am trying to fit some complicated function that depends on 18 parameters.
The problematic is that I have a large correlated dataset (336 points).
When fitting, for simplicity, taking only the ...
4
votes
3
answers
341
views
1
vote
1
answer
58
views
NonlinearFit with series coefficients
I have a set of data:
...
-3
votes
1
answer
44
views
Fit a parametric function to a ListPlot
Imagine I have a list of points that corresponds to points randomly placed on the circumference of a unit circle. I want code that fits a parametric curve corresponding to this list of points. Note ...
4
votes
1
answer
172
views
How can I fill this region?
How can I fill this region?
Plot[{x^2, x^2 - 2 x + 1}, {x, -2, 2},
PlotRange -> {Automatic, {0, 0.5}}, GridLines -> Automatic]
1
vote
2
answers
108
views
How to recover the original function from a fitting?
Suppose I have an original function as follows
fun[x_] := 6*Exp[-4 x^2];
which has the following plot
Plot[fun[x], {x, 0, 4}, PlotRange -> All]
Then I produce ...
1
vote
3
answers
85
views
How to customize the method of fitting to a specific one?
I have a set of data as follows
...
1
vote
1
answer
123
views
How to fit a specific range of data?
Let me explain my question by a toy example: Suppose I have a simple Gaussian function as follows:
test[x_] = 4*Exp[-(x)^2];
If I its data to a new Gaussian ...
4
votes
4
answers
415
views
Find fit function
I want to find a fit function for the following data. Can someone suggest the best-fit function for the following data? The upper part of the data set is difficult.
...
0
votes
0
answers
27
views
Fitting data with weights in a Log-Log scale
I need help.
I have the following dataset:
...
1
vote
2
answers
161
views
Is there a way to fit a piecewise linear function to a list?
I need to find a piecewise linear function that is a proper approximation for sunrise/sunset times of each day of year. Due to some limitations, I cannot use any trigonometric functions. So the sine-...
0
votes
0
answers
29
views
Minimizing and marginalizing in Mathematica
Suppose there is a chi-squared function of several parameters, f(x,y,z),
and I have to fit one parameter, say "x", while the rest "y" and "z" have to be dealt with in a ...
1
vote
0
answers
78
views
How to find the center of gravity of fibers in image
I am trying to find the centers of gravity of my particles in a SEM image. I binarized the image (img) and with the input and help of previous suggestions on that topic (Creating graph out of ...
-1
votes
2
answers
81
views
Finding best polynomial approximation for function with complicated form and many terms [closed]
I have a function that contains 50 terms hence, it is a complicated-looking function. Now I expected it to be a polynomial function. How can I get this polynomial fit provided I don't have data, I ...
1
vote
1
answer
94
views
Find best fit function for different data set with errors
I have the following 3 data sets for the same quantity with errors as shown in the figure in different colors. How to find the best fit function of 1) each data set separately 2) combined of the 3 ...
5
votes
4
answers
253
views
Fit data with NormalDistribution
Good day to all!
I have some data that I would like to fit with a normal distribution:
...
0
votes
1
answer
67
views
1
vote
1
answer
42
views
How to get a function out of NDSolve
I solved a function using NDSolve and got a result. I also have a plot of the function.
Could someone point me in the right direction how I can print the explicit data points and/or generate a fit ...
0
votes
0
answers
46
views
How Mathematica searches prediction band lines?
After approximation, for example
model=NonlinearModelFit[data, a + b*x + c*x^2, {a, b, c}, x]
We can do this
...
1
vote
0
answers
65
views
Fitting data using ParametricNDSolve
I have a system of differential equations that are solved using ParametricNDSolve, leaving two variables undefined (m1 and m2) so that they can be fitted to data later. However, Nonlinearmodelfit ...
1
vote
1
answer
75
views
0
votes
0
answers
39
views
Search for fitting parameters for an inverse Laplace function
I am trying to find a suitable parameter for this function, which I got using the Talbot Inverse Laplace method.
But since I'm really not a pro in Mathematica, I don't know why I'm getting the ...
0
votes
2
answers
75
views
Plotting data and fitting to a function
I have three sets of data. I would like to plot them in the same graph. Then plot the following fittings to the data. Any help is appreciated!
f(v) = (v^2)*exp(-mv^2/2 kb T)
f(v) = (v^3)*exp(-mv^2/2 ...
2
votes
6
answers
236
views
Finding fit function for a given data
In the following, there is some data given. How to find the best fit function of one variable with multiple parameters that best describe this data? It's better to check the agreement on the ...
5
votes
1
answer
108
views
LogitModelFit to predict a categorical variable
I am trying to predict life expectancy based on GDP per capita and literacy rate. Life expectancy is coded as low and high, and the two predictor variables are numerical.
Here is some sample data:
<...
1
vote
1
answer
90
views
Fitting an Equation to an Image
I'm very new to data analysis and I'm trying to figure out how I can fit an equation to an image I generated from a large set of data I collected. I'd then want to overlap this plot to the image to ...
1
vote
1
answer
94
views
Exponential fit precision lost
I have a data:
...
2
votes
1
answer
104
views
How do i plot a graph for width vs height of the slits from an image
I need to calculate the width of the slits along the length of each slits. I am new to image processing in mathematica and I need to plot a graph showing how the width changes along the length.
I have ...
5
votes
2
answers
238
views
Fit function to histogram
I have a list:
histx={-56.6335, -57.2327, -57.8607, -57.9682, -57.0061, -57.1872,-56.9209, -56.1284,...};
I managed to create the histogram that I wanted to:
But ...
0
votes
1
answer
57
views
Set up a distribution in LogLikelihood that depends on data
I want to define a loglikelihood function to perform a fit of some data points to a function, like the following, but using the native LogLikelihood[] function.
$
likelihood=\sum_{i}(Log{(\frac{1}{\...
1
vote
0
answers
47
views
Error in NonlinearModelFit for Complex differential Equation
I am trying to create a model that will fit data to a complex differential equation generated from NDSolve. The format that I have begins with ParametricNDSolveValue to find a general function where ...
0
votes
1
answer
95
views
Mathematica linear model fit to all data [closed]
I tried to use LinearModelFit[data, x, x] to fit linear curve to all data but I get an error:
The data looks like this:
Here is the file with data:data
5
votes
2
answers
204
views
Find Equation for Line Bounding Bottom of Scatter Plot
I have a scatter plot and I am trying to get the equation of a line that best fits the bottom bound of the data.
I started by taking some guesses for the best form of the boundary equation and used ...
2
votes
2
answers
173
views
Can the CopulaDistributions be fitted?
This is an immediate follow-up to DoAny--which I did consider editing, clarifying and correcting in some respects.
But perhaps here I can put the immediate question at hand more directly (the emphasis ...
3
votes
1
answer
210
views
Find a fitting curve to data points
I would like to fit a function to a set of data:
...
0
votes
1
answer
57
views
Find fit gives errors and wrong result
I want to find fit to this data and the equation:
...
1
vote
3
answers
235
views
Do any of the Mathematica CopulaDistributions (or others) fit well this sampled bivariate copula with uniform marginals over [0,1]?
I'm currently developing a data set that consists of two $50 \times 50$ matrices, which I designate as q1 and Q1. I strongly believe (bordering on formal proof [cf. Corollary 1 in marginalinvariance]) ...
2
votes
1
answer
122
views
(NLM @ Circular TimeSeries model ) == invalid phase confidence intervals
In the realm of TimeSeries of data with Circular Statistics, NonlinearModelFit (NLM) correctly generates reasonable Standard Error & confidence intervals for phase parameters (phaseCIs) with x-...
2
votes
1
answer
88
views
Fitting data to a system of ODE
I have a system of two ODEs depending on two parameter k,h and I want to find the best k,h to fit some data. To understand if my code works I started generating some fake data from the equations. Here ...
0
votes
1
answer
173
views
Fit a good Lorentzian in mathematica
Good morning everyone,
regarding my research "high resolution laser spectroscopy" I would like to fit the data obtained from the experiment with a Lorentzian curve using Mathematica, so as ...
2
votes
2
answers
91
views
Evaluating a FittedModel over a list of values
Simplified version
Using the simpler version suggested by @ulrich-neumann :
...