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
24
votes
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 ...
14
votes
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 ...
14
votes
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-...
14
votes
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 ...
7
votes
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?
6
votes
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 ...
6
votes
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 ...
6
votes
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 ...
5
votes
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 ...
5
votes
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 ...
5
votes
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 ...
5
votes
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{...
5
votes
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 ...
5
votes
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 ...
5
votes
0answers
891 views

Analytical model fitting

I have a special type of model fitting problem that I am trying to solve in Mathematica. Any insight how to attack it using available tools of Mathematica will be great to hear. We have a variable $$ ...
4
votes
0answers
97 views

Fit Markov Chain

Assume a simple Markov Chain with the transition matrix ...
4
votes
0answers
296 views

How to fit B-splines to unstructured grids (triangulated surfaces)?

As a continuation of trying to calculate curvature tensors on triangulated surfaces (here), I am interested in trying other methods. One approach is to use NURBS. To be more precise I would like to be ...
4
votes
0answers
66 views

Optimization`FindFit`ObjectiveFunction and PenaltyFunction

Consider the following toy example: model = a Cos[w t]; data = Table[{t, Cos[2.1 t]}, {t, 0, 10, .25}] + RandomReal[.1, 41]; as both an unconstrained problem: <...
4
votes
0answers
160 views

Quantile Curves Without Crossing in Mathematica

I was looking at this article by Antonov: https://mathematicaforprediction.wordpress.com/2013/12/16/quantile-regression-through-linear-programming/ and I was wondering if anyone has developed any ...
4
votes
0answers
300 views

Goodness of Fit of Copula Distribution

I am trying to find out goodness of fit of copula distribution, but Mathematica 10 gives me the same answer for each copula type. e.g ...
4
votes
0answers
202 views

Memory problem in Mathematica 10

I'm having a problem with memory. I'm doing nonliner fits of several data lists to a system of differential equations. When I evaluate the "Do" cycle the memory grows with the iteration step up to my ...
3
votes
0answers
75 views

Errors Using FindFit and FindRoot

I'm trying to fit the following equation to data: where and x and y are the dimensionless variables x=V/Vr and y=Ir/(2*I0). n=1 and I'm trying to find Vr and R. The blue is an example of the curve ...
3
votes
0answers
78 views

Can FindFit be used with units?

I am trying to use the units capabilities of Mathematica throughout a course that I am teaching, but am finding that it isn't uniformly implemented across many functions. In particular, I would love ...
3
votes
0answers
164 views

Power law fitting package that optimizes fitting parameters based off of the KolmogorovSmirnov MC method

I'm exploring power law fitting and would like to get to a point of making a power law package like what was discussed in this post, where OP references the R poweRlaw package. As per the comments/...
3
votes
0answers
48 views

Meaning/Format of RAW Image Data

I took photographs and I want to fit the (overall intensity or red intensity) of the photographs to a function of (x,y). I have some questions about how RAW data is structured. What is the difference ...
3
votes
0answers
110 views

Estimating VARX(p,q) models in Mathematica

I would like to estimate the parameters of a vector autogressive process VARX(p,q) with n endogenous variables y and m exogenous variables x: $$ y_t = v + B_1 y_{t-1} + ... + B_p y_{t-p} + \theta_0 ...
3
votes
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 ...
3
votes
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 ...
3
votes
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, ...
3
votes
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 ...
3
votes
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, ...
3
votes
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 ...
3
votes
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 ...
2
votes
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 ...
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 ...
2
votes
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: ...
2
votes
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 ...
2
votes
0answers
29 views

Defining postive parameters for an indexed array in NonlinearModelFit

I'm fitting the model with this code: ...
2
votes
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'...
2
votes
0answers
170 views

Fitting to an implicit function

I am trying to fit a data ...
2
votes
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 ...
2
votes
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 ...
2
votes
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 ...
2
votes
0answers
208 views

How to fit two datasets with common fit parameters?

I have two data sets which go: ...
2
votes
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 (...
2
votes
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 ...
2
votes
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 ...
2
votes
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. ...
2
votes
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 ...
2
votes
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 ...