# Questions tagged [nls]

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

111 questions
Filter by
Sorted by
Tagged with
11 views

### ED50 in non linear logistic regression in R

I am new to R and I want to find the ED50 with its confidence interval in the drc package in R. I found the best model is lorentz.4 according to AIC. But I get a warning message for the confidence ...
19 views

### Advice on fitting curve to three-pooled plant decomposition model in r

I have just finished running a plant decomposition experiment measuring the decomposition of pine needles across climate and lithological types. We have mass loss, plant chemistry data (c, n, labile ...
69 views

### Fitting a cubic-like curve to data in R

I tried using nls() in R to fit the following expression to a set of data: where g=9.8, alpha & B_0 are unknown, a = 0.01, z_0 = 0.3 such that: theory <- as.formula(V~-(9.8)ab*(pi)(0.02^2)(T)(...
• 3
29 views

### Seeking a combination of nls() params that would make this fit curve slightly more acute?

I have some data with fields GrowthRate and DAY. GrowthRate. E.g. If amount is 100 on day 1 and then 110 on day2, GrowthRate is 1.1. Data look like this: ...
• 1,258
107 views

### Modelling poisson distribution with nls() in R?

I'm trying to model the probability that somebody can do a 90 day Snapchat streak. I have some binary success data in the form of count data (the participant only reached 90 days once): I've ...
• 11
9 views

### Best approach to compare trends in timepoint measurements

I have two datasets, a control and experiment. Composed of "activation measurements" of cells(y) on fixed time points with uneven intervals (x). At each time point cells from one batch are ...
• 111
39 views

### Test effects of multiple categorical variables in a nonlinear model

I am fitting forest biomass data to a modified version of the Chapman-Richards function using the nlsLM() function. I am curious about the impact of multiple binary predictor variables on the model. ...
33 views

### nonlinear least square optimization for Logistic Regression

Generally I have trained a logistic regression model with: ...
• 113
60 views

### Correct GLM or NLS to model exponential model with response variable with positive and negative values

I have been struggling to find the right way to model this dataset, this is a Data Frame with the dataset: ...
38 views

### R - problem with fitting to a custom non-linear equation

I have a problem. In GraphPad Prism, fitting to the following equation my data produce pretty nice results. However, when I try to repeat in R, it generates terrible output. Here is the code: ...
44 views

### Using the FSA R package to test effect of continuous covariates on von Bertalanffy growth rate

Is it possible to use the FSA package in R to test for the effect of continuous variables (such as temperature, latitude, precipitation). I have recapture growth data and am able to test for the ...
139 views

### Fit exponential decay upwards model - start values give 'convergence failure'

I have some data that when plotted looks similar to this: Then eyeballing the charts on this page, it looks like I might have an exponential decay (Increasing form) relationship? I searched for how ...
• 1,258
73 views

### Parametric nonlinear term in mgcv

The R library mgcv can handle both parametric linear and non-parametric non-linear terms, but is there any way to let it handle parametric non-linear terms? For ...
• 163
161 views

### How to run a nls for multiple dependent variables?

I am unfamiliar with nls however after doing some research on the function it seems to be appropriate for my current analysis. I am testing population declines over ...
• 187
1 vote
104 views

### Sum of two gaussian curves

I have a set of raw chromatographic data (x,y) where I'm trying to evaluate the area of two unresolved peaks separately using gaussian approximations in R. I found this answer from a few years ago (...
• 11
1 vote
290 views

### Quantile regression with an exponential function

The following equation: y = a*x**b where y is a nonlinear function of x. By taking logs, the equation can be expressed as: ln(y) = ln(a) + bln(x). I would like to run a quantile regression instead of ...
59 views

### How can I transfer the exponential relationship to linear?

The exponential relationship between y and x I got is model_1 <- nls(y ~ I(a * exp(-b * x)), start = list(a = 1, b = 0), trace = TRUE) ...
1 vote
107 views

### How to calculate time of day of the peak of a harmonic function fit from phase offset estimate from R nls

I'm trying to calculate the time of day of a harmonic function peak using nls() in R. I've looked at the posts here, here and here, but have not found a method to calculate time of day from phase ...
76 views

### Why SSgompertz does not work on similar data sets?

I have data that follows a sigmodial shape and the Gompertz function seem to make sense. I wanted to use SSgompertz in nls to find the parameters, but I get sometimes errors. So, I wanted to learn ...
129 views

### Fitting a non-linear least squares regression to estimate coefficients of parameters in R

I need to fit a non-linear least squares regression to estimate coefficients which are governed by an equation that have parameters obtained from generating data series. Data: ...
• 123
116 views

### Is a Google Sheets fit model a valid place to retrieve starting parameters for nls() in R Studio?

0 I am trying to fit an exponential model of form y = ae^(xb) in R to the data I have ran below, using the nls() function. I have read here and in other places that I need to feed the model reasonable ...
356 views

### How to fit a piecewise assembly of nonlinear functions?

I am trying to model vegetation spectral signatures (grey lines) using a two-part piecewise function (black dotted lines). In it, I am trying to use only a few points (red dots) to fit a linear (first ...
• 51
1 vote
254 views

### using nls in R to fit a distribution to a model - constant error on multiple parameter estimate

I have a distribution of data (x), which I need to fit with a two-species, or three-species model (essentially the sum of two gamma distributions) to find D (the diffusion coefficient). A single-...
• 11
1 vote
230 views

### NLS analysis in R with timeseries data to remove known effect

I have a timeseries dataset collected by sensors. The data is crack displacement (disp) and temperature (temp). Thermal ...
34 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, ...
• 1,346
628 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 ...
• 103
846 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 ...
1 vote
165 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 ...
• 11
1k 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/...
• 11
19 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 ...
• 11
722 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 ...
1 vote
44 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 ...
• 31
1k views

...
• 31
519 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 ...
• 463
65 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, ...
• 463
2k 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 ...
1 vote
1k 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 ...
• 106
229 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 ...
1 vote
21 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 ...
904 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 ...
• 103
283 views

### The non-linear extra sum of squares? What is this?

I encountered in the article I read the term the non-linear extra sum of square with the reference to Bates and Watts 1988. I do ...
• 121
208 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 ...
3k 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. ...
• 143
120 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=...
• 135
4k 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 ...
283 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, ...
3k 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 ...
• 43
772 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 ...
• 513