# Questions tagged [nls]

nls is an R routine to fit nonlinear regression models of the form $y = f(x B) + e$

88 questions
Filter by
Sorted by
Tagged with
20 views

### fitting specific formula/model in r - model possibly not identifiable

I would like to fit the following formula in R: y ~ alpha *(x1_0 * x2_0 * beta_0 + x1_1 * x2_1 * beta_1) Here: alpha, ...
7 views

### fitting multiplicative non linear model in R

I have samples per month over several years (assuming stationary behavior). My data contains an independent variable: hours (representing available hours per month). The model to be fitted should ...
11 views

### Nonlinear regression with variables that are directly dependent on each other

I am performing a nonlinear regression analysis (with the nls function in r) to estimate the constant parameters for a proposed equation. My equation has 4 variables L, G, m, and S. G and S are not ...
103 views

### Interpreting and troubleshooting nls in R with quadratic plateau model

I am trying to run a quadratic plateau model on some proportion data where values are bound between 0 and 100. I would like some help troubleshooting some errors I have encountered, and correctly ...
39 views

### How do you compare linear model vs non-linear (nls) model in R?

I am trying to model some data, and as part of the modeling, I tried linear model (using lm function) and non-linear model (using nls) function. Model 1 : a linear model which has degrees of freedom ...
84 views

### Starting values for an nls model in R [duplicate]

I'm trying to fit an exponential model using nls, but I don't know how to select the starting values for the parameters. I know this question has been answered multiple times, but I spent some days ...
15 views

### multiple fixed effects in non-linear model

I'm trying to understand how to include an interaction/multiple fixed effects into a non-linear model. I have a data set with two independent variables (temperature and nutrient concentration) and ...
32 views

### Sine curve fit and model tunning using nls in R

I acquired data (motor adaptation =y in function of delays =t ) which I expect to look like a sine wave. I am trying (1) to fit a sine curve in my data and (2)to estimate the best model/parameters. I ...
68 views

### Sine curve fit using nls in R

I acquired data (motor adaptation $y$ as a function of delays $t$ ) which I expect to look like a sine wave. I am trying (1) to fit a sine curve in my data and (2) to estimate the best model/...
17 views

### Sine curve fit using lm, nls and nls2 in R [closed]

I acquired data (motor adaptation =y in function of delays =t ) which I expect to look like a sine wave. I am trying (1) to fit a sine curve in my data and (2)to estimate the best model/parameters. I ...
48 views

### Comparing time series data between three treatment groups (in R)

I have time series data where the response is decreasing over time. The rate of the decrease is supposed to depend on the treatment (the concentration of a drug). By looking at the data I am not sure ...
26 views

### Shared parameters similar to stats::nls() using “[]” but for minpack.lm::nlsLM() or similar?

I am looking for a method similar to the very convenient "[]" notation in stats::nls(), for estimating certain parameters separately (while sharing others) for subgroups within my data, which works ...
42 views

### r - Understand goodness of a fitted curve [duplicate]

I had to find the equation of curve that represent my data. After trying different function, I got a models that seems fitting my data, at least by plotting them. But this is it. I have no idea how to ...
359 views

...
112 views

### Constraining parameters in NLS in R to be less than a value, or greater than a different value

The nls function in R comes with upper and lower arguments to specify the upper or lower ...
25 views

### Nonlinear fit in R only works with tightly restricting parameter bounds [duplicate]

I have a reproducible example here with an attempt to use nls to fit a nonlinear function: y = ax/(b+x) + c Even when I set the starting values to be a good, ...
621 views

### Singular gradient erros, NLS in R

I'm trying to fit nls(Mound~ a*kg.bag.collar^b + c, start = list(a = 83, b = -.5, c=100), data=test) using the dataset here. I've fit it without trouble without the ...
403 views

### NLS model comparisons by ANOVA

I am comparing NLS models from two groups, males and females. I compared the models by ANOVAs, but I am hesitating which is the correct model comparison to use: a) Subgroup Males vs Subgroup Females ...
79 views

### Trouble fitting my data with non-linear Regression model

I have a dataset that contains tree height and diameter measurements among the tree stem. I tried to fit my data with GNLS in R, but I'm getting this "step halving factor reduced below minimum in NLS ...
18 views

### Estimate the Beta Coefficients, and then find an algorithm

Referring to the photo, I need to report my beta coefficients as functions of observed Xi and Yi. I tried to reduce by taking the log of both sides but It seems I can't reduce this model because it is ...
379 views

### Initial conditions for nonlinear models using the nlsLM function

I have a data frame containing 70000 rows. For each row, I am trying to apply the nlsLM function (minpack.lm package) to find ...
104 views

### comparison of more than one multivariate nls models in r

dear members, I am trying to identify which of the two multivariate nls models is more of a good fit. I came to know that you can use anova and f tests for univariate nls models to know ...
1k views

### How to know if a parameter is statistically significant in a “curve_fit” estimation? [closed]

I use curve_fit from scipy to estimate parameter values from a specific function. ...
76 views

### Reproducing non-linear sigmaplot regression with nls()

I'm trying to reproduce a non-linear regression with various similar datasets. The original regressions were performed by sigmaplot with a modified morrison equation and estimates for parameters E=2,K=...
2k views

