Skip to main content
How are we doing? Please help us improve Stack Overflow. Take our short survey
Filter by
Sorted by
Tagged with
1 vote
1 answer
67 views

I have a chemometrics project where I need to put Raman Spectroscopy data files into a Multivariate Curve Resolution model. I have been given .CNF files which came off the instrument, converted into ....
Jml's user avatar
  • 13
2 votes
1 answer
94 views

In order to solve a weigthed linear regression (with x and y weights), I converted the explicit to implicit expression. We are given (xmean,xstd) , (ymean,ystd) each 1d of length n. The error is given ...
pas-calc's user avatar
  • 170
0 votes
1 answer
46 views

I'm working with DolphinDB and trying to compute weighted least squares (WLS) regression between multiple pairs of columns in a table. The mslr function (moving least squares regression) works ...
Stella.W's user avatar
0 votes
0 answers
19 views

I have a table “clean_factor“ where the column “y“ indicates the stock returns and the subsequent columns indicate factor exposures. How do I calculate the daily residual return of each stock with the ...
smile qian's user avatar
0 votes
0 answers
31 views

I'm trying to fit data to a bidirectional exponential gaussian function (equation below) using lmfit. The equation has four variables: center, amplitude, sigma, and gamma. The first three are always ...
Joshua Derrick's user avatar
0 votes
0 answers
66 views

I am implementing the least squares monte carlo method to price american put (and maybe call) options in the 4/2 stochastic volatility process. For this I generate paths first and then I want to use ...
fireman1993's user avatar
2 votes
0 answers
49 views

I am trying to replicate an eviews code in Python. I need to fit a regression with a constant, some endogeneous variables that I instrumentalize and some exogeneous variables. The dependant variable ...
user20587286's user avatar
3 votes
1 answer
159 views

I have a linear algebra problem that I can't find the correct function for; I need to find the vector x that satisfies Ax = b. Because A is non-square (there's 5 columns and something like 37 rows), ...
Arcaeca's user avatar
  • 281
0 votes
1 answer
46 views

I have three sets of data (x,y) that define unique lineshapes. Using linear combination fitting I want to fit these three lineshapes to a fourth. I can set up the simple code below: #read in data (...
Anme's user avatar
  • 35
0 votes
1 answer
111 views

I have written visual basic code to determine the r square when fitting data using different order polynomials: Linear 2nd order polynomial 3rd order polynomial As an example, I have used the ...
Daniel Louw's user avatar
0 votes
1 answer
64 views

I have this Matlab code that create a sinusoidal fit from a set of data data = importdata('analisipicco.txt') ; x = data(:,1) ; y = data(:,2) ; yu = max(y); yl = min(y); yr = (yu-yl); ...
Jack_01's user avatar
  • 39
0 votes
0 answers
36 views

I am working on an OLS regression problem where: The dependent variable (target) ranges from 1 to 6 (with steps of 1). The independent variables range from 1 to 10 (with steps of 0.5). I want to set ...
ASD's user avatar
  • 47
2 votes
1 answer
154 views

I was trying to fit a data set into a sinusoidal function with the code below: data = importdata('analisipicco.txt') ; x = data(:,1) ; y = data(:,2) ; yu = max(y); yl = min(y); yr = (yu-yl); ...
Jack_01's user avatar
  • 39
1 vote
1 answer
118 views

Consider three (complex) square matrices A, X, and B, that form a generally underdetermined linear system A @ X - X @ A == B The system is to be solved for X. I would like to use, e.g., the lstsq ...
Ben's user avatar
  • 539
1 vote
2 answers
184 views

I'm trying to generate a decent [3,1] rational least squares polynomial approximation to asin(x)+sqrt(1-x^2) on [0,1] and failing dismally :( The problem is that it has a pole for this particular ...
Martin Brown's user avatar
  • 3,636
0 votes
0 answers
422 views

Is this a bug, or is there something fundamental I'm missing with how to use cvxpy? Consider this code for a least squares optimisation for a 3 variable vector with 3 measurements: import scipy import ...
Charlie's user avatar
  • 469
1 vote
0 answers
34 views

