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

Setting upper bound on nls fits for logistic growth curve

I am fitting logistic growth curves, but nls overestimates my parameters. I have data of snails that grew to some asymptotic size (K) and they have a logistic shape to their growth pattern. Some asymptotic sizes are way over estimated so I want to…
abby hudak
  • 23
  • 3
0
votes
2 answers

Continuing loop when there is an error message in R

I have a large dataset where i need to do NLS estimation on different segments of the data. I want to loop trough the data, but the NLS function i have specified and sometimes creates and error (which is logical when u look at the data). However, is…
0
votes
2 answers

How can I get confidence intervals for an nls(broken stick) class object

I am trying to figure out how to obtain/plot confidence bounds for nls objects in R. For example here is a nls model bstick.lm.mean <- nls(TCTmean ~ cbind("intercept" = 1, "l2Flow" = l2Flow, …
Quality
  • 113
  • 6
0
votes
1 answer

Cannot fit function in R

I wanted to make a quick test: Create a function having lots of points. Add some random noise to the data. For every n points, calculate the mean and sd. Display the new ("blocked") data using error bars (which are something like…
user9949797
0
votes
0 answers

nonlinear least squares troubleshooting

I am trying to run a nonlinear least squares regression in R and keep coming across the same error message which I can't seem to fix. My function so far: nls(y ~ 1033.89+(2461*cos*(2*3.14*(t-18)/24)), data=data.frame, start=list(x=1,…
0
votes
1 answer

rpy2 nls initial parameters choice

Hi I am running a code in python importing rpy2 robjects and trying to make a fit to some data (with errors that I consider as weights). I am using a non linear regression and the "formula" i am trying to fit is: A/((x/t1)^b+(x/t1)^c) Unfortunately…
0
votes
1 answer

Smooth prediction of several groups within a dataframe

I'm trying to use a non-linear regression (NLR) function to predict the change in a value (y) over time (x), and then calclulating the time in which the prediction is at max (Optimum). I get predictions around the actual measured values (y) which is…
brendbech
  • 399
  • 1
  • 7
0
votes
0 answers

Problems when coding NLS in R with dims

I'm trying to code a non-linear regression in R to fit data I have regarding the relationship between temperatures and types of precipitations. I first created 2 vectors with my data: vec_temp_num [1] -8.5 -8.0 -6.5 -6.1 -5.9 -5.8 -5.6 -5.4 -5.3…
Sanda
  • 1
  • 1
0
votes
1 answer

What is the problem with this nls function here?

df <- data.frame(logy, logx1, logx2) dput(head(df, 30)) structure(list(logy = c(2.86483129264695, 2.71422609892467, 6.0029648649718, 6.23407114218406, 3.10441832707604, 3.31883951518659, 2.74899119270203, 3.33693389469922, 3.08234859652005,…
0
votes
1 answer

Constraining coef output using fit model or nls function

I have data on the photosynthetic activity of microalgae under increasing light. PAR: is the different light exposures, (x, independent variable) ETR: is the photosynthetic activity (y, dependent variable). PAR ETR 1 0.409090909 46 …
0
votes
1 answer

Error while using nls function in R, can't get LS estimates

I'm trying to fit some data with a negative exponential model in R, but it doesn't seem to work and I can't find the error or a way to work around it. t<-c(1,4,16) y<-c(0.8,0.45,0.04) tabla<-data.frame(t,y) …
JeffCJ
  • 15
  • 4
0
votes
1 answer

NLS almost fits

I'm a bit out of my depth here... I have this data: d <- data.frame(matrix(data = c(1,1.5,6,2,11,2.5,16,3,26,4,46,5,66,6,86,7,126,8,176,9,276,10,426,11,626,12,876,13,1176,14,1551,15,2026,16,2676,17,3451,18,4351,19,5451,20,6801,21,8501,22,10701,23), …
habana
  • 317
  • 1
  • 11
0
votes
1 answer

How can I find non-linear regression model starting values?

I'm trying to fit a non-linear tree diameter height model (Max & Burkhart, 1976) to my data set (consists of D, breast height diameter (cm); H, total tree height (m); hi section height from ground level, di diameter at hi level etc.) in R. I'm…
Onur Alkan
  • 83
  • 2
  • 9
0
votes
1 answer

nls: Loop and break in a decided number of iterations

I've like two make to sequential operations: 1) Ajusted two nls models in a subset; and 2) Loop the models just a number of iteracions =1. For the first step I make: #Packages library(minpack.lm) # Data set - Diameter in function of Feature and…
Leprechault
  • 1,531
  • 12
  • 28
0
votes
1 answer

How do I test for equality in parameters for two time series data sets described by the same NLS model?

I am currently in the midst of fitting curves to sales volumes of 2 successive product generations over an observation period. I am looking at two different markets. Through some research, I have identified a nonlinear model that fit the data well…