data-fitting

How to find probability distribution and parameters for real data? (Python 3)

☆樱花仙子☆ 提交于 2019-12-17 17:32:10
问题 I have a dataset from sklearn and I plotted the distribution of the load_diabetes.target data (i.e. the values of the regression that the load_diabetes.data are used to predict). I used this because it has the fewest number of variables/attributes of the regression sklearn.datasets . Using Python 3, How can I get the distribution-type and parameters of the distribution this most closely resembles? All I know the target values are all positive and skewed (positve skew/right skew). . . Is there

Getting standard errors on fitted parameters using the optimize.leastsq method in python

你离开我真会死。 提交于 2019-12-17 05:36:22
问题 I have a set of data (displacement vs time) which I have fitted to a couple of equations using the optimize.leastsq method. I am now looking to get error values on the fitted parameters. Looking through the documentation the matrix outputted is the jacobian matrix, and I must multiply this by the residual matrix to get my values. Unfortunately I am not a statistician so I am drowning somewhat in the terminology. From what I understand all I need is the covariance matrix that goes with my

plot 3D line, matlab

岁酱吖の 提交于 2019-12-13 12:30:38
问题 My question is pretty standard but can't find a solution of that. I have points=[x,y,z] and want to plot best fit line. I am using function given below (and Thanx Smith) % LS3DLINE.M Least-squares line in 3 dimensions. % % Version 1.0 % Last amended I M Smith 27 May 2002. % Created I M Smith 08 Mar 2002 % --------------------------------------------------------------------- % Input % X Array [x y z] where x = vector of x-coordinates, % y = vector of y-coordinates and z = vector of % z

Power Law Fit of cut-off distribution with the poweRlaw package

最后都变了- 提交于 2019-12-12 18:36:20
问题 I am currently trying to find a way to calculate a power-law fit for a cut-off distribution with MLE. The distribution looks as follows: As you can see, I was able to fit the whole distribution (Power-law fit) and also the lower bound (exp-fit) separately. What I am failing to figure out, is how to fit the upper bound of the distribution (f.e. 8 < x < 100). Is there any way to do this with the poweRlaw package or any other R package? What I am hoping for is something looking like this (note:

gnuplot: Plot and fit 2d function with two variables

前提是你 提交于 2019-12-12 16:43:42
问题 Is its possible in gnuplot to plot and fit a function that has two variables? For example, a physical function that depends on hight h and Temperature T where the T dependence should only be calculated but not plotted (for f , h and T experimental data exists): f(h,T) = a * h * (1 + alpha * T) + f0 where a and f0 are to be determined by the fit, alpha is known. In the end I need a plot with f on the y-axis and h on the x-axis. The whole T dependence should be taken care of in the fit, but I

Fitting a student t distribution in R using fitdistr() yields error “non-finite finite-difference value”

余生颓废 提交于 2019-12-12 06:09:24
问题 Reproducable example which will give the mentioned error code every time is: (Note that even without set.seed, the error comes up every time) library(MASS) set.seed(seed = 1) data<-rnorm(n = 10000,mean = 0.0002,sd = 0.001) fitdistr(x = data,densfun = "t") The error message is: Error in stats::optim(x = c(-0.000426453810742332, 0.000383643324222082, : non-finite finite-difference value [2] In addition: Warning message: In log(s) : NaNs produced The problem is the "non-finite finite-difference

How to find coefficients for a possible exponential approximation

爷,独闯天下 提交于 2019-12-12 05:39:05
问题 I have data like this: y = [0.001 0.0042222222 0.0074444444 0.0106666667 0.0138888889 0.0171111111 0.0203333333 0.0235555556 0.0267777778 0.03] and x = [3.52E-06 9.72E-05 0.0002822918 0.0004929136 0.0006759156 0.0008199029 0.0009092797 0.0009458332 0.0009749509 0.0009892005] and I want y to be a function of x with y = a(0.01 − b*n^−cx). What is the best and easiest computational approach to find the best combination of the coefficients a , b and c that fit to the data? Can I use Octave? 回答1:

How to guess the actual lorentzian function without relaxation behavior with Least square curve fitting

守給你的承諾、 提交于 2019-12-12 05:26:58
问题 I wanted to ask you if it would be possible to implement this idea: So all in all, I measure a signal (blue curve, See plot of the measured data and the initial guess for the lorentzian function), this signal is a convolution of a lorentzian function and a certain relaxation kernel. I have an initial guess of the lorentzian function (see green curve), but as you notice, the green curve is not really aperfect lorentzian function , as it is still dissymmetric in the bottom. I have never used

Three-term gaussian fit to gaussian data (python)

我是研究僧i 提交于 2019-12-12 03:45:55
问题 I am trying to fit a gaussian data to a specific three-term gaussian (in which the amplitude in one term is equal to twice the standard deviation of the next term). Here is my attempt: import numpy as np #from scipy.optimize import curve_fit import scipy.optimize as optimize import matplotlib.pyplot as plt #r=np.linspace(0.0e-15,4e-15, 100) data = np.loadtxt('V_lambda_n.dat') r = data[:, 0] V = data[:, 1] def func(x, ps1, ps2, ps3, ps4): return ps1*np.exp(-(x/ps2)**2) + ps2*np.exp(-(x/ps3)**2

Polyfit for two variables

南楼画角 提交于 2019-12-12 02:26:30
问题 I have a kind of data and want to find the equation(poly coeff) of given data. For example equation for given sample data is simple a^2*b+10 a\b 5 10 15 ________________________ 3| 55 100 145 4| 90 170 250 5| 135 260 385 6| 190 370 550 I checked for polfit but It only works for one variable. 回答1: As Dusty Campbell pointed out you can use the fit function. To do this you have to build a mesh with your data a = [3 4 5 6]; b = [5 10 15]; [A, B] = meshgrid(a, b); C = (A.^2).*B + 10; and then call