I wanted to use excel function (REGLINW) in php code to calculate extrapolated. I tried to use the LeastSquares function (https://php-ml.readthedocs.io/en/latest/machine-learning/regression/least-...
Dariusz Rup's user avatar
0 votes
0 answers
68 views

So basically I wanted to make my own function to fit a curve given a dataset. I generally applied the least square method for the types polynomial, exponential and logarithmic but I noticed that this ...
Giovanni Paiela's user avatar
0 votes
0 answers
44 views

I'm currently trying to unfold the neutron spectrum using Bonner spheres spectrometry (which is essentially an under-determined problem). I have been using least_squares from scipy.optimize but I'm ...
Hitman01's user avatar
1 vote
1 answer
108 views

I have data x and y , want to fit one part with power_fit and other part with negative power_fit settling to zero finally and start from some -20nm with some 5nF values and goes down after that minima ...
user97975's user avatar
0 votes
1 answer
138 views

I'm trying to fit modeling data as a curve using Scipy's optimize curve_fit to some scattered data, but I got a negative value of (bX) parameter that makes no sense. So I'm not sure what is wrong with ...
yusra zabarmawi's user avatar
0 votes
1 answer
100 views

I am trying to implement a multi-frequency phase unwrapping algorithm using Python3 and NumPy. I have 7 single channel (gray scale) images of shape (1080, 1920). After stacking them along the third ...
Arun's user avatar
  • 2,528
0 votes
1 answer
129 views

I am working on a small proof/demonstration of how the least squares method gives us the arithmetic mean. Wolfram Language 14.0.0 Engine for Microsoft Windows (64-bit) Copyright 1988-2023 Wolfram ...
William John Holden's user avatar
1 vote
3 answers
276 views

I am trying to solve a system of non-linear equations using Python (under-expanded jet with losses - Molkov): I am trying to use the library Scipy and the module fsolve: def equations10(p): u3, ...
Guillaume THIRIET's user avatar
0 votes
0 answers
79 views

I was trying to do a multi variate linear regression using a set of data. I tried to predict the Y using the same set of X used to generate the regression coefficients. While the differences between ...
The Emerging Star's user avatar
1 vote
1 answer
169 views

The following code generate different results depending on the order of the inputs I pass on. Why is that? I'd expect least square optimization to reach same result no matter what order the inputs are ...
Mth Clv's user avatar
  • 667
3 votes
1 answer
228 views

Once I get some 3-D point coordinates, what algorithm do I use to fit an optimal cylindrical and get the direction vector and radius of the central axis? My previous idea was to divide a cylinder ...
jwTTy's user avatar
  • 35
0 votes
0 answers
95 views

I'm running a generalised least squares (gls) to model BMI trajectories with age by intake of a nutrient. My sample is a cohort of twins, so data are clustered within individuals (twinID; due to ...
Gaby Heuchan's user avatar
0 votes
0 answers
21 views

As a Phd Student, working on non-linear problem i try to find solutions, with physical meanings over the following system: Input variables are A, B, Cf, Jp, ks, Pp, R,T. Output variables are : Jw,Js,...
Mich's user avatar
  • 1
0 votes
1 answer
141 views

import numpy as np f = np.array( [481.62900766, 511.94542042, 647.40216379, 686.10402156, 849.9420538, 888.64398048, 1029.26087049, 1071.18799217, 1210.51481107, 1266.63254274, 1409.54282743]...
Dženan's user avatar
  • 3,425
1 vote
1 answer
106 views

This is my data: [[1.0183786345931547, 1.0299586760768078, 1.038641346963767, 1.0450398412805133, 1.194598528164483], [1.0498980141678536, 1.0740481275807727, 1.101990429736493, 1.1528998376687427, 1....
Ladislav Révay's user avatar
2 votes
0 answers
128 views

I have some sparse system of which I know the structure. I implemented a naïve sparse matrix / vector product, which has no informations on the structure of the matrix, and a version of that product ...
Roco Le Coquelicot's user avatar
1 vote
2 answers
582 views

I am running the least_squares optimization fit my data against measured values. I have created a cost function and all function parameters seem to be fine, but the result is the exact same as the ...
Mukundh Balabhadra's user avatar
0 votes
0 answers
99 views

I have a matched employer-employee data set with 20 years of information on around 2.000.000 individuals and 400.000 firms. Amongst several worker- and firm-level covariates, I have worker, firm and ...
lisbonscot's user avatar
1 vote
0 answers
101 views

Imagine that you have a bunch of points in R3, each with a value (say, temperature). You want to construct a regular grid in R3 and compute a value at each grid point, such that if you then use ...
Andrew Certain's user avatar
0 votes
1 answer
128 views

I want to fit these 4 parameters: K0 = np.array([K11, K12, K21, K22]) In from the coupled equations f(x, parameters) and g(x, parameters) We could think those equations are normalized and have a ...
coffeedealer's user avatar
1 vote
1 answer
479 views

I am trying to do a weighted least squares fit of my data. The values when x=0 and when x>0.2 should be weighted heavily. The values when 0<x<=0.2 should be weighted to a lesser extent but I ...
jim_athon's user avatar
0 votes
3 answers
465 views

I am trying to plot arrows from each data point towards the line in the graph using matplotlib. I want the arrow to represent the distance between each point and the line. How can I do this? Here's ...
Alexander Obidiegwu's user avatar
0 votes
1 answer
367 views

I am trying to solve the equation y=a*x. I have three measurements for x (x1,x2,x3) and y (y1,y2,y3) and am trying to find "a" ( the slop). The first important thing is that y and X are ...
SAHAR GOHARSHENASAN's user avatar
0 votes
1 answer
186 views

I'm getting not very fitted 2D-plane with such a code: import numpy as np from scipy import linalg as la from scipy.linalg import solve # data f1 = np.array([1., 1.5, 3.5, 4.]) f2 = np.array([3., 4.,...
JeeyCi's user avatar
  • 645
-1 votes
1 answer
681 views

I am trying to do a NDVI double logistic curve fit in Python. This double logistic curve fitting is published by Beck et al. 2006. There is a R package greenbrown which does this over a year, so far I ...
Damiaan van Harteveld's user avatar
1 vote
2 answers
3k views

I am very new to coding and I basically only use it for physics related stuff. I have recently been trying to fit an ellipses with data that I have but I have not gotten any result that resembles the ...
user avatar
1 vote
1 answer
715 views

Context: I solve the equation A_des.x = b where I find x through a least-squares method. I have to do this operation several thousands of time. A_des changes between each iteration but remains sparse (...
Nihilum's user avatar
  • 721
0 votes
0 answers
86 views

I am not proficient in statistics. Following a thread: How to compute standard deviation errors with scipy.optimize.least_squares, I got my std to be std = np.sqrt(np.diagonal(np.linalg.inv(J.T @ J) * ...
Cal Ng's user avatar
  • 1
0 votes
1 answer
604 views

Consider: Curve fit using Python SciPy I'm trying to find an algorithm to fit a sine curve into a data set. This is quite simple using Python SciPy, but now I have to bring the whole algorithm to an ...
Huy Pham's user avatar
3 votes
2 answers
237 views

I am trying to minimize a the sum of least squares subject to certain constraints. For the most part, this problem seems fairly straightforward except for one constraint. I'm having a difficult time ...
Ted S's user avatar
  • 31
0 votes
0 answers
585 views

I am trying to solve a nonlinear least squares problem using Scipy's minimize-function in Python. The model is very complicated and (typically) depends on 14 parameters. Thus, I and many symbolic ...
mathslover's user avatar
1 vote
1 answer
118 views

I am working with a use-case where getting the coefficients in the ballpark of the OLS coefficients is important. What I have below is reproducible code and data which runs through OLS and two ...
Alex's user avatar
  • 2,858
1 vote
1 answer
182 views

I'm using scipy.optimize.least_square to try to minimize the residual of function. Here is the code: def solido_3parameters(time, strain0, eta1, time0, stiffness2, eta): return strain0 + (sigma0 / ...
Manu_sab's user avatar
1 vote
2 answers
698 views

I have a dataset to which I want to fit a nth degree univariate polynomial in a least squares fashion. The resulting polynomial should be monotonically increasing for all real numbers, not just the ...
user999605's user avatar

1
2 3 4 5
21