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

R ggplot2 exponential regression with R² and p

I am trying to do a exponential regression in ggplot2. So first my skript: g <- ggplot(data, aes(x=datax, y=datay), color="black") + geom_point(shape=1) + stat_smooth(method = 'nls', formula = y~a*exp(b*x), aes(colour = 'Exponential'), se =…
Sofia
  • 75
  • 1
  • 7
0
votes
0 answers

nls geom_smooth with scale_x_reverse

I'm using nls with geom_smooth as below. This works fine ggplot(model.data, aes(x=T, y=Value)) + geom_line(aes(colour=as.factor(Year)), size = 1) + geom_smooth(method = "nls", formula = y ~ a * (1 - exp(-b * x)), method.args = list(start =…
David Waterworth
  • 2,214
  • 1
  • 21
  • 41
0
votes
1 answer

Error fitting a model in nls

previous answers to similar questions have not help me to solve my problem. I am trying to fit a model y=a1*(1-exp(-a21*Age_WH40))^a3, where a21=ln(1/a3)/a2, and Age_WH40 goes from 1 to 40. I've plot the data and a line to get an idea of the…
David
  • 15
  • 11
0
votes
1 answer

Initial guess visualizing with the nls function

I'm trying to fit a function consisting of several gauss bells to some experimental data. The method used is the nls function from R. But it is difficult to get the initial guess good enough, such that the method can converge. Is it possible to…
midtiby
  • 14,550
  • 6
  • 34
  • 43
0
votes
1 answer

NVARCHAR2 equation issue in Oracle 10g

Env: Oracle version: Release 10.2.0.1.0 Server: Windows XP Language in oracle: select userenv('language') from dual; Result: CHINESE_CHINA.AL32UTF8 Table structure: PARTY_ID NVARCHAR2(50) PARTY_TYPE NVARCHAR2(50) Data in the table: PARTY_ID |…
Sailing
  • 337
  • 1
  • 2
  • 9
0
votes
1 answer

Fit an exponential curve using nls with a custom data frame in R

I have been through many questions on SO but I am not able to find a fix for my problem in related answers. I have a table like this stored as PAO1.data: Name P AO Prog1 0.654 59.702 Prog2 0.149 49.595 Prog3 …
Kajal
  • 581
  • 11
  • 24
0
votes
1 answer

Fitting function (with estimation of three parameters)

I have data and I am trying to fit a specific function to that data as…
0
votes
2 answers

Entering variables into regression function

I have this feature_list that contains several possible values, say "A", "B", "C" etc. And there is time in time_list. So I will have a loop where I will want to go through each of these different values and put it in a formula. something like for(i…
sfactor
  • 12,592
  • 32
  • 102
  • 152
0
votes
1 answer

Can we make prediction with nlxb from nlmrt package?

I'm asking this question because I couldn't figure it out why nlxb fitting function does not work with the predict() function. I have been looking around to solve this but so far no luck:( I use dplyr to group data and use do to fit each group using…
Alexander
  • 4,527
  • 5
  • 51
  • 98
0
votes
0 answers

Fitting exponential nls in R

I am trying to fit a line of best fit to some data. From the look of it it's a negative exponential curve. I have managed to use the nls function to find a second order polynomial fit, but when I try to fit an exponential problems occur.... When I…
George
  • 27
  • 9
0
votes
0 answers

Trouble when adding 3rd fitting parameter in nls

I have some trouble with adding another fitting parameter to my formula. I'm using nlsLM for fitting functions and plyr package fitting in groups. You can see the code below. As well I understood from other questions there are many suggestions on…
Alexander
  • 4,527
  • 5
  • 51
  • 98
0
votes
0 answers

Accessing defined parameters in a formula in R

I am writing a function that allows many starting parameter combinations to be tried to fit nonlinear regression as nlsList() only allows one set of starting parameters. I have managed this fine but want to add a predictions data frame into the…
0
votes
0 answers

R - NLS and linear equation

I know NLS is used to fit nonlinear equations, but I don't understand why it won't work with a simple linear one. I mean, the theory should still hold, right? But, when I try to do something simple like the following, it won't converge. y =…
kyro1021
  • 31
  • 2
0
votes
1 answer

Transform variables from a non-linear object model in R

I have a dataframe df df<-structure(list(ID = structure(c(1L, 3L, 5L, 6L, 8L, 9L, 10L, 11L, 12L, 13L, 14L, 15L, 16L, 17L, 18L, 19L, 20L, 21L, 22L, 23L, 24L, 28L, 29L, 30L, 33L, 34L, 37L, 38L, 40L, 41L, 42L, 43L, 44L, 45L, 46L, 48L, 49L, 50L,…
SimonB
  • 670
  • 1
  • 10
  • 25
0
votes
0 answers

nls can fit a regression, but ggplot stat_smooth has a computation error

I have some data I'm trying plot a fit for in ggplot. I'm using nls with a self starting four parameter logisitic regression (SSfpl). It can fit the formula fine using nls and it gives me coefficients but when i try to pass it to geom_smooth it…
Ted Mosby
  • 1,426
  • 1
  • 16
  • 41