curve-fitting

How to estimate confidence-intervals beyond the current simulated step, based on existing data for 1,000,000 monte-carlo simulations?

How to estimate confidence-intervals beyond the current simulated step, based on existing data for 1,000,000 monte-carlo simulations? Question: Situation: I have a program which generates 600 random numbers per "step". These 600 numbers are fed into a complicated algorithm, which then outputs a single value (which can be positive or negative) for that "step"; let’s …

Total answers: 1

Integrating and fitting coupled ODE's for SIR modelling

Integrating and fitting coupled ODE's for SIR modelling Question: In this case, there are 3 ODE’s that describe a SIR model. The issue comes in I want to calculate which beta and gamma values are the best to fit onto the datapoints from the x_axis and y_axisvalues. The method I’m currently using is to integrate …

Total answers: 2

scipy curve_fit incorrect for large X values

scipy curve_fit incorrect for large X values Question: To determine trends over time, I use scipy curve_fit with X values from time.time(), for example 1663847528.7147126 (1.6 billion). Doing a linear interpolation sometimes creates erroneous results, and providing approximate initial p0 values doesn’t help. I found the magnitude of X to be a crucial element for …

Total answers: 2

Python with dataframe sales values – forecast next value with numpy.polyfit?

Python with dataframe sales values – forecast next value with numpy.polyfit? Question: I have this dataframe: sales 0 22.000000 1 25.000000 2 22.000000 3 18.000000 4 23.000000 and want to ‘forecast’ the next value as a simple numeric to pass it on easily to another code. I thought numpy.polyfit could do that, but not sure …

Total answers: 1

How do I code dose-response (4PL) curve fitting with optimize.minimize()

How do I code dose-response (4PL) curve fitting with optimize.minimize() Question: I want to optimize a dose-response curve (4 parameter logistic) using a data set. I need to use the Powell algorithm, therefore, I have to use optimize.minimize() instead of curve_fit or least square. I wrote the following code: import numpy as np from scipy.optimize …

Total answers: 2

python fitting curve with integral function

python fitting curve with integral function Question: I would like to fit data with integral function(truncated gamma distribution). I tried following code, but errors occur. I am appreciate if you would kind help me. Thank you very much in advance. %matplotlib inline import numpy as np from scipy import integrate import scipy.optimize import matplotlib.pyplot as …

Total answers: 1

Fixing fit parameters in curve_fit

Fixing fit parameters in curve_fit Question: I have a function Imaginary which describes a physics process and I want to fit this to a dataset x_interpolate, y_interpolate. The function is a form of a Lorentzian peak function and I have some initial values that are user given, except for f_peak (the peak location) which I …

Total answers: 3

Fit 3D Polynomial Surface with Python

Fit 3D Polynomial Surface with Python Question: I have a python code that calculates z values dependent on x and y values. Overall, I have 7 x-values and 7 y-values as well as 49 z-values that are arranged in a grid (x and y correspond each to one axis, z is the height). Now, I …

Total answers: 2