[R] Fitting nonlinear (quantile) models to linear data.
Roly Russell
russelr at science.oregonstate.edu
Wed Feb 4 16:47:11 CET 2004
Hello.
I am trying to fit an asymptotic relationship (nonlinear) to some
ecological data, and am having problems. I am interested in the upper
bound on the data (i.e. if there is an upper limit to 'y' across a range
of 'x'). As such, I am using the nonlinear quantile regression package
(nlrq) to fit a michaelis mention type model.
The errors I get (which are dependant on the quantile of interest and the
particular dataset) tend to result in illogical regression results with
the nlqr package.
To test this, I created artificial datasets that were based on underlying
asymptotic or linear data. When tested with a nonlinear model, the linear
data produces an error (step factor reduced below 'midFactor'--a problem
dealt with previously on this list). This script is below, for interest.
My question is whether this is a problem that I should deal with through
fixing my script somehow, or whether fitting a nonlinear model to data
that may have an underlying linear pattern is inherently statistically
wrong (I thought that I could use the estimate of the asymptote as a
metric of how linear versus asymptotic the data were).
Many thanks, in advance.
roly russell - oregon state university
PS - I have not consulted Bates & Watts yet; I will.
# build artificial data with multiplicative error
Dat <- NULL; Dat$x <- rep(seq(1,25,by=3), 5)
set.seed(1)
Dat$y <- SSmicmen(Dat$x, 50, 12)*rnorm(45, 1, 0.1)
plot(Dat)
# fit a classical least-square regression
Dat.nls <- nls(y ~ SSmicmen(x, Vmax, Km), data=Dat); Dat.nls
lines(1:25, predict(Dat.nls, newdata=list(x=1:25)), col=1)
# the 1st and 3rd quartiles regressions
Dat.nlrq <- nlrq(y ~ SSmicmen(x, Asym, mid), data=Dat, tau=0.25,
trace=TRUE)
lines(1:25, predict(Dat.nlrq, newdata=list(x=1:25)), col=3)
Dat.nlrq <- nlrq(y ~ SSmicmen(x, Asym, mid), data=Dat, tau=0.75,
trace=TRUE)
lines(1:25, predict(Dat.nlrq, newdata=list(x=1:25)), col=3)
# build artificial LINEAR data with multiplicative error
Dat <- NULL; Dat$x <- rep(1:25, 2)
set.seed(1)
Dat$y <- (Dat$x)*rnorm(50, 1, 0.1)
plot(Dat)
# fit first a classical least-square regression
Dat.nls <- nls(y ~ SSmicmen(x, Vmax, Km),
data=Dat,control=nls.control(minFactor=1/4096)); Dat.nls
lines(1:25, predict(Dat.nls, newdata=list(x=1:25)), col=1)
More information about the R-help
mailing list