Questions tagged [non-linear-regression]

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.

732 questions
3
votes
2 answers

Scipy curve_fit gives wrong answer

I have an oscillating data as shown in the below figure and want to fit a sine curve to it. However, my result is not correct. The function that I want to fit to this curve is: def radius (z,phi, a0, k0,): Z = z.reshape(z.shape[0],1) k =…
3
votes
1 answer

How to eliminate variables with p value > 0.7 before computing stepwise polynomial regression?

I am trying to run a stepwise regression using AIC (through step) with 1,400 variables, but my computer just freezes. It works if I include <300 variables (after 13 hrs of running). Is there a way to eliminate some of the variables (if p-value >.7)…
3
votes
1 answer

Run nonlinear (nls) regression that contains summation in R

I'm trying to run a nonlinear regression of the form y_i = sum_t(x_{it}^b) on the following (simplified) dataset: require(dplyr) set.seed(2019) df <- data.frame(t = rep(1:4, each = 4), x = sample(1:16, replace=F)) df <- df…
3
votes
1 answer

Compute and plot tangent lines along a curve produced by polynomial regression using np.polyfit

A curve is fitted to a data series using np.polyfit and evaluated with np.polyval to plot as: How do I compute a tangent line at a point on the curve, and how to animate a series of tangent lines along the curve with x and y values in the…
artDeco
  • 470
  • 2
  • 8
  • 21
3
votes
2 answers

Convergence of a very large non-linear least squares optimization

I'm trying to solve the following problem: I have a lot (~80000) surface patches of an organ that's growing. I measure each of its areas over time (18 time-points) and want to fit a growth curve to it (bi-logistic model, eg. just the sum of two…
3
votes
3 answers

Fitting a non-linear univariate regression to time-series data in Python

I've recently started machine learning using python. Below is a dataset I picked up as an example along with the codes I've worked on till now. Chosen [2000....2015] as the test data and train data [2016, 2017]. Dataset Years Values …
3
votes
1 answer

nonlinear regression prediction in R

I am confused by this warning message as I try to fit my data with a nonlinear regression model by using the drc package and drm function. I have N_obs <- c(1, 80, 80, 80, 81, 82, 83, 84, 84, 95, 102, 102, 102, 103, 104, 105, 105, 109, 111, 117,…
yearntolearn
  • 1,064
  • 2
  • 17
  • 36
3
votes
1 answer

Knn Regression in R

I am investigating Knn regression methods and later Kernel Smoothing. I wish to demonstrate these methods using plots in R. I have generated a data set using the following code: x = runif(100,0,pi) e = rnorm(100,0,0.1) y = sin(x)+e I have been…
Ben
  • 33
  • 1
  • 5
3
votes
1 answer

Nonlinear logistic regression package in R

Is there an R package that performs nonlinear logistic regression? In more words: I have glm, with which I can go glm (cbind (success, failure) ~ variable 1 + variable2, data = df, family = binomial (link = 'logit')), and I can use nls to go nls (y…
Pedro Carvalho
  • 565
  • 1
  • 6
  • 26
3
votes
1 answer

Non-linear curve-fitting program in python

I would like to find and plot a function f that represents a curve fitted on some number of set points that I already know, x and y. After some research I started experimenting with scipy.optimize and curve_fit but on the reference guide I found…
fdev
  • 87
  • 1
  • 7
3
votes
2 answers

Fit spline through scatter

I a have two sets of data of which I want to find a correlation. Although there is quite some scattering of data there's obvious a relation. I currently use numpy polyfit (8th order) but there is some "wiggling" of the line (especially at the…
Yorian
  • 2,002
  • 5
  • 34
  • 60
3
votes
1 answer

Strange behavior of the effects command of mlogit in R

I am estimating a multionomial logit model and would like to report marginal effect. I am running into a difficulty, as when I am using a larger version of the model I get an error. Here is an reproducible example. The following code, with two…
splinter
  • 3,727
  • 8
  • 37
  • 82
3
votes
0 answers

Matlab find percentile curve of a set of scatter points

I have a set of scatter points. They are height of sixty plants (cm) over time(days). I measure each of them for three times (days:~10, ~50, ~100)But some of the plants does not have the second or/and third measurement yet. Here are the small…
Cii
  • 133
  • 8
3
votes
1 answer

Plotting variance of fit as smooth filled area

There was an excellent answer to a similar question here but I'm interested in adapting it to plot fit results. Specifically, if I have non-linear data that I'm attemting to fit with mm(x) = (V*x)/(x+Km) fit mm(x) "mm data.txt" u 1:2:3 via…
3
votes
1 answer

Parameter and initial conditions fitting ODE models with nls.lm

I am currently trying to fit ODE functional responses using the Levenberg-Marquardt routine (nls.lm) in pkg-minpack.lm following the tutorial here…
Hong
  • 31
  • 5