Tag Info

Hot answers tagged

13

Something strange happens when you allow your lines in your model to have a gap at point k. You also specified UnitStep functions wrongly - see my version below. You do realize your model function allows for gap? It is better to have less parameters in the model. Obviously your data assume that lines meet without gap. Why not to explicitly specify this ...


12

The mathematica help is very thorough and is very indicative of what you should do next. By way of the histogram diagram obtained, you can compare your data against the proposed distribution. Show[Histogram[w[[2, 1]], Automatic, "ProbabilityDensity"], Plot[PDF[h["FittedDistribution"], x], {x, 0, 1500}, PlotStyle -> Thick]] The reference points you ...


5

There is actually a fair bit going on here that can make this confusing. The critical thing is the difference between testing fit to a family of distributions compared to testing fit to a particular distribution. Let me demonstrate. SeedRandom[23]; data = RandomVariate[NormalDistribution[1, 2], 100]; DistributionFitTest[data, NormalDistribution[mu, ...


4

As usual, it's a matter of choosing a better starting values for the parameters. I started writing this answer before the data file was uploaded, so here's some synthetic data: data = Table[ Interpolation[{{0, 1.1*^-6}, {200, 1.1*^-6}, {250, 9.5*^-7}, {500, 9.5*^-7}}, x, InterpolationOrder -> 1] + 2*^-8 ...


4

Here is a solution -- I added a constraint and manually found some good initial values. g[z_] = Simplify[ 5 Log[10,(1 + z ) Integrate[1/(a + b x + c x^2), {x, 0, z}] ] + 25 , Assumptions -> {z > 0, -b^2 + 4 a c > 0 }] 5 (5 + Log[10,-((2 (1 + z) (ArcTan[b/Sqrt[-b^2 + 4 a c]] - ArcTan[(b + 2 c ...


4

If you wanted to automate things you might do something like this: tests = Sort[(g = DistributionFitTest[ w, #, {"PValue", "FittedDistribution"}]) & /@ { GammaDistribution[a, b, c, d], NormalDistribution[a, b], ChiSquareDistribution[a], HalfNormalDistribution[a], ...


4

As b.gatessucks comments you can use inset. You can also use PlotLegends and customize, e.g. tab = nlm["ParameterTable"] plt = Show[ Plot[nlm[t], {t, 0, 5}, PlotRange -> Full, PlotLegends -> Placed[LineLegend[{Blue}, {Normal@nlm[t]}, LegendMarkerSize -> {50, 3}, LegendFunction -> (Column[{#, tab}, Frame -> True] ...


3

First add a constant term to pos and neg as b.gatessucks suggests. Then you can bump the starting point of the parameter x1 off of the data grid, so that x - x1 is unlikely to ever be zero: data = {{0, 0}, {0.1, 0.1}, {0.2, 0.2}, {0.3, 0.3}, {0.4, 0.4}, {0.5, 0.5}, {0.6, 0.6}, {0.7, 0.7}, {0.8, 0.8}, {0.9, 0.9}, {1, 1}, {1.1, 0.9}, {1.2, 0.8}, ...


3

Following @Vitaliy's comment try this formulation: kB = QuantityMagnitude@ UnitConvert[Quantity["BoltzmannConstant"] , "Joule/Kelvin"] pdf[dp_?NumericQ, d0p_?NumericQ, w_?NumericQ] = kB^(-1/3)/(w Sqrt[2 Pi]) 1/dp *E^(-1/(2 w^2) (Log[dp /d0p])^2); mt[b_?NumericQ, Nt_?NumericQ, Ms_?NumericQ, d0p_?NumericQ, w_?NumericQ] := Nt kB^(4/3) Ms Pi /6 ...


2

You can try to improve it "by hand", as follows. Assume that the model is like this: model = (a*(Exp[c*t] - 1))/(1 + b*Exp[c*t]) and assume that you have in mind that your data correspond to {{1, intensity1}, {2, intensity2},...} (see my comment above) and assume that norm is the name of your data. Try the following: Clear[model, a, b, c]; model = ...


2

Your model seems to be problematic. With a standard step-shaped model: ´model = a/(1 + b*Exp[-c (x - d)])´ you immediately find a simple enough solution. Assuming that ´lst´ is your list try this: model = a/(1 + b*Exp[-c (x - d)]); ff = FindFit[lst, model, {a, b, c, d}, x] (* {a -> 1.00153, b -> 0.437, c -> 13.2399, d -> 0.454211} *) This ...


2

There are two reasons why it doesn't work. You have negative x values. Raising these to fractional d powers gives complex results. For this reason it is not sensible to use the form a x^d for fitting this data. However, you could use a Abs[x]^d instead. With this change it still won't work. The other reason is that FindFit work by minimizing (using ...


1

My reading of the error message you are getting is that if you try λp[85.] = 6540 λp[100.] = 6540 Psat[85.] = 78896.6 Psat[100.] = 323767 your original formulation might work. λp[100] is not the same as λp[100.]. Similarly for λp[85] and Psat, too.


1

You could do the NonlinearModelFit yourself? Following the example in the documentation: Starting with the data data = {{0, 1}, {1, 0}, {3, 2}, {5, 4}, {6, 4}, {7, 5}}; Extracting the ys, and xs ys = Last /@ data;xs = First /@ data; Defining some ad hoc weights wghts = Table[Exp[-(i - j)^2/8.], {i, Length[ys]}, {j, Length[ys]}] Let us define the ...



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