nls is an R routine to fit linear regression models of the form y = f(xB) + e

learn more… | top users | synonyms

0
votes
0answers
7 views

Using nlsLM() for importance sampling for pricing european optoins

I am trying to implement a method for finding an optimal drift in pricing European options with importance sampling using this article. The article in pages 489-490 suggests to use Levenberg-...
1
vote
0answers
43 views

4th parameter of Boltzmann sigmoid must be greater than .9 in R

I'm trying to fit a 4 parameter boltzmann sigmoid and get an error: "Error in nls(y ~ a0 + (a1 - a0)/(1 + exp((a2 - x)/a3)), start = list(a0 = max(y), : singular gradient" I have figured out that ...
0
votes
0answers
11 views

nls model diagnostics is puzzling

I've estimated a model and got the following output: ...
0
votes
1answer
39 views

Debugging in R when using nls

How to correct a nls estimator when I get an error message that: step factor 0.000488281 reduced below 'minFactor' of 0.000976562 The full problem: ...
0
votes
0answers
15 views

Function for a peaked curve shape using Nonlinear Least Squares Fitting

I am looking for a function which could fit a NLS model to the below attached sample data set. The data looks somewhat gaussian, but often with a right or left skew and tails to both sides (in some ...
0
votes
1answer
48 views

Why do the predictions of a linear (log-log) model not approximate those of a nonlinear (power) model?

I am having trouble using a linear (log-log) model to approximate the predictions of a nonlinear (power) model. I wish to plot the predictions of the linear model on untransformed axes, and I believe ...
0
votes
1answer
41 views

Testing difference between two non linear growth curves

I would like to identify the significance of the difference between two growth curves with the same formula but different parameters. The dummy data generated by the code produces a normal spread of ...
1
vote
2answers
455 views

Getting the right starting values for an nls model in R

I'm trying to fit a simple power law model to a data set that is as follows: mydf: ...
2
votes
0answers
39 views

Problems in finding outliers and leverage points in non-linear regression

I'm implementing diagnostic of non-linear regression model $(y=ax^b)$. I'm trying to find out where outliers and leverage points in my model ...
0
votes
0answers
10 views

Using a model with domain/image constraints [duplicate]

I would like to fit a model and the smallest predicted value must be zero. This is what I have done: ...
0
votes
1answer
135 views

Fiting non-linear model to small data set

I want to do a small example with fitting non-linear model Here are data: x <- c(10, 15, 25) y <- c(5, 10, 15) Firstly I fit a second degree polynom: <...
0
votes
0answers
33 views

nls model parameter compare

I am doing nonlinear regression using a same sigmoidal model for different treatments. for each treatment, I got a set of estimated parameters (a1, b1, c1 for treatment 1; a2, b2, c2 for treatment 2;...
1
vote
1answer
163 views

Non linear regression - Von Bertalanffy Growth Function - Error: “singular gradient matrix at initial parameter estimates”

I am trying to estimate VBGF parameters K and Linf using non linear regression and nls(). First I used a classic approach where I estimate both parameters together as below with "alkdyr" being a ...
0
votes
0answers
46 views

Weighted nls fit of multiple datasets with nested paramaters

I have a number of datasets that I'd like to fit with a model of the form a*(x+b)^c where b, c are common to each dataset with only the amplitude changing. I currently have this working in r, but I ...
3
votes
1answer
1k views

How to fit piecewise constant (or step-function) model and compare to logistic model in R

I have x, y data where x is position (along a transect) and y is a continuous variable (e.g. temperature). ...
2
votes
0answers
63 views

Using nls To Model

I'm trying to use nls model certain curves that I found in a dataset. I'm not sure how I can give example data, but here are the curves as they look right now: I tried using ...
0
votes
1answer
135 views

Difference between SAS and R results - Nonlinear Regression

Hoping someone can assist with this rather niche question. I have a routine built in R for analysing depreciation curves, which is fit according to a logistic model with an additional additive ...
-1
votes
0answers
20 views

Need better guesses for nls [closed]

I got need better guesses for this nls function, I was wondering if anyone could help me find better guesses. Sorry I don't know how to post code correctly, everything below here is code. ...
6
votes
1answer
153 views

syntax for nls model with breakpoint

So the saga continues... So I am trying to fit the model $$Runoff = \begin{cases} \beta_0 + \beta_1Pcp & \text{if $(Ant + Pcp) < Thold$;}\\ \beta_2 + \beta_3Pcp & \text{if $(Ant + Pcp) \...
2
votes
0answers
114 views

Can I use deviance to compare the fit of a model to different datasets?

I'm using R's nls to fit different datasets to the same model. I've read that using R-squared is usually not correct for non-...
0
votes
0answers
53 views

Error message fitting survival function with nls [closed]

I am trying to fit a survival function using nls as I had trouble with optim. This is full set of code I used. a=0.018 b=5.01 c=50000 d=2.29 ...
5
votes
1answer
66 views

Pitfalls in Fitting Nonlinear Models by Transforming to Linearity

Some nonlinear models can be transform to linear models. My understanding is that there might be one-to-one relationship between the estimates of nonlinear model and its linear model form but their ...
0
votes
0answers
112 views

Autoregressive model in R

Citation: As the data represent repeated measurements from individual plots, within-plot correlation may result in inefficient estimates and underestimation of standard error. Therefore the ...
3
votes
0answers
138 views

How to model a power function ($y = ax^b$) with two exponents in two regions using R and nls

I have been unsuccessfully trying to model a relationship between two measured variables described by two different power functions, on either side of a threshold. My question is how to best estimate ...
0
votes
0answers
203 views

nls standard deviation calculation

I have fitted a non linear assymptotic equation to a set of data and my interest is in getting the standard deviations of the fitted parameters. Is this possible in nls?
4
votes
2answers
301 views

R - how to get standard error for a breakpoint/parameter in a piecewise regression

I'm new to asking questions here, so I hope this is a reasonable place for this. I am trying to fit a piece-wise regression. I expect my response (y) to increase from x0 to somewhere along x, then to ...
0
votes
0answers
109 views

How to run an nls model in R to generate output parameters for independent categories?

I would like to get help on the following code: library(nlme) funct1 <- function(scale1,a){ exp((scale1 - 2)/a) } scale1...
0
votes
0answers
254 views

How to set up the initial data in the nls model

I am struggling with nls model given below. I have a blur idea how to set up the initial values in it. Shall I use "try and error" method or is there any other way to make it more systematic. ...
1
vote
0answers
191 views

studentized residuals in nonlinear regression

I am using the nls function in R to perform a nonlinear regression and need to calculate the studentized residuals. Is this something I need to manually do? It seems like I need to manually do a QR ...
2
votes
1answer
180 views

nls curve fitting of shared parameters

I have data for 5 replicates that were drawn from the same model and I want to fit all 5 replicates together so that I can find out the shared parameters. Specifically, if I have the underlying ...
1
vote
1answer
117 views

divergence between nls (simple power equation) on non-transformed data and lm on log transformed data in R

I'm testing different ways to fit a simple power model to a dataset of 5 points. I don't get same results if I use nls on non-transformed data or lm on log10 transformed data in R whereas Excel ...
3
votes
1answer
291 views

how to fit a michaelis-menten function with a random effect using the nlme package in R?

I am working on fitting a model using the nlme package in R. y is a saturating function of x, similar in form to a michaelis-...
2
votes
0answers
163 views

Calculating standard error of a coefficient that is calculated from other estimated coefficient

I'm working on the Gompertz growth model to fit weight at age: $$ m(a)=m_{\infty}e^{-\gamma exp(-g{1}a)}$$ Where $m_{\infty}$ and $g_{1}$ are coefficients to be estimated. To deal with lack of ...
1
vote
1answer
199 views

Fitting NLS algorithm

I have the list of time series. I am fitting these series with the formula $$y=ax^2\exp(b*x)$$. It should be noted that parameter $b$ in the formula must be negative as this reflects the behaviour of ...
1
vote
2answers
948 views

Using nls() function in R for exponential function

I know that this issue was already discussed here but I faced with the problem I can't solve. I have list of persons, each represented with some time series consisting from 4-8 points. I want to ...
4
votes
1answer
577 views

Is AIC appropriate for model selection when the parameters are fitted by least-squares rather than MLE

I want to compare the fit of a linear model (M1) and nonlinear model (M2): M1: $y = b_0 + b_1x_1 + b_2x_2 + b_3x_1x_2 + \epsilon, \epsilon \sim N(0, \sigma^2)$ M2: $y = b_0 + b_1x_1 + b_2x_2 + b_1 ...
7
votes
1answer
4k views

Fitting a “sigmoid” function: Why is my fit so bad?

I tried to fit a curve to the black points using the following code. Why is the fit so bad? Do I need to fit another type of function? ...
1
vote
0answers
138 views

How to calculate Pareto parameters

I'm trying to calculate the parameters for a Pareto distributed variable in R. I use the following model: form = rank~bet*(downloads)^(-alp)+eps, which is widely ...
5
votes
0answers
176 views

Numerical properties of the logistic growth model for non-linear regression

I am using the nls procedure in R to fit a logistic growth model. In their SSlogis function, José Pinheiro and Douglas Bates chose the formulation ...
2
votes
1answer
80 views

How do I incorporate 2 peaks in a liquidity model using curve-fitting and nls

This is my first time at stack exchange, hence please pardon me if I miss something. I have multiple questions and I am tearing myself as curve-fitting and estimation is foreign land to me, I am ready ...
3
votes
0answers
2k views

Non-linear modelling with several variables including a categorical variable

I am trying to model some data regarding a predator prey interaction experiment (n=26). Predation rate is my response variable and I have 4 explanatory variables: predator density (1,2,3,4 5), ...
4
votes
1answer
1k views

How to calculate confidence intervals for power function ($y=ax^b$) in R using NLS

I hope you can help me get some confidence in my confidence interval... I am trying to get the confidence interval for a particular (threshold) point on a predicted curve. I find the confidence ...
2
votes
1answer
1k views

nls curve fitting of nested/shared parameters

I'm trying to fit raw data to curves, which works well on an individual basis. However, I'd like to "share" parameters (sometimes referred as nested parameters) across more than one data series. Is ...
3
votes
0answers
516 views

Bayesian model averaging in R

I have a logistic model that I've built with the nls function in R. I want to use Bayesian model averaging for variable selection, but I can't find a package for ...
8
votes
1answer
2k views

Choose best model between logit, probit and nls

I'm analyzing a certain dataset, and I need to understand how to choose the best model that fits my data. I'm using R. An example of data I have is the following: ...
14
votes
1answer
4k views

How to minimize residual sum of squares of an exponential fit?

I have the following data and would like to fit a negative exponential growth model to it: ...
12
votes
1answer
2k views

How to test the effect of a grouping variable with a non-linear model?

I have a question regarding the use of a grouping variable in a non-linear model. Since the nls() function does not allow for factor variables, I have been struggling to figure out if one can test the ...
4
votes
1answer
3k views

How to get p value and confidence intervals for nls functions?

I have 2 questions. 1) How can I have p.value for my 2 functions? My hypothesis is that I have a correlation between my function and my data. 2) How can I have a confidence intervals for my 2 ...
13
votes
2answers
14k views

Singular gradient error in nls with correct starting values

I'm trying to fit a line+exponential curve to some data. As a start, I tried to do this on some artificial data. The function is: $$y=a+b\cdot r^{(x-m)}+c\cdot x$$ It is effectively an exponential ...
4
votes
1answer
1k views

Fitting conditional functions in nls

I'm trying to fit two equations with nls() function in R. The two functions are: $f(x) = c_{1} \exp\left(-\left(\frac{x-\mu}{\sigma_{(x)}}\right)^2\right)$ where $\sigma_{(x)} = \sigma_{11}$ if $...