Skip to main content
Search type Search syntax
Tags [tag]
Exact "words here"
Author user:1234
user:me (yours)
Score score:3 (3+)
score:0 (none)
Answers answers:3 (3+)
answers:0 (none)
isaccepted:yes
hasaccepted:no
inquestion:1234
Views views:250
Code code:"if (foo != bar)"
Sections title:apples
body:"apples oranges"
URL url:"*.example.com"
Saves in:saves
Status closed:yes
duplicate:no
migrated:no
wiki:no
Types is:question
is:answer
Exclude -[tag]
-apples
For more details on advanced search visit our help page
Results for nonlinear regression tagged with
Search options answers only not deleted score>= 2

Use this tag for any *on-topic* question that (a) involves `R` either as a critical part of the question or expected answer, & (b) is not *just* about how to use `R`.

106 votes
Accepted

How should tiny $p$-values be reported? (and why does R put a minimum on 2.22e-16?)

If you were to specify sufficient information about the exact circumstances (e.g. it's a regression, with this much nonlinearity, that amount of variation in this independent variable, this kind and amount …
Glen_b's user avatar
  • 290k
58 votes
Accepted

Is there any difference between lm and glm for the gaussian family of glm?

This allows you to fit particular forms of nonlinear relationship between $y$ (or rather its conditional mean) and the $x$-variables; while you can do this in nls as well, there's no need for starting … So - in relation to the title question - you can fit a substantially wider variety of Gaussian models with a GLM than with regression. …
Glen_b's user avatar
  • 290k
55 votes

Why is nls() giving me "singular gradient matrix at initial parameter estimates" errors?

regression model model: cost.per.car ~ a * exp(b * reductions) + c data: q24 a b c 0.003289 0.126805 48.487386 residual sum-of-squares: 2243 Number of iterations to … In some circumstances, a sequence of nonlinear fits is made where you can expect the solutions to change slowly. …
whuber's user avatar
  • 334k
55 votes
Accepted

How to find a good fit for semi-sinusoidal model in R?

While the linear model approach discussed here is simple to use, one advantage of @COOLSerdash's nonlinear regression approach is that it can deal with a much wider range of situations - you don't have … to change much before you're in a situation where linear regression is no longer suitable but nonlinear least-squares may still be used (having an unknown period would be one such case). …
Glen_b's user avatar
  • 290k
47 votes
Accepted

Setting knots in natural cubic splines in R

How to specify the knots in R The ns function generates a natural regression spline basis given an input vector. …
cardinal's user avatar
  • 27.3k
35 votes
Accepted

Transforming variables for multiple regression in R

John Fox's book An R companion to applied regression is an excellent ressource on applied regression modelling with R. … Modelling nonlinear relationships Two quite flexible methods to fit nonlinear relationships are fractional polynomials and splines. …
COOLSerdash's user avatar
  • 31.2k
30 votes
Accepted

Linear regression with slope constraint

I want to perform ... linear regression in R. ... I would like the slope to be inside an interval, let's say, between 1.4 and 1.6. How can this be done? (i) Simple way: fit the regression. … So lets use the constrained regression in nls: nls(y~a+b*x,algorithm="port", start=c(a=0,b=1.5),lower=c(a=-Inf,b=1.4),upper=c(a=Inf,b=1.6)) Nonlinear regression model model: y ~ a + b * x data …
Glen_b's user avatar
  • 290k
27 votes
Accepted

Identical coefficients estimated in Poisson vs Quasi-Poisson model

My general approach to this is graphical exploration of the raw data and regression diagnostics ... …
Ben Bolker's user avatar
  • 47.3k
26 votes

Fitting known equation to data

The simplest R function to do this is nls. (The R code I used is at the end of the answer.) … R code In terms of R code, it was simplest to define a general function for your temperature-response curve: trcFunc <- function(x,z,a,b){((a-x)/(a-z))*((x/z)^(z/b))} then give specific values for …
EdM's user avatar
  • 101k
21 votes
Accepted

What diagnostic plots exists for quantile regression?

A good compromise is to allow all main effects to be nonlinear using regression splines such as restricted cubic splines (natural splines). … For example, we can assess the combined contributions of nonlinear or interaction terms or both. An example follows, using the R rms and quantreg packages. …
Frank Harrell's user avatar
19 votes
Accepted

Linear regression not fitting well

It has a low $R^2$, indicating a lot of scatter and strong "regression to the mean": the regression line has a smaller slope than the major axis of this elliptical point cloud. … The same fit is plotted: now it looks curved due to the nonlinear way in which log odds are converted to probabilities. …
whuber's user avatar
  • 334k
18 votes
Accepted

Can someone shed light on linear vs. nonlinear mixed-effects?

There are several distinctions between linear and nonlinear regression models, but the primary mathematical one is that linear models are linear in the parameters, whereas nonlinear models are nonlinear … Pinheiro and Bates (2000, pp. 284-285), authors of the nlme R package, elegantly described the more substantive considerations in model selection: When choosing a regression model to describe how a …
FJF's user avatar
  • 331
16 votes
Accepted

MDS on large dataset (R or Python)

regression method. … I recall seeing a couple papers describe this kind of approach as a way to perform out-of-sample generalization for nonlinear dimensionality reduction algorithms in general. …
user20160's user avatar
  • 33.2k
16 votes

Calculating $R^2$ in mixed models using Nakagawa & Schielzeth's (2013) R2glmm method

I am answering by pasting Douglas Bates's reply in the R-Sig-ME mailing list, on 17 Dec 2014 on the question of how to calculate an $R^2$ statistic for generalized linear mixed models, which I believe … The proposal was to examine I think 9 different formulas that could be considered ways of computing an R2 for a nonlinear regression model to decide which one was "best". …
Robert Long's user avatar
  • 65.8k
14 votes
Accepted

Simple Log regression model in R

In my opinion, it's a good strategy to transform your data before performing linear regression model as your data show good log relation: > #generating the data > n=500 > x <- 1:n > set.seed(10) > y < … : 0.5236, Adjusted R-squared: 0.5226 F-statistic: 547.3 on 1 and 498 DF, p-value: < 2.2e-16 > > coef(fit) (Intercept) log(x) -6.469869 1.087886 > > #plot > x=seq(from=1,to=n,length.out …
Metariat's user avatar
  • 2,536

1
2 3 4 5
11
15 30 50 per page