Hot answers tagged

9

To illustrate my comment, here is a minimal example: ptsData = {N@#, N@((-3.5 #^2 + 3 #) Exp[3 #]) (1 + RandomReal[{-0.075, +0.075}])} & /@ RandomReal[{0, 1}, 500]; net = NetTrain[ NetChain[{20, Ramp, 20, Ramp, 1}], Rule @@@ ptsData ]; Show[ ListPlot[ptsData], Plot[net[x], {x, 0, 1}, PlotStyle -> Red] ]; The model produced by the network is ...


6

Here's a brute force Frequentist approach. It does not account for heterogeneity of variance as can the approach described by @SjoerdSmit. * Generate data *) ptsData = {N@#, N@((-3.5 #^2 + 3 #) Exp[3 #]) (1 + RandomReal[{-0.075, +0.075}])} & /@ RandomReal[{0, 1}, 500]; (* Number of segments *) nSegments = 6 (* Segment bounds *) bounds = {-∞, Table[c[i]...


5

Look at your data: If you try a least square fit to this data, MMA mainly tries to fit the leftmost end because that is where the large errors are. Therefore you must in some way tell MMA, that the errors at the left end are less important. That is you need a weighted fit. In FindFit you may specify a norm function, that the actual error to be minimized ...


4

Using WFR's function QuantileRegression: (* Generate data *) ptsData = SortBy[{N@#, N@((-3.5 #^2 + 3 #) Exp[3 #]) (1 + RandomReal[{-0.075, +0.075}])} & /@ RandomReal[{0, 1}, 500], First]; (* Quantile regression computation with specified knots *) knots = Rescale[Range[0, 1, 0.13], MinMax@ptsData[[All, 1]]]; probs = {0.5}; qFuncs =...


3

If in your original dataset you had retained the large values associated with $R<3$, then @DanielHuber 's approach is a good one (which is one way to account for varying precision of the observations). But with your modified dataset with $R\geq 3$, there is less need for weighting. However, because the data and model structure induces high correlations ...


3

Below I am using the software monad QRMon, but the code can be relatively easily modified to use the resource function QuantileRegression. Data data = Get["https://pastebin.com/raw/2jgDw4iQ"]; Definitions Import["https://raw.githubusercontent.com/antononcube/MathematicaForPrediction/master/MonadicProgramming/MonadicQuantileRegression.m"] ...


2

I think you want something like this? real = Data[[All, {1, 4, 2}]]; imag = Data[[All, {1, 4, 3}]]; Model = (A*E^(d/x)*t*w)/(-I + E^(d/x)*t*w); fit = ResourceFunction["MultiNonlinearModelFit"][ Rationalize[{real, imag}, 0], ComplexExpand[ReIm @ Model], Rationalize[{{A, 1.0*10^-4}, {t, 1.0*10^-12}, {d, 10}}, 0], {x, w}, WorkingPrecision -&...


1

The advice from "statisticsbyjim.com" (not at all associated with me) only applies if you have independent estimators. But if the estimators are not independent (which is the case most of the time with a regression - linear or nonlinear), then you'll need to consider the lack of independence. If the estimators NonlinearModelFit have approximately ...


1

My code, nowhere near as sophisticated as your code: NonlinearModelFit[data1,(a n^x) / (m x!)[x, a, n, m], {{a,3},{n,5},{m,2}},x, Method->"Automatic"] In Mathematica you cannot define a function and invoke it in this way: (a n^x) / (m x!)[x, a, n, m] You have to define a function: Y[x_, a_, n_, m_] := (a n^x) / (m x!); Y[x, a, n, m] or use ...


1

Here is an example that you can adapt to your data for fitting a spline to given points. This example fits a curve to points from a Morse potential. You can move the locator to adapt the function: pts = {{0, 10}, {1, 5}, {2, 2}, {3, 1}, {4, 2}, {5, 4}, {6, 5}, {7, 5.5}, {8, 6}};(*data points. Do not use too many data points, otherwise you will slow down the ...


1

Here is a fit to the data: f[x_] = p1 Exp[-(x - p2)^2 p3] + p4 Exp[-(x - p5)^2 p6] /. FindFit[dat1, p1 Exp[-(x - p2)^2 p3] + p4 Exp[-(x - p5)^2 p6], {p1, {p2, 75}, p3, p4, {p5, 90}, p6}, x] Plot[f[x], {x, dat1[[1, 1]], dat1[[-1, 1]]}, Epilog -> {PointSize[0.001], Point[dat1]}] The areas you can get from: {f1[x_], f2[x_]} = {p1 Exp[-(x - p2)^...


1

Data can be scaled to mV as data = Table[{datasc[[i, 1]] 10^3, datasc[[i, 2]]}, {i, Length[datasc]}]; Then we use parameter $10^{-3}/(kT)=3.6265521643263314$ and function (we put x=Ea-V) dos[No_?NumericQ, \[CapitalGamma]_?NumericQ, \[CapitalDelta]_? NumericQ, V_?NumericQ] := No Sign[V] NIntegrate[ Re[(x + V - I \[CapitalGamma])/ ...


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