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
0
votes
0 answers

Comparing nls model with different sample size

I'm running a nls.lm models on some data. It's a first order curve: Y1~Cr*(1 - exp(-Kr*X1)) which fits my data well up until a certain value of X1 when the model and data start to diverge. I want to run my model on incremental increases in my data…
chris20
  • 37
  • 1
  • 5
0
votes
1 answer

Geom_smooth: When groups added, number of iterations exceeded maximum of 50?

I am pretty new in modelling. I have three groups of data (by period), which I want to display by lines over scatter plot. I figured out how to put my method and formula in geom_smooth, and I am able to display a single line. However, when I want…
maycca
  • 3,848
  • 5
  • 36
  • 67
0
votes
1 answer

Optimized fitting coefficients for better fitting

I'm running a nonlinear least squares using the minpack.lm package. However, for each group in the data I would like optimize (minimize) fitting parameters like similar to Python's minimize function. The minimize() function is a wrapper around…
Alexander
  • 4,527
  • 5
  • 51
  • 98
0
votes
1 answer

Confidence Interval for Non Linear Regression Model

My data consist of two columns: time and cumulative number like below: time <- c(1:14) cum.num <- c(20, 45, 99, 195, 301, 407, 501, 582, 679, 753, 790, 861, 1011, 1441) My non linear function…
Nawa Raj
  • 111
  • 1
  • 7
0
votes
1 answer

Non linear fit in r

My data consist of two columns - time and cumulative number like below: time <- c(1:14) cum.num <- c(20, 45, 99, 195, 301, 407, 501, 582, 679, 753, 790, 861, 1011, 1441) My non linear function is: B/(B*C*exp(-A*B*time) + 1) My objective is to…
Nawa Raj
  • 111
  • 1
  • 7
0
votes
0 answers

Understanding Error in nls2 and as.lm functions

I was doing a fit of a function and I came across some problems related to the errors estimated by the methodology used. The function I was trying fit is y=o/(x*(x+t)^k) First of all, here is first part of the code including functions definitions to…
david clarck
  • 157
  • 2
  • 11
0
votes
1 answer

How is the Std Error in nls function calculated?

I'm trying to fit a theorical model to my data and the given values by fit for the parameters I want to find are good but the error (Std. Error) are very large, which causes the reliability of the adjustment to be lost How are these Std. Error…
david clarck
  • 157
  • 2
  • 11
0
votes
0 answers

Great values of std error in nls2 fitting

I'm trying to fit a theorical model to my data and the given values by fit for the parameters I want to find are good but the error (Std. Error) are very large, which causes the reliability of the adjustment to be lost I'd like to know if there is…
david clarck
  • 157
  • 2
  • 11
0
votes
1 answer

How to convert an nlfb object in a nls object

I performed an NLS regression using nlfb from the nlmrt package. With theta_scaled being my initial parameter vector > theta_scaled [1] 0.60000 0.73624 -0.77962 and residuals_function a function which for each parameter vector would…
DeltaIV
  • 4,773
  • 12
  • 39
  • 86
0
votes
1 answer

Error In R code in LPPL model in R

I am learning R and had problem when I try run LPPL using nls. I used monthly data of KLSE. > library(tseries) > library(zoo) ts<-read.table(file.choose(),header=TRUE) ts rdate Close Date 1 8/1998 302.91 0 2 9/1998 …
aaa
  • 1
  • 1
0
votes
2 answers

Hill Equation Curve Fitting NLS

I am trying to calculate rate for the following data. I tried Michaelis menten equation, however, Km was coming negative. I am now trying to fit hill equation, but I am getting error message. I think my starting values are not so good. Any help will…
Krina M
  • 135
  • 2
  • 13
0
votes
0 answers

Using R to fit: y ~ exp(-(x-x0)^a)

I trying to fit y ~ exp(-(x-x0)^a) to this data but get the error: "Error in nlsModel(formula, mf, start, wts) : singular gradient matrix at initial parameter estimates" Do anybody have a tip? x=c(0.612245, 0.47619, 0.857143, 0.535714, …
0
votes
1 answer

Using R to fit y ~ exp(-x^a)

I just started using nls I tried to fit y ~ exp(-x^a) : m<- nls(y ~ exp(-x^a),start=list(a=0)) It seemes to work fine :) My problem is that I want to get out "a" in order to write the value to a file. I can see the the value is 3.612 but how to…
0
votes
0 answers

Fitting an nls curve to experimental data and obtaining a fit parameter

I have an ideal curve dataset shown bleow. I made a nls model that describes the ideal dataset. I also have experimental data that I want to plot against the model to find a value for the fit. How do I do this? Caq q Langmuir 0 …
Valerie S
  • 917
  • 2
  • 7
  • 17
0
votes
0 answers

How to use robust Fitting of Nonlinear Regression Models in nlslm?

My goal is to estimate two parameters of a model (see CE_hat). I use 7 observations to fit two parameters: (w,a), so overfitting occurs a few times. One idea would be to restrict the influence of each observation so that outliers do not "hijack"…