search for: nlmrt

Displaying 20 results from an estimated 24 matches for "nlmrt".

2012 Jul 11
2
nls problem: singular gradient
Why fails nls with "singular gradient" here? I post a minimal example on the bottom and would be very happy if someone could help me. Kind regards, ########### # define some constants smallc <- 0.0001 t <- seq(0,1,0.001) t0 <- 0.5 tau1 <- 0.02 # generate yy(t) yy <- 1/2 * ( 1- tanh((t - t0)/smallc) * exp(-t / tau1) ) + rnorm(length(t))*0.01 # show the curve
2013 Apr 01
2
Is DUD available in nls()?
SAS has DUD (Does not Use Derivatives)/Secant Method for nonlinear regression, does R offer this option for nonlinear regression? I have read the helpfile for nls() and could not find such option, any suggestion? Thanks, Derek [[alternative HTML version deleted]]
2012 Oct 11
1
nls NAs
Hi- I am using the following code: start=c(alpha=0.4,beta=0.4) warm.10<-nls(warming$umoles60~alpha*exp(beta*warming$T10cm),start = start,data=warming,na.action=na.omit) This code works for other columns in my dataset that are similar to $T10cm but the code does not work for this particular column (T10cm). I am assuming this is because warming$T10cm contains NAs. I have tried just
2012 Jun 04
2
Non-linear curve fitting (nls): starting point and quality of fit
Hi all, Like a lot of people I noticed that I get different results when I use nls in R compared to the exponential fit in excel. A bit annoying because often the R^2 is higher in excel but when I'm reading the different topics on this forum I kind of understand that using R is better than excel? (I don't really understand how the difference occurs, but I understand that there is a
2012 Nov 28
1
Problems with nls
The problem is badly scaled -- parameters from very small to very big. nlmrt package manages a bit better, but scaling would likely make it and nls both happier. nlxb insists on having its data in a data frame. Here's my code rm(list=ls()) Laptop_sale <- c(1405, 1863,2027,2669,2938,5275,6595,6943,8621,10905,12420,22400,32380,31600,34900,43163,47838,47592) CuSale &...
2012 Oct 18
3
Upper limit in nlsLM not working as expected
Dear all, I am using the nlsLM function to fit a Lorentzian function to my experimental data. The LM algorithm should allow to specify limits, but the upper limit appears not to work as expected in my code. The parameter 'w', which is peak width at half maximuim always hits the upper limit if the limit is specified. I would expect the value to be in-between the upper and lower limit with
2013 Oct 03
2
SSweibull() : problems with step factor and singular gradient
SSweibull() :  problems with step factor and singular gradient Hello I am working with growth data of ~4000 tree seedlings and trying to fit non-linear Weibull growth curves through the data of each plant. Since they differ a lot in their shape, initial parameters cannot be set for all plants. That’s why I use the self-starting function SSweibull(). However, I often got two error messages:
2012 Mar 18
1
Converting expression to a function
Previously, I've posted queries about this, and thanks to postings and messages in response have recently had some success, to the extent that there is now a package called nlmrt on the R-forge project https://r-forge.r-project.org/R/?group_id=395 for solving nonlinear least squares problems that include small or zero residual problems via a Marquardt method using a call that mirrors the nls() function. nls() specifically warns against zero residual problems. However, I wo...
2023 Aug 20
3
Issues when trying to fit a nonlinear regression model
Dear friends, This is the dataset I am currently working with: >dput(mod14data2_random) structure(list(index = c(14L, 27L, 37L, 33L, 34L, 16L, 7L, 1L, 39L, 36L, 40L, 19L, 28L, 38L, 32L), y = c(0.44, 0.4, 0.4, 0.4, 0.4, 0.43, 0.46, 0.49, 0.41, 0.41, 0.38, 0.42, 0.41, 0.4, 0.4 ), x = c(16, 24, 32, 30, 30, 16, 12, 8, 36, 32, 36, 20, 26, 34, 28)), row.names = c(NA, -15L), class =
2015 Mar 19
0
nls
nls() is using 1) only a Gauss-Newton code which is prone to some glitches 2) approximate derivatives Package nlmrt uses symbolic derivatives for expressions (you have to provide Jacobian code for R functions) and an aggressive Marquardt method to try to reduce the sum of squares. It does return more information about the problem (singular values of the final Jacobian and gradient at the proposed solution) but d...
2012 Nov 15
0
problem in fitting model in NLS function
Bad scaling will waste a lot of everyone's time. I put the data in a data frame mdat, then library(nlmrt) mdat<-read.csv("muzzamil.csv", header=T) fmn <- nlxb(y~a * (x^b), data=mdat, start=c(a=1,b=1), trace=T) fm <- nls(y~a * (x^b), data=mdat, start=c(a=1,b=1), trace=T) fmn2 <- nlxb(y~a2 * ((x-1979)^b2), data=mdat, start=c(a2=1,b2=1), trace=T) fm2 <- nls(y~a2 * ((x-1979)^b2),...
2013 Jun 20
0
R-help Digest, Vol 124, Issue 21
And it could be that you should try nlmrt or minpack.lm. I don't think you were at my talk in Jena May 23 -- might have been very helpful to you. JN On 13-06-20 06:00 AM, r-help-request at r-project.org wrote: > Message: 47 > Date: Wed, 19 Jun 2013 13:17:29 -0500 > From: "Adams, Jean"<jvadams at usgs.gov>...
2012 Apr 17
3
error using nls with logistic derivative
Hi I?m trying to fit a nonlinear model to a derivative of the logistic function y = a/(1+exp((b-x)/c)) (this is the parametrization for the SSlogis function with nls) The derivative calculated with D function is: > logis<- expression(a/(1+exp((b-x)/c))) > D(logis, "x") a * (exp((b - x)/c) * (1/c))/(1 + exp((b - x)/c))^2 So I enter this expression in the nls function:
2016 Apr 26
0
Linear Regressions with constraint coefficients
...raint that the coefficients sum to 1 is implied by dividing them by their sum and then dividing the coefficients found by their sum at the end: # test data set.seed(123) n <- 1000 X1 <- rnorm(n) X2 <- rnorm(n) X3 <- rnorm(n) Y <- .2 * X1 + .3 * X2 + .5 * X3 + rnorm(n) # fit library(nlmrt) fm <- nlxb(Y ~ (b1 * X1 + b2 * X2 + b3 * X3)/(b1 + b2 + b3), data = list(Y = Y, X1 = X1, X2 = X2, X3 = X3), lower = numeric(3), start = list(b1 = 1, b2 = 2, b3 = 3)) giving the following non-negative coefficients which sum to 1 that are reasonably close to the true values of 0.2...
2012 May 17
3
nls and if statements
Hi All, I have a situation where I want an 'if' variable to be parameterized. It's entirely possible that the way I'm trying to do this is wrong, especially given the error message I get that indicates I can't do this using an 'if' statement. Essentially, I have data where I think a relationship enters when a variable (here Pwd) is below some value (z). I don't
2016 Apr 28
2
Linear Regressions with constraint coefficients
...raint that the coefficients sum to 1 is implied by dividing them by their sum and then dividing the coefficients found by their sum at the end: # test data set.seed(123) n <- 1000 X1 <- rnorm(n) X2 <- rnorm(n) X3 <- rnorm(n) Y <- .2 * X1 + .3 * X2 + .5 * X3 + rnorm(n) # fit library(nlmrt) fm <- nlxb(Y ~ (b1 * X1 + b2 * X2 + b3 * X3)/(b1 + b2 + b3), data = list(Y = Y, X1 = X1, X2 = X2, X3 = X3), lower = numeric(3), start = list(b1 = 1, b2 = 2, b3 = 3)) giving the following non-negative coefficients which sum to 1 that are reasonably close to the true values of 0.2...
2016 Apr 28
0
Linear Regressions with constraint coefficients
...viding them by their sum and then dividing the coefficients found by their sum at the end: > > # test data > set.seed(123) > n <- 1000 > X1 <- rnorm(n) > X2 <- rnorm(n) > X3 <- rnorm(n) > Y <- .2 * X1 + .3 * X2 + .5 * X3 + rnorm(n) > > # fit > library(nlmrt) > fm <- nlxb(Y ~ (b1 * X1 + b2 * X2 + b3 * X3)/(b1 + b2 + b3), > data = list(Y = Y, X1 = X1, X2 = X2, X3 = X3), > lower = numeric(3), > start = list(b1 = 1, b2 = 2, b3 = 3)) > > giving the following non-negative coefficients which sum to 1 that are reasonably cl...
2013 Mar 14
2
question about nls
Hi,all: I met a problem of nls. My data: x y 60 0.8 80 6.5 100 20.5 120 45.9 I want to fit exp curve of data. My code: > nls(y ~ exp(a + b*x)+d,start=list(a=0,b=0,d=1)) Error in nlsModel(formula, mf, start, wts) : singular gradient matrix at initial parameter estimates I can't find out the reason for the error. Any suggesions are welcome. Many thanks. [[alternative HTML
2013 Mar 15
2
nlrob and robust nonlinear regression with upper and/or lower bounds on parameters
I have a question regarding robust nonlinear regression with nlrob. I would like to place lower bounds on the parameters, but when I call nlrob with limits it returns the following error: "Error in psi(resid/Scale, ...) : unused argument(s) (lower = list(Asym = 1, mid = 1, scal = 1))" After consulting the documentation I noticed that upper and lower are not listed as parameter in
2013 Jul 09
3
fitting log function: errors using nls and nlxb
Hi- I am trying to fit a log function to my data, with the ultimate goal of finding the second derivative of the function. However, I am stalled on the first step of fitting a curve. When I use the following code: FG2.model<-(nls((CO2~log(a*Time)+b), start=setNames(coef(lm(CO2 ~ log(Time), data=FG2)), c("a", "b")),data=FG2)) I get the following error: Error in