# Tagged Questions

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

23 views

### how does nls model work?

I am trying to understand how nls model works. Let's say I have data frame mtcars and like to do this: model<-nls(mpg~disp) but getting this error: ...
22 views

### Fitting a function with R

I want to fit a function to these data: ...
13 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-...
57 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 ...
11 views

### nls model diagnostics is puzzling

I've estimated a model and got the following output: ...
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: ...
16 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 ...
49 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 ...
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 ...
557 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: ...
41 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 ...
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: ...
148 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: <...
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;...
181 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 ...
47 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 ...
2k 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). ...
66 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 ...
146 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 ...
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. ...
155 views

963 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 ...
592 views

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 ... 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? ... 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 ... 0answers 178 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 ... 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 ... 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), ... 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 ...
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 ...
519 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 ...
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: ...
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: ...