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

Plot NLS in R, real data and estimated parameters

My dataset ICM_Color0 has the following structure, where columns are: Lum Ruido Dist RT.ms Condicion With 2599 rows. There are three luminance = [13,19,25];and two types of noise = [1, 2] -> 3x2 = 6 conditions. Condicion: Lum …
0
votes
1 answer

How to fit a function that is an exponential function times a sum of two sinusoidal functions

I am having difficulty getting nls or nlsLM to fit a function to the following time series in R. [1] 143.7083 143.7083 141.5833 139.8750 138.8333 137.9167 136.4583 134.8750 134.3750 [10] 134.1250 133.7917 132.5000 129.2083 127.2917 127.9583…
user3771785
  • 35
  • 1
  • 4
0
votes
1 answer

Find start values for NLS function in R

i am trying to make a fit for a power function using the NLS function in R but i am failing to find good start values. This is part of my data "CentroM": Wg TLcm 3200 79 2650 77 2750 74 870 45 1480 52 3400 80.5 2400 76 2800 …
Myr
  • 67
  • 1
  • 1
  • 11
0
votes
0 answers

Empty nlsList object (length = 0 and lists 0 object)

I'm having trouble understanding why my nlsList() model comes out empty: I run it on grouped data with a fairly simple formula, and R runs smoothly (no error message returned) but I end up with an empty model, of length 0 and listing 0 objects. I'm…
Chris. Z
  • 365
  • 1
  • 7
  • 17
0
votes
2 answers

What does this short R script do?

I know python and C++ but have very little experience with R. I'm supposed to figure out what my old coworker's script does - he hasn't been here for several years but I have his files. He has about 10 python files that pass data into a temp file…
user1539097
  • 109
  • 3
  • 8
0
votes
1 answer

With Date=as.Date(rownames(df))

I called index data from an excel csv. (Dates are in yyyy/mm/dd format.) library(tseries) library(minpack.lm) library(ggplot2) index <- read.csv("C:\\Users\\Toshiba\\Desktop\\deks\\DATA.csv") ts <- index df <- data.frame(ts) df <-…
user3664028
  • 1
  • 1
  • 2
0
votes
0 answers

Singular gradient using NLS

I want to estimate the parameters of a nonlinear model. Apparently I have a problem with the initial values. My dataset has this structure, where the columns are: color Lum ruido Dist RT Resp RT.ms Condicion With 7920 rows. There are…
0
votes
1 answer

How can I estimate THREE parameters in R using nls

I have fitted a model and estimated parameters for; Count = beta0*exp(beta1*time) If an additional parameter is introduced such that the model becomes; Count = alpha + (beta)*exp(beta1*time) I tried using the same method as i did to find just the…
0
votes
1 answer

Trouble getting nls confidence intervals when using R package plyr

I used the R package plyr to do some nonlinear regressions, and now that I have a list of nonlinear regression fits, I'd like to put the p values and 95% confidence intervals of those fits into a data.frame. When I do that, though, I keep getting…
shirewoman2
  • 1,842
  • 4
  • 19
  • 31
0
votes
1 answer

How to add nls() fit with lattice

I have begun switching from base R graphics to lattice graphics. I now have some data and an nls() fit to that data, and am I'm trying to plot both onto a single graph. So, as a simple base R graphics code: require(lattice) # Data V <-…
Abstracted
  • 390
  • 3
  • 14
0
votes
1 answer

general equation for multiple regression lines

Is there a way in R to find out the 'general' equation of multiple lines in a graph? The following graph is an example of what I wanted to achieve. I have only shown the major lines for t but there are also hidden lines in between those major…
geodex
  • 1,219
  • 3
  • 13
  • 22
0
votes
1 answer

R nls : could not find function "a"

I'm trying to fit the information with nls() function. The formula is: but the R be angry :) > dk1 Q H 1 43.754 21 2 74.434 52 3 94.601 72 4 115.327 …
pe_tsa
  • 13
  • 4
0
votes
2 answers

unexpected "=" in par=c(...)

I'm trying to reproduce the following code (nls function does not perform well), but with an extra implementation, using for loops, sprintf and as.formula(), that adds variables depending of the number of peaks in the given spectrum. To be more…
0
votes
2 answers

nls function does not perform well

I need to fit this formula y ~ 1/(pi*a*(1+((x-2.15646)/a)^2))+1/(pi*b*(1+((x-2.16355)/b)^2)) to the variables x and y x<- c(2.15011, 2.15035, 2.15060, 2.15084, 2.15109, 2.15133, 2.15157, 2.15182, 2.15206, 2.15231, 2.15255, 2.15280, 2.15304,…
0
votes
1 answer

nonlinear regression in R

I'm a novice with R. I want to do a nonlinear regression fitting on the following 1st order decaying time-series formula: y = a*exp^(-kt) Can anyone show me the scripts and process to do this nonlinear fitting? Thanks!