Questions tagged [model-fitting]

Fitting parameters of a function to explain given data

414 questions
0
votes
0 answers

Matlab - Adding assumptions to non linear model fitting

I'm using the fitnlm function within Matlab to calculate three coefficients. To improve the results, I know that two of the coefficients need to be positive and the third to be from 0 - 360 degrees. How can I add these assumptions into the model?…
Whitt
  • 1
  • 1
0
votes
1 answer

Matlab fitting error using lsqcurvefit

I'm developing code to fit the Gompertz equation to a bacterial growth curve and am practicing with some example data provided at the following website: http://www.math.tamu.edu/~phoward/m442/ia3sol.pdf. According to this code the fit should…
Laura
  • 89
  • 8
0
votes
1 answer

Multiple Variable Non Linear Regression OR Curve Fitting Matlab

I have a set of noisy data and want to fit a custom equation though it in MATLAB. Next I would take the values of the coefficients and utilize them in my algorithm. However I am stuck and I cant figure out why. I use a non linear equation…
Sayantan Roy
  • 134
  • 1
  • 15
0
votes
1 answer

R - Fitting a model per subject using data.table or dplyr

I have a set of observations for many subjects and I would like to fit a model for each subject. I"m using the packages data.table and fitdistrplus, but could also try to use dlpyr. Say my data are of this form: #subject_id #observation 1 …
Bar
  • 2,736
  • 3
  • 33
  • 41
0
votes
1 answer

Initial guess visualizing with the nls function

I'm trying to fit a function consisting of several gauss bells to some experimental data. The method used is the nls function from R. But it is difficult to get the initial guess good enough, such that the method can converge. Is it possible to…
midtiby
  • 14,550
  • 6
  • 34
  • 43
0
votes
1 answer

Error-weighted fit using uncertainties in LMFIT

I am trying to fit a model using LMFIT, I can easily do the following: def loss_function(params): residuals = [] for x, measured in ...: y = predict(x, params) residuals.append(y - measured) return residuals params =…
luke14free
  • 2,529
  • 1
  • 17
  • 25
0
votes
0 answers

Some error in my for loop code in R (fitting generalized Pareto distribution)

I'm fitting a GPD to some univariate variables using the gpd command from the evir package. Being a two-parameter distribution family, if I run gpd(z_b[1:1000], threshold=quantile(z_b[1:1000],0.95), method="ml",…
Kondo
  • 125
  • 6
0
votes
1 answer

Maximum Likelihood Estimate for power law in R given distribution (instead of samples)

I have a dataframe with x-y values representing values and their counts, e.g. (1, 1000), (2, 100), (3, 10), etc. I would like to fit a power law to this distribution using MLE. I could use the power.law.fit or poweRlaw libraries, but it appears…
0
votes
1 answer

R: Plotting "Actual vs. Fitted"

I do have a question related to plotting actual data of a time series and the values from a fitted model. In particular, my questions relate to this…
Johnny
  • 103
  • 2
  • 6
0
votes
2 answers

Very high residual Sum-of-Squares

I'm having a problem with the square sum-of-residues of an fitting. The square sum of the residues is too high which indicates that the fit is not very good. However, visually it looks fine to have this very high residual value ... Can anyone help…
david clarck
  • 157
  • 2
  • 11
0
votes
1 answer

Python multi-gaussian Fitting - ValueError: GMM estimation with 2 components, but got only 1 samples

I have two Gaussian Distributions that I want to fit. As the two distributions can be mixed differently I wanted the fit to be as universal as possible. I found the code below here: Gaussian fit to a histogram data in python: Trust Region v/s…
Ciaran
  • 478
  • 1
  • 8
  • 23
0
votes
1 answer

Mesh to mesh. Mesh fitting (averaging). Mesh comparison.

I have 3 sets of point cloud that represent one surface. I want to use these point clouds to construct triangular mesh, then use the mesh to represent the surface. Each set of point cloud is collected in different ways so their representation to…
0
votes
2 answers

What method does MATLAB's glmfit use for logistic regression?

Have run into a problem fitting a binomial logistic regression, in that the results seem to be suspect between languages. Having spent an extended period looking into this and looking for online suggestions, (tried all data variations just in case…
aphex
  • 11
  • 1
0
votes
0 answers

Matlab - MultiStart using lsqcurvefit

I am trying to fit a function using lsqcurvefit linked with MultiStart. The thing is that the obtained results are highly inconsistent with the training data. The whole problem has to do with the frequency response of two RC parallel circuits…
thp
  • 65
  • 6
0
votes
1 answer

R: Bad variogram fitting, bad kriging results

I try to do a kriging in the Jakarta Bay. I have a set of measurement points with appropriated coordinates and attributes (pH, salinity,...) In order to do a kriging I first need to find a model for my variogram. When I use the "variogram" function…
ZKB
  • 101
  • 2