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

Add a manually designed non-linear line in ggplot2?

I would like to add a non-linear model line to a graph in R, but instead of letting ggplot find the best fit, I just want to preset its parameters and thus be able to see how multiple manually designed models fit on top of the data. I tried the…
Cameron
  • 164
  • 14
0
votes
1 answer

Fetching value from a number column removes 0 before decimal

There is a number column in database. When it is fetched as char using TO_CHAR then the digit before decimal point is lost. Select TO_CHAR(column) from table For e.g. 0.5 is stored in the column but when selected it returns .5 Similarly if -0.5 is…
PTK
  • 307
  • 4
  • 19
0
votes
1 answer

Applying fitting data with nls

Hi and thank you in advance for any suggestions here! My question is using nls() how can I find the best optimal fit amongst the other fits-- ie linear and non linear-- for my data and show the fit on the ggplot graph…
Toy L
  • 55
  • 6
0
votes
1 answer

Using optim to choose initial values for nls

One method I have seen in the literature is the use of optim() to choose initial values for nonlinear models in the package nls or nlme, however, I am puzzled by the actual implementation. Take an example using COVID data from Alachua,…
Constantin
  • 132
  • 9
0
votes
1 answer

Error in str2lang(x) : :2:0: unexpected end of input 1: ~ ^

I have got this error message: Error in str2lang(x) : :2:0: unexpected end of input 1: ~ ^ and have been trying for two days to find what the problem was. I really need your help guys!! My code is built in two stages: a function that returns…
0
votes
1 answer

How to perform a nonlinear regression of a complex function that has a summation using R?

I have the following function: Of this function, the parameter R is a constant with a value of 22.5. I want to estimate parameters A and B using nonlinear regression (nls() function). I made a few attempts, but all were unsuccessful. I'm not very…
Daniel Valencia C.
  • 2,159
  • 2
  • 19
  • 38
0
votes
1 answer

Fit a dataset that presents an elbow/knee bent using in nlsLM and "force" the coefficients to be near a threshold

Due to the necessity of fitting a dataset that is related to a two dimensional diffusion process D2 process with a sestak berggren model (derived from logistic model) I needed to understand how to use the nlsLM when in presence of a elbow/knee…
Jojostack
  • 181
  • 9
0
votes
1 answer

changing NLS_TERRITORY and NLS_LANGUAGE permanently

When I execute "select * from SYS.NLS_INSTANCE_PARAMETERS" in SQL Developer, result includes GERMAN for NLS_LANGUAGE and GERMANY for NLS_TERRITORY. Now I need to change those values to AMERICAN respectively AMERICA permanently. How can this be done?…
user
  • 157
  • 2
  • 14
0
votes
0 answers

error message when using nls in a lapply function

I have an issue about nls function. I am trying to make plots with von Bertalanffy growth (Length and age) for each species (I have 13 species in total). First I made a list of dataframe, each dataframe contain the data for a specific Species dfss…
Sebastien
  • 25
  • 3
0
votes
1 answer

R Nonliner Least Squares (nls) function: Using indexed vectors as inputs?

I am trying to run the nls function in R using indexed vectors as inputs, however I am getting an error: > a=c(1,2,3,4,5,6,7,8,9,10) > b=c(6,7,9,11,14,18,23,30,38,50) #make some example data > > nls(b[1:6]~s+k*2^(a[1:6]/d),start=list(s=2,k=3,d=2.5))…
Andy
  • 15
  • 1
  • 4
0
votes
0 answers

getting predicted values from an nls() model for Fabens von Bertalanffy growth curve

I have a growth dataset based off of recaptures. There are columns with the capture length, the recapture length, and the time (in yrs) based off the recapture minus the capture. > str(data) 'data.frame': 60 obs. of 3 variables: $ sizecapture :…
Cheryl
  • 1
  • 1
0
votes
1 answer

R: Using "group_by" with "nls()"

I have a dataset that I want to fit a Gompertz model grouped by 4 different factors (subject, race, target & distractor). The Gompertz model works when applied to the entire data set (i.e., without applying "group_by"). The group_by function works…
VO_fsu
  • 1
0
votes
1 answer

R nls singular gradient to find a sigmoid function

I am trying to find an optimal sigmoid functional that adjust to my data (at the end of this post). But there is an error: Error in nls(cumulativo ~ f(eixox, phi1, phi2, phi3), start = st, data = data, : singular gradient Any suggestions…
0
votes
0 answers

set R based nls parameters so 0 is an option for any coefficient

I am trying to perform non linear regression on my data using nls in R and several different models which I am comparing using AIC to determine the best fitting model. As an example, I am fitting either a simple exponential equation (model 1): Y ~ a…
0
votes
1 answer

Estimating the parameters of a weibull distribution to two data sets simultaneously in R

I´m trying to estimate the parameters of a 3-parameter weibull distribution (translation parameter beta= -0.5). The problem is that I have to fit two sets of data simultaneously. Using nlc (see code below) i was able to estimate the parameters of…