In statistics, nonlinear regression is a form of regression analysis in which observations are modeled by a function which is a nonlinear combination of the model parameters and depends on one or more independent variables.
Questions tagged [non-linear-regression]
732 questions
4
votes
1 answer
Resolving minFactor error when using nls in R
I am running nls models in R on several different datasets, using the self-starting Weibull Growth Curve function, e.g.
MOD <- nls(Response ~ SSweibull(Time, Asym, Drop, lrc, pwr), data = DATA)
With data like this, it works as expected:
GOOD.DATA…

EcologyTom
- 2,344
- 2
- 27
- 38
4
votes
1 answer
How to calculate 95% prediction interval from nls
Borrowing the example data from this question, if I have the following data and I fit the following non linear model to it, how can I calculate the 95% prediction interval for my curve?
library(broom)
library(tidyverse)
x <- seq(0, 4, 0.1)
y1 <- (x…

FMM
- 1,857
- 1
- 15
- 38
4
votes
1 answer
How to use the 'weights' in the nls (non-linear least squares) function in R?
My question is on how to correctly interpret (and use) the 'weights' input variable in the nls function of R for non-linear weighted least squares regression.
The solution for solving the unknown parameters in weighted least squares theory is:
From…

user121
- 849
- 3
- 21
- 39
4
votes
1 answer
Separating points/clusters with a line
Context: I want to create an interactive heatmap with areas separated by a ZIP code. I've found no way of displaying it directly (i.e. using Google Maps or OSM), so I want to create curves or lines that are separating those areas, and visualize it…

zdevaty
- 621
- 1
- 8
- 16
4
votes
1 answer
Over fitting in scipy non linear curve fit
I have a model equation let's call it eq_m:
that I know my dataset follows, I am trying to fit my data to eq_m so that I can use the fitted parameters to predict new data.
However this eq_m is non linear hence I used scipy's curve_fit to get the…

user3787932
- 41
- 1
- 2
4
votes
3 answers
"Error in ... %*% ... : non-conformable arguments" using own function in regression
I have a function Q(x|delta): R^n --> R for which I would like to fit a nonlinear quantile regression. The function Q(.) uses some matrix operations and it would be very complicated to do not use it. The problem is that it seems that the nlrq…

ThiagoSC
- 69
- 1
- 9
4
votes
1 answer
R Error: parameters without starting value
Non linear real world data, n=2,600
SAMPLE
X values 71.33 74.98 80 85.35 90.03
Y values 119.17 107.73 99.72 75 54.59
I manually graphed a formula for a starting point,
formula: y = b/x^2+a
manual: y = 800000/x^2-39.5
sum of…

aSportsguy
- 51
- 1
- 3
4
votes
1 answer
How can I do ordinal regression using the mord module in python?
I am trying to predict a label based on some features and I have some training data.
Searching for ordinal regression in python, I found http://pythonhosted.org/mord/ but I could not figure out how to use it.
It would be great if someone has an…

Fate
- 75
- 1
- 9
3
votes
0 answers
Using predict() with nlmer
I have this data set:
library(data.table)
my_data <- data.table(group=rep(c("a", "b"), each=50),
x=c(11:60, 11:60),
y=c(exp(0.1)*(11:60)+rnorm(50),
exp(0.3)*…

user13424
- 111
- 1
- 4
3
votes
1 answer
Next Steps with nls()?
Working in R, I am trying to use nls() to fit some data to the following model:
y ~ c - a * exp(-b * x)
My data:
x <- c(8, 8, 10, 10, 10, 10, 12, 12, 12, 12, 14, 14, 14, 16, 16, 16, 18, 18, 20, 20, 20, 22, 22, 22, 24, 24, 24, 26, 26, 26, 28, 28,…

Scoops
- 61
- 4
3
votes
2 answers
Fitting a polynomial with numpy changes with dtype, even though actual data values remain the same
I have a dataset comprised of xdata and ydata that I want to fit a polynomial to, but for some reason, the fitting results depend on the dtype of the dataset, even though the actual values of the data remain unchanged. I understand that if you…

mapf
- 1,906
- 1
- 14
- 40
3
votes
1 answer
Python Gekko - Constrained are getting violated although i have an optimal solution
Let me start by saying that I am an absolute beginner in Linear Programming and Python Gekko.
I was laying laminate in my friend's house and I thought it would be cool to write a program such that the laminate is laid in as optimal configuration as…

GeneticSmart
- 93
- 2
- 10
3
votes
0 answers
Perform nonlinear regression with nlsLM within a function in r
I want to add a modification factor to an existing equation to fit data. The original equation is defined through a function because the variable N_l is a vector of numbers and the function is selecting the largest outcome of the equation by going…

Maral Dorri
- 468
- 5
- 17
3
votes
2 answers
How to perform nonlinear least squares with shared parameters in R?
I would like to perform nonlinear least squares regression in R where I simultaneously minimize the squared residuals of three models (see below). Now, the three models share some of the parameters, in my example, parameters b and d.
Is there a way…

Ramiro Magno
- 3,085
- 15
- 30
3
votes
1 answer
How to fit the polynomial regression line to the data
#plotting values
x_max = np.max(X) + 100
x_min = np.min(X) - 100#calculating line values of x and y
x = np.linspace(x_min, x_max, 1000)
y = b0 + b1 * x #plotting line
plt.plot(x, y, color='#00ff00', label='Linear Regression')#plot the data…

Stupid_Intern
- 3,382
- 8
- 37
- 74