### How to fit exponential y=A(1-exp(B*X)) function to a given data set? Especially how to determine the initial start parameters? [duplicate]

I have a data set in which $y$ is roughly related to $\log(x)$. Now I wish to fit the curve $$y=A(1-\exp(BX))$$ When I use R and the nls2 function, then I ...
242 views

### Why do different parameterizations give different results for nls?

Goal I'm trying to fit a four-parameter logistic (A+(B-A)/(1+exp((xmid-input)/scal))) in R, using nls and SSfpl, to fit two datasets that share the upper, lower, ...
1k views

### Standard errors for non-linear least squares in R

I have a question on standard errors for non-linear least squares in R. With the built-in function NLS and a hand-made function I get different SE and I don't understand why. I will try to expose ...
466 views

### Fitting a sinusoidal curve only with max-min values

I have a series of high-low tide values, approx. every 6h, and each one has the corresponding time. I would like to get (an estimation of) the values between each record. I was thinking I could create ...
2k views

### Simultaneously curve fitting for 2 models with shared parameters in R

Hi I am trying to curve fit 2 models (Van Genuchten & Mualem) with shared parameters in r. The models are: ...
220 views

### Difference between probit of log(x) and probit using inverse lognormal cdf of x

Topic: probit and logprobit regression. Context: I have to implement a model of size at maturity in a wild population and I must choose a binomial linear model to estimate the parameters based on ...
227 views

### Bootstrapping of nonlinear regression residuals: why does the model fitting fail?

I am trying to define a range of uncertainty associated with each estimate of the parameters of a nonlinear model: ...
322 views

### Fitting a non linear equation to a dataset

I am working on fitting an equation from a dataset. In my dataset I have two variables where I am interested at and I looking a function that gives me the value the free variables that I use in the ...
607 views

### How to calculate p-value for a parameter given confidence interval when null hypothesis != 0

Given the dataset: ...
1k views

### Why is my nonlinear least squares confidence band so wide?

I have the following dataset: ...
2k views

### nls() gradient error in fitting growth curve data

I am trying to model the following data on promotional budget and customer awareness. The idea is, at some point, increase in budget doesn't have any further impact on awareness; it saturates. ...
1k views

### nls() function in R not fitting well when calculating Kd

I'm trying to calculate Kd with the following R code but my model is clearly wrong (see image). How has nls() converged so poorly? How can I use it to find a better ...
300 views

I have an experimental data set $D=\{\mathbf{x}_i,y_i\}_{i=1}^N$, and a computer code with inputs $\mathbf{x}$ and calibration parameters $\boldsymbol{\theta}$, returning a value $s=f(\mathbf{x},\... 1answer 426 views ### How can I combine NLS models in a way as is done with linear regression models in Path Analysis I have a structural equation model that includes several paths that are actually non-linear (built in with the lavaan package for R). I have used polynomials in order to model these non-linear paths. ... 0answers 491 views ### Curve fitting - linear vs non-linear Dose Survival 1.044316 0.7085001 2.017041 0.2764831 3.042148 0.1498388 4.058954 0.0451514 5.098904 0.0145274 I have two models to fit the data: ... 1answer 887 views ### Fitting LPPL model using R apologies if this appears too simplistic/poorly worded a question, this is my first time coding in R I am attempting to fit the LPPL model to a price series in order to test for its predictive power ... 1answer 3k views ### nonlinear least squares versus maximum likelihood in R, nls() or nlm()? I am estimating the model $$E(Y|X) = Pr(Y=1|X) = \alpha_0 + (1 - \alpha_0 - \alpha_1)\phi(X'\beta),$$ where$\alpha_0$and$\alpha_1$are parameters,$\beta$is a$p$-length vector of parameters,$X$... 1answer 1k views ### Comparing two models using anova I have following two models (fit1, fit2) estimated using nls approach. I want to compare their goodness using anova, and the results follows: ... 1answer 704 views ### I used the function SSfpl (in R) for finding out the correct initial parameters. Why aren't they right? This is my data: I used SSfpl for finding out the correct initial parameters nls(y~ SSfpl (-x, b1,b2,b3,b4), data=estatus) And with these initial parameters, I used nls(y~b1 + ((b2-b1)/(1 + exp(... 0answers 125 views ### What do the parameters A, B, and C do in an equation of the form$Y = A + Be^{CX}\$? [duplicate]

I have read this article and those linked to it, but I am still having difficulties fitting a function of this form to data I have using the nls function in R. Invariably, I fail to get convergence ...
1k views

### how does nls model work?

I am trying to understand how nls model works. Let's say I have data frame mtcars and like to do this: model<-nls(mpg~disp) but getting this error: ...
5k views

### Fitting a function with R

I want to fit a function to these data: ...
755 views

### 4th parameter of Boltzmann sigmoid must be greater than .9 in R

I'm trying to fit a 4 parameter boltzmann sigmoid and get an error: "Error in nls(y ~ a0 + (a1 - a0)/(1 + exp((a2 - x)/a3)), start = list(a0 = max(y), : singular gradient" I have figured out that ...
153 views

### Debugging in R when using nls

How to correct a nls estimator when I get an error message that: step factor 0.000488281 reduced below 'minFactor' of 0.000976562 The full problem: ...