Displaying 6 results from an estimated 6 matches for "nlmod".
2010 Apr 19
3
nls for piecewise linear regression not converging to least square
...the overly precise numbers,
they are just copied from real data.
y1<-c(2.37700445, 1.76209775, 0.09795576, 2.21834963, 6.62262243,
15.70471269, 21.92956392, 36.39401717, 32.43620195, 44.77442277)
x1<-c(24.6, 28.9, 33.2, 37.6, 42.0, 46.4, 50.9, 55.3, 59.8, 64.3)
dat <- data.frame(x1,y1)
nlmod <- nls(y1 ~ ifelse(x1 < xint+(yint/slp), yint, yint +
(x1-(xint+(yint/slp)))*slp),
data=dat, control=list(minFactor=1e-5,maxiter=500,warnOnly=T),
start=list(xint=39.27464924, yint=0.09795576, slp=2.15061064),
na.action=na.omit, trace=T)
##plotting the func...
2010 Apr 19
2
nls minimum factor error
...me understand or throw out some possibilities?
##Here's a sample dataset and code.
y2<-c(2.404529, 1.625661, 1.013981, 3.810921, 10.023745, 10.990817,
10.740636, 11.246827,17.022761, 21.430386)
x2<-c(25.0, 29.3, 33.8, 38.3, 42.8, 47.2, 51.6, 55.8, 60.4, 64.9)
dat <- data.frame(x2,y2)
nlmod <- nls(y2 ~ ifelse(x2 < xint+(yint/slp), yint, yint +
(x2-(xint+(yint/slp)))*slp),
data=dat, control=list(minFactor=1e-5,maxiter=500,warnOnly=T),
start=list(xint=40.49782, yint=1.013981, slp=0.8547828),
na.action=na.omit, trace=T)
##plotting the function
p...
2012 Feb 13
3
fit data to y~A+B*sin(C*x)
...fit discrete data that was measured on a wavegenerator.
In this minimal example i generate some artificial data:
testsin <- 2+ 5 * sin(1:100) #generate sin data
testsin <- testsin+ rnorm(length(testsin), sd = 0.01) #add noise
mydata <- list(X=1:100, Y=testsin) # generate mydata object
nlmod <- nls(X ~ A+B*sin(C* Y), data=mydata, start=list(A=2, B=4, C=1), trace=TRUE)
# this nls fit fails.
Who can help me to fit this type of data?
Kind regards,
--
Jonas Stein <news at jonasstein.de>
2013 Apr 05
1
white heteroskedasticity standard errors NLS
Hello
Is there any function to calculate White's standard errors in R in an NLS
regression.
The sandwich and car package do it but they need an lm object to calculate
the error's.
Does anyone have idea how to do it for an NLS object ?
Regards
The woods are lovely, dark and deep
But I have promises to keep
And miles before I go to sleep
And miles before I go to sleep
-----
[[alternative
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 + 10 * exp(x / 2), col=4, add = TRUE)
lines(x, predict(nlmod), col=2)
However, when I try to execute this - I get the following error-
Error in nls(y ~ Const + A...
2013 Apr 25
3
nls: example code throws error
Greets,
I'm trying to learn to use nls and was running the example code for an exponential model:
> x <- -(1:100)/10
> y <- 100 + 10 * exp(x / 2) + rnorm(x)/10
> nlmod <- nls(y ~ Const + A * exp(B * x))
Error in B * x : non-numeric argument to binary operator
In addition: Warning message:
In nls(y ~ Const + A * exp(B * x)) :
No starting values specified for some parameters.
Initializing ‘Const’ to '1.'.
Consider specifying 'start' or using a...