Questions tagged [nls]

nls refers to nonlinear least-squares and is a function in R that allows to estimate the parameters of a nonlinear model.

nls should not be confused with nls-lang which is an environment variable for Oracle databases.

670 questions
1
vote
0 answers

Non linear regression by levels of several groups in R

Take the example of mtcars in R: I want to make a non linear regression for the relationship between mpg and disp with: nls(data=mtcars, mpg ~ A * disp^2 + B * disp + C, start=list(A=1,B=1,C=1)) But, I need to analyse the relationship for every…
Yang
  • 21
  • 1
1
vote
1 answer

nls convergence message in R

I am looking for a definition of the convergence messages from nls in R. In particular, what is the difference between relative convergence (4) and both X-convergence and relative convergence (5).
tony
  • 83
  • 1
  • 1
  • 7
1
vote
0 answers

How to estimate? "simple" Nonlinear Regression + Parameter Constraints + AR residuals

I am new to this site so please bear with me. I want to the nonlinear model as shown in the link: https://i.stack.imgur.com/cNpWt.png by imposing constraints on the parameters a>0 and b>0 and gamma1 in [0,1]. In the nonlinear model [1] independent…
1
vote
1 answer

AIC on nls on R

I have a problem to calculate the AIC. Indeed, I estimate the parameters of my 3 models: "mod_linear", which is a linear model and "mod_exp" and "mod_logis" which are two non linear models. I used the function…
Marambo
  • 57
  • 2
  • 7
1
vote
2 answers

`nls` fails to estimate parameters of my model

I am trying to estimate the constants for Heaps law. I have the following dataset novels_colection: Number of novels DistinctWords WordOccurrences 1 1 13575 117795 2 1 34224 947652 3 …
Saul Garcia
  • 890
  • 2
  • 9
  • 22
1
vote
1 answer

Fitting fractions of multivariate polynomial

How to fit the multivariate fractional polynomial of the following form: Given a function: y = f(x,z), a function of two variables x and z. More specifically it is of the form: y = (x^2 + x^3)/(z^2 + z^3) Numerator is a polynomial of a 3rd degree…
aza07
  • 239
  • 1
  • 6
  • 14
1
vote
1 answer

fit exponential or hockey stick decay

I'm trying to find an equation to fit my data. I recognize the shape to be y=-exp(x) but nls(y~-a*exp(x*b)) with various parameter start values fail. y is negative so the "easy" fit of log(y)~log(a)+bx doesn't work well. I tried log(y+2)~a+bx to…
Dominik
  • 782
  • 7
  • 27
1
vote
1 answer

Trouble applying NLS in R

I'm trying to apply a non-linear regression model for protein binding in R. Data are as follows: data$WT [1] 107.194364 95.986477 87.511449 74.028678 67.733609 [6] 52.117508 38.486519 24.197712 15.854248 8.641564 [11] 5.965327 …
G Tetley
  • 35
  • 3
1
vote
1 answer

Fitting parameters do not converge, but nlsLM() stops

In R, I'm trying to fit a series of data to a curve given by the theory, which is: y(x) = (1 + fitbeta * x)^(-fitgamma) In theory this should work and others have used this formula successfully. However, I cannot seem to make my fit parameters…
AF7
  • 3,160
  • 28
  • 63
1
vote
1 answer

error fitting function to data using nls

I have some issue using nls() to estimate parameters. I have a following set of functions to explain some data in hand: funk1 <- function(a,x) { x^2*exp(-(l*(1-exp(-r*a))/r)) } funk2 <- function(x) { sapply(x, function (s) { integrate(funk1,…
VitalSigns
  • 83
  • 2
  • 10
1
vote
1 answer

Cross-validation for non-linear regression using nls in R

The problem: I have a dataset inputAll.data. I want to use 80% of the data as model construction input and validate the model on the remaining 20% of data. I have manually split the dataset into two smaller datasets input80.data and input20.data…
Kajal
  • 581
  • 11
  • 24
1
vote
0 answers

R LPPL research reproduction singular gradient matrix

I'm trying to reproduce some research on the fitting LPPL on stock indices for bubble prediction and I'm having trouble with fitting the model to the data. I've been using the following papers for insight on this project:…
hdu
  • 31
  • 4
1
vote
0 answers

nls error during the parameter estimation of power law with exponential cutoff distribution in R

I want to fit mydata with several known distributions, power law with exponential cutoff distribution is one of the candidates. fitdistr function in package fitdistrplus is one of good methods to use for the parameter estimation using MLE, or MME,…
Ling Zhang
  • 281
  • 1
  • 3
  • 13
1
vote
1 answer

Failing to do fitting with non linear fitting methods (nlsLM, nlxb and wrapnls)

I have a nls fitting task that I wanted to do with R. My first attempt to do this here and as @Roland pointed out "The point is that complex models are difficult to fit. The more so, the less the data supports the model until it become impossible.…
Alexander
  • 4,527
  • 5
  • 51
  • 98
1
vote
1 answer

how R estimates/computes the std.error in summary() of a nls.lm model?

I'm using nls.lm() function to get a MODEL. Later, I write "summary(MODEL)" and I get the list of parameters, std.error... and others convergence and model details. The question is, someone knows how R computes these std.error (for each parameter)…
Sergio
  • 81
  • 9