Skip to content

problems with nls?

2 messages · per243, Brian Ripley

#
I need to make nonlinear regression with the posterior script, but how is the
problem? I have error in library (nls), package 'nls' has been merged into
'stats'.
I need help?
What other forms I have to make nonlinear regression? and how I find to
calculate statistics y residuals, scatterplot.

thanks



SCRIPT

ros<-read.table("Dataset.csv",header=T,sep=",")
ros
attach(ros)


# preliminaries

options(width=44)
options(digits=3)
    
## Nonlinear Regression

par(mfrow=c(1,2))

attach(ros)
plot(U1.7km, R, main="(a)")


library(nls)
mod1<-nls(R ~
beta1*(U1.7km^beta2)+(Hm^beta3)),start=list(beta1=2.031,beta2=0.800,beta3=-0.255),
trace = TRUE)

summary(mod1)
coef(mod1)
coef(summary(mod1))

lines(R, fitted.values(mod1), lwd=2)

plot(R, residuals(mod1), type="b", main="(b)")
abline(h=0, lty=2)
#
I don't see why this is relevant to R-devel rather than R-help.

Your script must be very old: the NEWS for R 1.9.0 said

         Packages ctest, eda, modreg, mva, nls, stepfun and ts have been
         merged into stats, and lqs has been returned to MASS.

That's 5 years ago now.

Function nls() still exists, and is in the 'stats' package which is 
loaded in a default R session.
On Wed, 4 Mar 2009, per243 wrote:

            
It was _not_ an error:
Warning message:
package 'nls' has been merged into 'stats'

so if your script did not run something else was the error.  (We don't 
have the dataset, so cannot reproduce what you did.)
Please read 'An Introduction to R' and then a basic book on 
statistics with R.