Hot answers tagged

25

Let's first solve it without constraints. Using fitdata from your question one needs to set reasonable starting values. You may have to experiment (I like to use Manipulate) to get in the ball park. nlm = NonlinearModelFit[fitdata, a*Exp[b*x] + c*Exp[d*x] + o, {{a, 0.1}, {b, 3}, {c, 0.3}, {d, -4}, {o, 1}}, x] yields nlm["BestFitParameters"] (* {a ...


17

This answer provides two solutions both use Quantile regression. The first uses sort of brute force fitting with a family of curves. The second is similar to the one by Jack LaVigne, but uses QuantileRegressionFit on the second step, which in this case seems to be more straightforward. This command loads the package QuantileRegression.m used below: ...


12

One possibility is to use a generalized linear model for which Mathematica has the function GeneralizedLinearModelFit. For your potentially Poisson data the observed count $y_i$ given a predictor variable $x_i$ will have a Poisson distribution with mean $\lambda_i$ with $\lambda_i$ being a function of $x_i$. $$y_i|x_i \sim Poisson(\lambda_i) $$ with maybe ...


5

[...] however i would like to build approximation function, that go through as many points as it can. So how can I do that? As What I ideally trying to make is two approximation functions for each half of the graph that go through as many points as it can. This can be easily done with Quantile Regression. Data First let us generate some data: ...


5

After looking at each of the 5 data sets, it does not appear at all that they might have residuals resulting from a single distribution (based on the estimates of mean square error). Why did you think they all had a common error distribution? Is there some theoretical or historical reason? As @AntonAntonov states, quantile regression can be more useful ...


4

The answer is a definite "No" but not just for Mathematica. No test from any package confirms independence of residuals. You can certainly look for evidence of departures from independence but not confirm independence. But let's suppose that's just me being too picky. Your data (constructed from the information you place in the comments) consists of all ...


4

My question, is there a way of determining how close my datatest to a 'pure' Poisson distribution? @JimBaldwin provided an answer for considering the whole dataset (as requested in the question.) Here is proposed a method to evaluate the closeness to Poisson distribution locally using goodness of fit tests. Let us generate the data as shown in the ...


3

While using a computer often means you don't have to worry if there is a large number of polynomials approximating data piecewise, the OP wishes to find a simple polynomial or two that roughly approximates the data. Here is an approach. Please note that data fitting and smoothing is not my forte; but the mathematics used here is fun and too alluring for me ...


3

This answer will show how to fit the data to your model but be aware of a couple of points. The equation for EquationForFilmPotentialUpperPart has an incorrect sign compared to your previous question. The sign from the previous question will be used. With the parameters that minimize the model and data in a least squares sense, the fit still is not very ...


2

You need to scale down the parameter d. One way is to modify the equation by dividing d by 10^12: Qn = {3.141593164052022, 6.283185562410763, 9.424778130923505, 12.566370741974769, 15.707963370041444, 18.849556006615824, 21.99114864805175, 25.132741292526145, 28.27433393902618, 31.41592658694417, 34.557519235893395, 37.69911188561605, ...


2

If you know the model form of the distribution you can use EstimatedDistribution[data, GammaDistribution[\[Alpha], \[Beta]]] or any other parametric distribution. These have a small memory footprint. For a non-parametric approach you can use the bin specifications of HistogramDistribution to reduce the memory footprint of the resulting DataDistribution. ...


1

data=List/@RandomReal[10,{1001}]; data2=Transpose[{Range[-5,5,.01], Flatten@data}]; (* Subdivide[-5,5,1000] instead of Range[-5,5,.01] if you have v 10.4 *) fit=Fit[data2,{0, x, x^2, x^4, x^5, x^6}, x] +0.0310271 x+1.86717 x^2-0.166636 x^4-0.0000977394 x^5+0.00414635 x^6 Show[Plot[fit, {x,-5,5}, Frame->True, PlotRange->All], ...


1

When in doubt, check the data and the model twice, three times, many times. Check beam radius and remember: only two parameters need to be specified to give the whole beam profile: the wavelength Lambda and the beam waist w. $w \sqrt{\frac{\lambda ^2 z^2}{\pi ^2 w^4}+1}$ nlm = NonlinearModelFit[data, w*Sqrt[1 + ((\[Lambda]*z)/(\[Pi]*w^2))^2], {w, ...


1

I guess that the model is not good enough for the data. May be a good idea would be to try a different model, of course if the theory behind does not strictly prescribe this present form. Something along this line, for example: model1 = a*Sqrt[z^2 + c] + b; model2 = a*Abs[z + c] + b; ff1 = FindFit[data, model1, {a, {b, 0}, {c, 0.0001}}, z] ff2 = ...



Only top voted, non community-wiki answers of a minimum length are eligible