[R] Fitting nonlinear (quantile) models to linear data.

Brian S Cade brian_cade at usgs.gov
Wed Feb 4 20:54:49 CET 2004


Roly:  I don't know if I can speak to your question about the linear model
fit with the nonlinear function.  But in general I have observed that when
using a fairly flexible nonlinear model form in nlrq() that initial
estimates obtained for any specified quantile may be quite erroneous in the
sense that the proportion of residuals less than or greater than the
estimate are way off what they should be for a specified quantile (e..g,
for tau = 0.90, I've obtained initial estimates that might have as few as
75% of the residuals <= estimate or as many as 97% <= estimate; we would
like a solution that has close to 90% <= estimate (with some inequality
required because of the zero residuals associated with the fit).  This
seems to produce both some strange fits when plotted against the data as
well as some fits that might seem reasonable but have to be wrong.   It
seems to be quite important with this nlrq() code to explore different
starting values and tolerance values before you can believe that you've
converged to a reasonable solution for any selected quantile.   I always
check the proportion of residuals <= estimate as I iterate through
solutions.  You might want to check this for your models.   Again, I repeat
the problems I've had with this occur with very heterogeneous data with
fairly flexible nonlinear functions (e.g., piecewise linear models with
unknown breakpoints and quadratic curvature allowed to connect the pieces).

Any comments\suggestions from Roger Koenker?

Brian


Brian S. Cade

U. S. Geological Survey
Fort Collins Science Center
2150 Centre Ave., Bldg. C
Fort Collins, CO  80526-8818

email:  brian_cade at usgs.gov
tel:  970 226-9326


                                                                                                                
                      Roly Russell                                                                              
                      <russelr at science.orego        To:       r-help at stat.math.ethz.ch                          
                      nstate.edu>                   cc:                                                         
                      Sent by:                      Subject:  [R] Fitting nonlinear (quantile) models to linear 
                      r-help-bounces at stat.ma         data.                                                      
                      th.ethz.ch                                                                                
                                                                                                                
                                                                                                                
                      02/04/2004 08:47 AM                                                                       
                                                                                                                
                                                                                                                




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)

______________________________________________
R-help at stat.math.ethz.ch mailing list
https://www.stat.math.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide!
http://www.R-project.org/posting-guide.html




More information about the R-help mailing list