# Tag Info

4

This is an extended comment on @ubpdqn 's answer. First, I am completely ignorant about the Cole-Davidson formula. But if one plots all of the data using Show[ListLogLogPlot[Reverse /@ data, PlotRange -> Full], LogLogPlot[rf[x], {x, Min[data[[All, 2]]], Max[data[[All, 2]]]}]] one sees a lack of fit: I ask: Is that lack of fit in that one ...

5

Re-writing you function: fun[a_, b_, w_, t_] := a (Sin[b*ArcTan[w t]]/(w (1 + (w t)^2)^(b/2)) + 4 (Sin[b*ArcTan[2 w t]]/(2 w (1 + (2 w t)^2)^(b/2)))) Modifying data: datam = {2 Pi #2, #1} & @@@ data; After playing with manipulate tentative starting guesses: nlm = NonlinearModelFit[datam, fun[a, b, w, t], {{a, 10^13}, {b, 0.1}, {t, 0.1}}, ...

2

General The data has heteroscedastic variables. For heteroscedastic data Quantile regression can be very useful. The blog post "Estimation of conditional density distributions" has analysis description that might be the answer of: The $e_i$ are independent noise from a distribution that depends on $x$ as well as on global parameters of the data; ...

2

This is what I imagined: L = ToExpression@Import["http://pastebin.com/raw/QQ926Qkw"]; design = Transpose[SparseArray[With[{sz = Length /@ L}, With[{sz2 = Accumulate[sz]}, Join[PadRight[MapThread[ Join[ConstantArray[0, #], #2] &, {Prepend[Most[sz2], 0], ConstantArray[1, #] & /@ sz}]], ...

3

If you wish to find a formula for a set of data, you could use the FindFormulafunction: values = {{0.3, 360}, {0.4, 315}, {0.5, 280}, {0.6, 250}, {0.7, 225}, {0.8, 200}, {0.9, 180}, {1.0, 165}, {1.1, 150}, {1.2, 135}, {1.3, 125}, {1.4, 115}, {1.5, 105}, {1.6, 97}, {1.7, 93}, {1.8, 88}, {1.9, 85}, {2.0, 84}}; ...

2

n = 0; a = 1; L = 0; b = 1/100; m = 1/2; g = (2 m a r)/(n + L + 1); f[r_] = AiryAi[(2 m b)^(1/3) r]; r0 = r /. FindMaximum[r^(L + 1) f[r], r, WorkingPrecision -> 20][[2]] // Rationalize[#, 0] &; r0 // N // InputForm (* 4.103398736759 *) r1inv = Series[1/r, {r, r0, 4}] // Normal // Simplify; r0 == r /. Solve[r1inv - 1/r == 0, r, ...

6

In the comments I supposed that the reason why the algorithm stops is obtaining zero derivative with respect to b at the point {a, b} = {0., 1.} returned as the minimum. Let us check this statement by perturbing the actual Jacobian a little bit in order to make all the derivatives non-zero. Proceeding from the code in the question, we find the Jacobian and ...

5

I am one of the many that does not consider this a bug as it is shared by probably the majority of statistical packages. (But there certainly is room for improvement in terms of warnings that could be given.) Iterative procedures work great if the starting values are close enough to the final values. When one doesn't know the final result this requirement ...

6

This looks like a numerical precision issue. Various approaches that precisely address this, all yield the same, correct solution: Scaling of the x values: data = {{0, 20}, {20, 10}, {40, 5}, {60, 2.5}, {80, 1.25}}; {xmin, xmax} = MinMax[data[[All,1]]]; data2 = {Rescale[data[[All, 1]]], data[[All, 2]]} // Transpose; fit1 = FindFit[data2, a*Exp[b*x], {a, ...

13

It seems it is better to use a family of functions instead of just one. The code below uses NonLinearFit instead of FindFit, since I do not think using FindFit is a hard requirement in the question. Also, below I assume that the definitions in the question are evaluated. First, let us speed-up the use of NIntegrate: T[(beta_)?NumericQ, (Is_)?NumericQ, ...

4

So you already found a way to do this with NMinimize, and we can apply that to this problem, Y1[a1_, b1_, c1_, d1_, e1_, f1_] := ({{a1, b1, c1}, {b1, d1, e1}, {c1, e1, f1}}); Y2[a2_, b2_, c2_, d2_, e2_, f2_] := ({{a2, b2, c2}, {b2, d2, e2}, {c2, e2, f2}}); MA = r*(kd*Y1[a1, b1, c1, d1, e1, f1] + s*Y2[a2, b2, c2, d2, e2, f2]); MB = r*(kd*Y1[a1, ...

9

I think it's possible to find the shape automatically, but I can't say how reliable this will be. If you can post more sample images, I can try to improve this. Using your image: img = Import["http://i.stack.imgur.com/kL6cd.jpg"]; I would use watershed segmentation to find the particle. The idea is this: Imagine the image gradient strength as a 3d ...

8

edit (30 Jan 2016) : one error corrected, rotation (§4) added,result slightly higher (1.3%) I propose the following solution : 1) interactively mark the frontier of the object by points 2) interactively mark the center of the object 3) use polar coordinates (r,theta) with the origin at the center. Thus r[theta] is symetric around a angle theta0, ...

3

ParametricNDSolve will return a numerical ODE solution with any number of free parameters. This parametric solution can then be fed into NonLinearModelFit (or whatever home-brew chi-squared algorithm you want to cook up) to find the best-fit values for the parameters. As an example, suppose we want have the ODE $y''(x) = - y(x)$, with initial conditions ...

2

To fit a model and obtain a measure of precision for the parameter estimates one needs to consider the error structure in addition to matching the data with a function to be minimized or maximized. And finding the value of a parameter that minimizes some function does not necessarily result in a “best fit.” Again, it depends on what is a reasonable error ...

1

1

Try to avoid Table where you can and use vectorized expressions instead. For example, if you create 2d arrays for x and y-coordinates: dims = {500, 500}; center = {100, 100}; ys = Array[N[#1] &, dims] - center[[1]]; xs = Array[N[#2] &, dims] - center[[2]]; you can then use xs and ys in expressions, and Sqrt, ArcTan and friends will automatically ...

4

data = Table[{x, 1 - Gamma[1, 2/x]/Gamma[1] + Random[]/10}, {x, 1, 10, .1}]; res = FindFit[data, 1 - Gamma[A, B/x]/Gamma[A], {A, B}, x]; (* {A -> 0.913848, B -> 2.06033} *) Show[ ListLogLogPlot[data], LogLogPlot[1 - Gamma[A, B/x]/Gamma[A] /. res // Evaluate, {x, 1, 10}], Frame -> True ] You can fit in log-log space, but then don't forget ...

Top 50 recent answers are included