Displaying 20 results from an estimated 5000 matches similar to: "NLS error"
2012 Dec 16
1
nls for sum of exponentials
Hi there,
I am trying to fit the following model with a sum of exponentials -
y ~ Ae^(-md) + B e^(-nd) + c
the model has 5 parameters A, b, m, n, c
I am using nls to fit the data and I am using DEoptim package to pick the
most optimal start values -
fm4 <- function(x) x[1] + x[2]*exp(x[3] * -dist) + x[4]*exp(x[5] * -dist)
fm5 <- function(x) sum((wcorr-fm4(x))^2)
fm6 <- DEoptim(fm5,
2012 Sep 10
1
Rscript installing packages
Hi there
I have an Rscript and I am looking for a way to install a package
non-interactively. In Rscript {Utils}, I saw an example which does
something like this, however this does not seem to work for my particular
example. I am trying to install the following package in an Rscript
(without switching to interactive mode).
res <- try(install.packages("DEoptim"))
if(inherits(res,
2011 Jun 12
2
NLS fit for exponential distribution
Hello there,
I am trying to fit an exponential fit using Least squares to some data.
#data
x <- c(1 ,10, 20, 30, 40, 50, 60, 70, 80, 90, 100)
y <- c(0.033823, 0.014779, 0.004698, 0.001584, -0.002017, -0.003436,
-0.000006, -0.004626, -0.004626, -0.004626, -0.004626)
sub <- data.frame(x,y)
#If model is y = a*exp(-x) + b then
fit <- nls(y ~ a*exp(-x) + b, data = sub, start
2013 Jan 31
1
LogLik of nls
Hello there,
Can anyone point me to the code for logLik of an nls object? I found the
code for logLik of an lm but could not find exactly what function is used
for calculating the logLik of nls function?
I am using the nls to fit the following model to data -
Model 1: y ~ Ae^(-mx) + Be^(-nx) +c
and want to understand what is the likelihood function used by nls.
Presumably it is using -
2011 Aug 05
2
problemsn in using nls
Dear all,
I tried to use nls, but I got the following error
Error in numericDeriv(form[[3L]], names(ind), env) :
Missing value or an infinity produced when evaluating the model
Any suggestion?
Thanks,
Paola.
The code I wrote is
Data_pp2_mrna <- data.frame(
p1 = protein_1,
p6 = protein_6,
pp2_mrna
2012 Aug 23
1
All possible models with nls()
Hi all,
I am trying to make a script that prints all possible models from a model
I've created using nls(). It is a logisitc model which in total includes 13
variables. So its >8000 models I need to create, which I don't want to do
manually. I've tried modify scripts made for linear models with no results.
I've tried these scripts on a two variable model (c,a1 and a2 is what I
2011 Jun 12
1
Error in NLS example in the documentation
Hello there,
I am trying to use R function NLS to analyze my data and one of the examples
in the documentation is -
## the nls() internal cheap guess for starting values can be sufficient:
x <- -(1:100)/10
y <- 100 + 10 * exp(x / 2) + rnorm(x)/10
nlmod <- nls(y ~ Const + A * exp(B * x), trace=TRUE)
plot(x,y, main = "nls(*), data, true function and fit, n=100")
curve(100 +
2010 Oct 13
2
Using NLS with a Kappa function
Hi Everyone,
I am trying to use NLS to fit a dataset using a Kappa function, but I am
having problems. Depending on the start values that I provide, I get
either:
Error in numericDeriv(form[[3L]], names(ind), env) :
Missing value or an infinity produced when evaluating the model
Or
Error in nls(FldFatRate ~ funct3(MeanDepth_m, h, k, z, a), data = data1, :
singular gradient
I think these
2003 Mar 26
1
nls
Hi,
df <- read.table("data.txt", header=T);
library(nls);
fm <- nls(y ~ a*(x+d)^(-b), df, start=list(a=max(df->y,na.rm=T)/2,b=1,d=0));
I was using the following routine which was giving Singular Gradient, Error in
numericDeriv(form[[3]], names(ind), env) :
Missing value or an Infinity produced when evaluating the model errors.
I also tried the
2003 Jun 27
2
nls question
I'm running into problems trying to use the nls function to fit the some
data. I'm invoking nls using
nls(s~k/(a+r)^b, start=list(k=1, a=13, b=0.59))
but I get errors indicating that the step has been reduced below the
minimum step size or an inifinity is generated in numericDeriv. I've
tried to use a variety of starting values for a, b, k but get similar
errors.
Is there
2007 Feb 13
1
nls: "missing value or an infinity" (Error in numericDeriv) and "singular gradient matrix"Error in nlsModel
Hi,
I am a non-expert user of R. I am essaying the fit of two different functions to my data, but I receive two different error messages. I suppose I have two different problems here... But, of which nature? In the first instance I did try with some different starting values for the parameters, but without success.
If anyone could suggest a sensible way to proceed to solve these I would be
2009 Aug 25
3
Covariates in NLS (Multiple nonlinear regression)
Dear R-users,
I am trying to create a model using the NLS function, such that:
Y = f(X) + q + e
Where f is a nonlinear (Weibull: a*(1-exp(-b*X^c)) function of X and q is a covariate (continous variable) and e is an error term. I know that you can create multiple nonlinear regressions where x is polynomial for example, but is it possible to do this kind of thing when x is a function with unknown
2008 May 06
2
NLS plinear question
Hi All.
I've run into a problem with the plinear algorithm in nls that is confusing
me.
Assume the following reaction time data over 15 trials for a single unit.
Trials are coded from 0-14 so that the intercept represents reaction time in
the first trial.
trl RT
0 1132.0
1 630.5
2 1371.5
3 704.0
4 488.5
5 575.5
6 613.0
7 824.5
8 509.0
9
2004 Feb 19
1
controlling nls errors
Hello. I am using the nonlinear least squares function (nls). The
function that I am trying to fit seems to be very sensitive to the
starting values and, if these are not chosen properly, the nls function
stops and gives an error message:
Error in numericDeriv(form[[3]], names(ind), env) :
Missing value or an Infinity produced when evaluating the model
In addition: Warning
2012 Jul 26
3
Solving quadratic equation in R
Hi there,
I would like to solve a simple equation in R
a^2 - a = 8.313
There is no real solution to this problem but I would like to get an
approximate numerical solution. Can someone suggest how I can set this up?
Thanks in advance,
Diviya
[[alternative HTML version deleted]]
2005 Aug 18
1
How to put factor variables in an nls formula ?
Hello,
I want to fit a Gompertz model for tree diameter growth that depends on a 4
levels edaphic factor (?Drain?) and I don?t manage to introduce the factor
variable in the formula.
Dinc is the annual diameter increment and D is the Diameter.
>treestab
> Dinc D Drain
[1,] 0.03 26.10 2
[2,] 0.04 13.05 1
[3,] 0.00 24.83 1
[4,] 0.00 15.92 4
2006 Nov 08
1
nls
> y
[1] 1 11 42 64 108 173 214
> t
[1] 1 2 3 4 5 6 7
> nls(1/y ~ c*exp(-a*b*t)+1/b, start=list(a=0.001,b=250,c=5), trace=TRUE)
29.93322 : 0.001 250.000 5.000
Error in numericDeriv(form[[3]], names(ind), env) :
Missing value or an infinity produced when evaluating the model
# the start value for b is almost close to final estimates,
# a is usually
2011 Oct 01
1
Problem with logarithmic nonlinear model using nls() from the `stats' package
Example:
> f <- function(x) { 1 + 2 * log(1 + 3 * x) + rnorm(1, sd = 0.5) }
> y <- f(x <- c(1 : 10)); y
[1] 4.503841 5.623073 6.336423 6.861151 7.276430 7.620131 7.913338 8.169004
[9] 8.395662 8.599227
> nls(x ~ a + b * log(1 + c * x), start = list(a = 1, b = 2, c = 3), trace = TRUE)
37.22954 : 1 2 3
Error in numericDeriv(form[[3L]], names(ind), env) :
Missing value or an
2006 Aug 15
4
nls
Is there anyway to change any y[i] value (i=2,...6) to make following NLS workable?
x <- c(0,5,10,15,20,25,30)
y <- c(1.00000,0.82000,0.68000,0.64000,0.66667,0.68667,0.64000)
lm(1/y ~~ x)
nls(1/y ~~ a+b*x^c, start=list(a=1.16122,b=0.01565,c=1), trace=TRUE)
#0.0920573 : 1.16122 0.01565 1.00000
#Error in numericDeriv(form[[3]], names(ind), env) :
# Missing value or
2010 Apr 25
1
Manipulating text files
Dear R Community,
I am trying to optimize a water quality model that I am using. Based on conversations with others more familiar with what I am doing I plan to implement DEOptim to do this. The water quality model is interfaced through a GUI. I have the input file necessary to alter parameters and run the model as a text file.
To do the optimization I have figured out the general procedure