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
1 answer

Upper constraints for nls parameters

I have the following code to fit a sigmoidal function to my data: nlsLM(mepAMP ~ plateau / (1 + exp(slope*(S50 - pMSO))), data = df, start = list(plateau = 7, S50 = 100, slope = 0.15) From my understanding, nlsLM (much like base nls…
A.R.
  • 51
  • 5
0
votes
1 answer

Perform non-linear regression on data from a table with single x column and several y columns in R

I have a data table with experimental data which i want to non-linear fit. The Data consist in a table with the first column containing the x values, all the next columns contain y data from different measurements. there are 2 parameters which i…
ChrisO
  • 1
  • 2
0
votes
1 answer

Extract model parameters for nls model using for loop and graph results

I have a group of 10 subjects (using a subset of 3 of them below as a sample dataset). I have managed to create a for loop that runs through the 3 subjects and fits each one to a sigmoidal curve using nlsLM (package minpack.lm). nlsLM is the same as…
A.R.
  • 51
  • 5
0
votes
0 answers

R_: nls with constraints on a sum of parameters

I am trying to use the minpack.lm package to fit a non linear model to data with a constrain on the sum of two parameters. Here A_b+A_s<1, A_b>0, A_s>0 and k>0 are the constraints I want to optimize for, thus the log(A_b + A_s) and log(1 - (A_b +…
0
votes
0 answers

How to fit a nonlinear regression with coupled equations

I want to use nls to fit some experimental data to this equation: Model <- as.formula (F ~ (dhg*K1*G+dhg2*K1*K2*G^2)/(1 + K1*G+K1*K2*G^2) - d0) but G has been obtained from: K1*K2*G^3*+K1*(2*K2*Ht-K2*Gt.M+1)*G^2+K1*(Ht-Gt.M)+1*G-Gt = 0 Is there…
0
votes
1 answer

How to fit a bi-Gaussian curve?

I would like to fit a bi-gaussian curve to my data, which is basically a normal distribution with two different standard deviations (two different sigma values). How can I do that with NLS? What I am mainly interested in is the centre of these…
reload
  • 21
  • 3
0
votes
1 answer

How can I apply a curve fitting function over different columns' levels in a data frame?

Given the data frame df: (time <- rep(c(1:9),9)) (test <- rep(c(1:3),3, each = 9)) (specie <- rep(c("Lbcasei", "Lbparacasei", "Lbrhamnosus"), each = 27)) (OD <- rep(c(runif(4,min=0, max=0.4), runif(1,min=0.4, max=0.6), …
betterL
  • 13
  • 4
0
votes
0 answers

How to solve the unable to find inherited method for function for signature "nls"?

How to solve the unable to find inherited method for function for signature "nls"? When using the nls function this problem appears constantly. R is not able to summarize it in this case I've been trying to fit my data points with the formula showed…
luqu
  • 1
0
votes
0 answers

R nls function predicts data well but returned fitting coefficients are totally off

I am trying to fit electrophysiological data with a Boltzmann functon. When using real data, the predicted values returned by the nls function nicely match the input data, however, the retuned fitting coefficients are totally off. I first tested my…
0
votes
1 answer

Unexpected end of input error when trying to mimic lsqnonlin of MATLAB with nlsLM in R

I am trying to solve a quite straight forward non linear least squares problem where the formulation takes 'so to say' a vector of zeroes as dependent variable because I am only interested in the parameters of the minimization for a prediction…
LuSm
  • 31
  • 3
0
votes
0 answers

Including Time Effects in NLS() in R

I have the following problem and really appreciate any help: I have a dataset consisting of financial data across firms over time (unbalanced panel data). I need to run this regression equation: enter image description here Since I want to use the…
Marco_R
  • 1
  • 1
0
votes
1 answer

non-linear least squares fitting: parameters without starting value

I am working on rate measurements (y) over a range of temperatures (x), and i would like to curve-fit the scatterplot using the nls command. However, the fitting does not initialize, since the algorithm is apparently missing some starting values.…
SeRo1210
  • 13
  • 4
0
votes
1 answer

How can I fit a logarithmic model to my data in R? nls and lm functions keep returning linear fit and I don't know why

I need to fit a model to some data pH ~ DIC. See data plotted below: y axis = pH, x axis = DIC (dissolved inorganic carbon) First I ran a linear regression using lm, but it seems clear that a non-linear model would be a more accurate fit. I tried a…
0
votes
0 answers

How do I increase the number of evaluation points in stat_smooth for ggplot2 in R?

I am fitting one of my data using stat_smooth in ggplot. Here is the brief of the code: library(ggplot2) my.data <- fread('data.txt',header=T,na.strings=c("")) my_exp_formula <- y ~ a * exp(b*x) ggplot(my.data, aes(x=x, y=y, colour=CA, group=CA))…
user3132983
  • 65
  • 1
  • 5
0
votes
0 answers

NLS-estimated Discrete Bass Model (Satoh 2001)

This is the Satoh(2001) discrete analog of the Bass model. I am using it to estimate a cumulative diffusion pattern from 19 years of data. (Renewable energy source diffusion in professional sport stadia). My question surrounds the exponent (t/2)…
Liz W
  • 1
  • 1