python,numpy,scipy,curve-fitting,data-fitting

You could simply overwrite your function for the second data set: def power_law2(x, c): return a_one * (x + c) ** b_one x_data_two = np.random.rand(10) y_data_two = np.random.rand(10) c_two = curve_fit(power_law2, x_data_two, y_data_two)[0][0] Or you could use this (it finds optimal a,b for all data and optimal c1 for data_one...

python,data-fitting,function-fitting

Here are a couple of observations that could help: You could try the least-squares fit directly with leastsq, providing the Jacobian, which might help tame it. I'm guessing you don't want the superconducting temperatures in your data set at all if you're fitting to an Einstein model (do you have...

python,numpy,signal-processing,data-fitting,derivative

Have a look at the Savitzky-Gollay filter for an efficient local polynomial fitting. It is implemented, for instance, in scipy.signal.savgol_filter. The derivative of the fitted polynomial can be obtained with the deriv=1 argument....

The standard errors are different because the variance assumptions in the two models are different. Logistic regression assumes the response has a binomial distribution, while beta regression assumes it has a beta distribution. The variance functions of the two are different. For the binomial, if you specify the mean (and...

Let's first put all the data into one dataset, rather than having a bunch of different variables: filenames = ls('*.txt'); % or whatever you do to make up your list of files data = zeros(1000, 8); %preallocate % going to use first file to set location of bins so they're...

I hope this helps library(copula) gumbel.cop= gumbelCopula(2, dim = 7) set.seed(117) u1 = rCopula(500, gumbel.cop) fit.ml = fitCopula(gumbel.cop, u1, method = "ml") The output for the above is fitCopula() estimation based on 'maximum likelihood' and a sample of size 500. Estimate Std. Error z value Pr(>|z|) param 2.01132 0.02902 69.31...

You can generate monotonicity for any series of 3D points by simply taking the accumulated distance from point to point as the independent (monotonic) parameter. Think of it as the length of a piecewise linear path p connecting all the points ... Edit: ... like in (pseudo code): p[0] =...

Two things: Gnuplot does integer division, so you must use 3/2.0 to get the correct exponent. Second, the function in gnuplot is not the same as the one used in KaleidaGraph: The exponent must be positive (3/2.0) and you must use m2 where you have b: f(x) = 1/(2*pi) *...

matlab,mathematical-optimization,ellipse,data-fitting

This answer is not a direct fit in 3D, it instead involves first a rotation of the data so that the plane of the points coincides with the xy plane, then a fit to the data in 2D. % input: data, a N x 3 array with one set of...

r,regression,curve-fitting,data-fitting,nls

Here's one way to do it. (On edit: this works fine, a typo in my original code made it seem like it wasn't working, thanks to @MrFlick and @Gregor for pointing this out). First replicate your code with a fixed random seed: set.seed(1) x<-seq(0,120, by=5) y<-100/50*exp(-0.02*x)*rnorm(25, mean=1, sd=0.05) y2<-(1*100/50)*(0.1/(0.1-0.02))*(exp(-0.02*x)-exp(-0.1*x))*rnorm(25, mean=1,...

variables,gnuplot,curve-fitting,data-fitting,function-fitting

Quoting the documentation: If activated by using set fit errorvariables, the error for each fitted parameter will be stored in a variable named like the parameter, but with "_err" appended. ...

r,ggplot2,curve-fitting,data-fitting,nls

For nls you have to specify the parameters more carefully. Also, you probably don't want to use log(y), because that will plot the logarithm instead of y. My guess is that you want to use something like y ~ exp(a + b * x). See below for an example. ggplot(df,...

python,numpy,interpolation,curve-fitting,data-fitting

Well to perform fitting the answer provided in the link you have given is good enough. But since you say you find it difficult I have an example code with data in the form a sine curve and a user defined function that fits the data. Here is the code:...

python,scipy,curve-fitting,data-fitting

This is very well within reach of scipy.optimize.curve_fit (or just scipy.optimize.leastsqr). The fact that a sum is involved does not matter at all, nor that you have arrays of parameters. The only thing to note is that curve_fit wants to give your fit function the parameters as individual arguments, while...

matlab,line,data-modeling,correlation,data-fitting

It would be easier to diagnose with a sample dataset. At a guess, the problem is that your first line should be: maxx = max(X); minx = min(X); The way you had it minx=min(Y) distorts your fitx and fity values Edit: Thank you for submitting the sample data. What you...

matlab,octave,curve-fitting,data-fitting

Your function y = a(0.01 − b*n−cx) is in quite a specific form with 4 unknowns. In order to estimate your parameters from your list of observations I would recommend that you simplify it y = β1 + β2β3x This becomes our objective function and we can use ordinary least...

python,python-2.7,python-2.x,integral,data-fitting

You could, for instance, separately define the integrand function, def debye_integrand(x, n): return x**n/((np.exp(x) - 1)*(1 - np.exp(-x))) and then use scipy.integrate.quad to do this integration numerically, from scipy.integrate import quad def debye_func(p, T, r): # [...] the rest of your code from above here err_debye = r - rho0...

matlab,correlation,curve-fitting,data-fitting

As am304, with such a data set I would strongly suggest to fit you data initially in the Y-X referential, then only calculate the equivalent in the X-Y referential if you really need the polynomial coefficients this way. One very useful function (I use it extensively) in the curvefit toolbox...

You must find appropriate starting values to get a correct fit, because that kind of fitting doesn't have one global solution. If you don't define a and b, both are set to 1 which might be too far away. Try using a = 100 b = -3 for a better...