# Questions tagged [fitting]

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

169 questions with no upvoted or accepted answers
Filter by
Sorted by
Tagged with
0answers
1k views

### Nonlinear least squares on a GPU with Mathematica 9

Update: A Mathematica wrapper for (https://github.com/zitmen/cuLM) should allow for us to directly implement the Levenberg-Marquardt algorithm in CUDA for nonlinear least squares fitting. In a ...
0answers
315 views

### New issue or new setting(s) of Goodness-of-Fit Tests in 11.3@student edition

Bug introduced in 11.3 or earlier and persisting through 11.3.0 or later Just before upgrading to 11.3.0 on last Friday, i was having p-value results from 11.2.0. Not worrying about upgrade may ...
0answers
743 views

### Implementation of Partial Least Squares (PLS)?

I'm looking for a PLS implementation for Wolfram Mathematica. I just can't seem to find any implementation for it - do you know one? In general, I'm a bit confused that there exist only so few third-...
0answers
652 views

### PenaltyFunction Option in NMinimize

I am curious if anybody has some experience in using the built-in Option "PenaltyFunction" in any of the numerical optimization functions like NMinimize. According to the documentation the user ...
0answers
252 views

### Multivariate Adaptive Regression Splines (MARS) - Mathematica implementation?

Does anybody have or know of a Mathematica implementation of the Multivariate Adaptive Regression Splines (MARS) algorithm?
0answers
402 views

### Custom Methods for NMinimize/NonLinearModelFit

Is there a way to write custom methods for NonLinearModelFit or NMinimize? To give background, I currently have a batch of code ...
0answers
170 views

### Is there a way to produce a FittedModel object as the solution to a regularized regression?

I can get the Ridge or Tikhonov regression solution to Y = \[Beta].X easily enough as ...
0answers
384 views

### Problems extending NelderMeadMinimize into 2D

Update The eventual route I followed was to adapt a version of the NM-simplex written in C and link to it with MathLink. Once I've tested this out fully I'll post it here. I've been playing around ...
0answers
68 views

### How to get statistics of FindFit with changed norm-function?

I changed the norm-function of FindFit according to this answer, because apparently it is not supported for NonlinearModelFit ...
0answers
557 views

### Estimate process parameters of geometric Brownian motion with a two-state Markov chain

I have the following sequence. Consider a model that follows a geometric Brownian motion whose drift switches between two different regimes representing the up trend and down trend. The regime ...
0answers
298 views

### Softmax Regression Classification Algorithm

I'm following the Stanford Machine Learning course while simultaneously developing my Mathematica abilities. I'm having issues with my Softmax Classifier implementation (for ref, have a look at these ...
0answers
148 views

### Fitting data with unique variable per measurement

Imagine we are in the following situation, we have a nonlinear system of functions $f$ with coördinates $x_i$, and unknown parameters $\delta_i$'s and $t$. Let this system be defined as, \begin{...
0answers
146 views

### Third syntax version of LogitModelFit: unexpected result of “BestFit”

The third listed syntax version of LogitModelFit allows one to specify input in a simple way: Only a design matrix (with a row of values of the explanatory input ...
0answers
474 views

### Module in numerical model for NonlinearModelFit is slow and leaks memory

I am trying to make a NonlinearModelFit where the model is the result of a numerical calculation. My code works, but it is very slow and also seems to have a memory ...
0answers
891 views

0answers
173 views

### Least squares approximation

I have data points which is mydata = {{0, 0}, {1, 1}, {2, 0}}; From this data, I need to do the least squares approximation by using Bernstein polynomials to produce a set of Bezier points. Before ...
0answers
122 views

### PearsonChiSquareTest for count/frequency data?

I read with interest a previous question on the PearsonChiSquareTest from a few years ago, and one answer was very helpful: Performing a chi-square goodness of fit ...
0answers
145 views

### Writing a function to set up and solve the least squares problem

I have setup the explicit line equation for a given set of points using least-squares approximation and the knots computed below. I have tried extending the same code for use with an arbitrary degree, ...
0answers
235 views

### The CorrelationMatrix is equal to corrcoef of Matlab?

How can I generate a matrix which is equivalent to the results of the "correlation coefficients" command (corrcoef) in Matlab? When I make a LinearModelFit, I can get a CorrelationMatrix, but is this ...
0answers
779 views

### NonLinearModelFit with Two Dimensional List of Weights

I'm currently trying to fit Planck's law (B[λ, T]) to measurements, thereby determining Planck's constant. I have a list of triplets containing wavelength, ...
0answers
935 views

### Is it possible to marginalize one or several parameters obtained from fitting procedure?

Statistical model analysis package has a few fitting functions. Their arguments are data points, fitting model and parameters in the fit. The result is a set of best values for parameters, which ...
0answers
254 views

### Mathematica Complains about Non Symmetric Covariance matrix, when it's not the case

I was doing some fitting with Mathematica7 using NonlinearModelFit. It's quite long the program to do the fit and that's why I am not displaying here ... It goes ok, and I can get the fit parameters ...
0answers
26 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 ...
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 ...
0answers
88 views

### How to speed up multiple calls of NonlinearModelFit?

I'm trying to do an insane amount of non-linear fits to large amounts of data sets. However, I found that the NonlinearModelFit is horribly slow. Here's the setup: ...
1answer
211 views

### Standard error of a nonlinear fit

I would like to better understand the process that Mathematica uses to determine the standard error when fitting with NonlinearModelFit. I have been reading this ...
0answers
29 views

### Defining postive parameters for an indexed array in NonlinearModelFit

I'm fitting the model with this code: ...
0answers
169 views

### How to extract the conditional variance from a fitted GARCH model?

In R's garchFit (fGarch) I can simply call "@h.t" or "@sigma.t" to get the conditional variance or standard deviation for a fitted GARCH model. Is there a convenient way achieve this with Mathematica'...
0answers
170 views

### Fitting to an implicit function

I am trying to fit a data ...
0answers
273 views

### Data fitting with differential equation and non analytical integral

I would like to fit a set of data (measured value vs time) with a model that contains a differential equation and an integral that has to be evaluated numericaly. The integral also contains Bessel ...
0answers
371 views

### LinearModelFit[ ] and missing data

I have a data set where there is a lot of missing values; they are labelled Missing["Non-mesuré"]. When I append this data to another list of same length which has ...
0answers
402 views

### How to get the reduced chi-squared value for a best fit line/curve with error bars on both x and y axis?

Suppose I have a set of data ({xi,yi},like data from lab experiment) and I have errors associated with each xi and yi. If I do a best-fit line/curve, how do I get the reduced chi-squared value for ...
0answers
208 views

### How to fit two datasets with common fit parameters?

I have two data sets which go: ...
0answers
94 views

### Algorithm used by Fit[]

Does anyone know what algorithm Mathematica's basic Fit[] function uses? Is it proprietary? I'm trying to do some pretty basic, linear, polynomial data fitting (...
0answers
1k views

### Fit linear data with weights for y and x in LinearModelFit

I am quite new using Mathematica, I hope someone could give me some help. I have a set of {x, y} data and I have a list of {deltaX, deltaY} standard deviation. I would like to fit my data taking into ...
0answers
536 views

### How to control precision of parameters in NonlinearModelFit?

I am using NonlinearModelFit for fitting a dataset to some complex numerical model function that depends on a few parameters. The final required precision of these parameters is very low, like 3 ...
0answers
284 views

### Kalman filter estimation

Does anyone have any examples of the estimation of Kalman filters in Mathematica? I am new to these filters and struggling to compose the likelihood function. Some examples would be really helpful. ...
0answers
295 views

### Comparing two ways of fitting systems of ODEs to data

I'd like to ask you if you see any difference between the two following ways of estimating parameters. Given my system of ordinary differential equations that I want to use to find the values of all ...
0answers
274 views

### Cross-validation of a FittedModel

Although I would know how to perform cross-validation tests after fitting a model using a function like NonLinearModelFit, I wonder if there is a way to do this providing the right parameters to the ...