Dan, It is hard to say without being able to reproduce your example. If you send me the data I could try to advise something.
Roger url: www.econ.uiuc.edu/~roger Roger Koenker email rkoen...@uiuc.edu Department of Economics vox: 217-333-4558 University of Illinois fax: 217-244-6678 Urbana, IL 61801 On Feb 13, 2012, at 7:50 AM, Dan Morovitz wrote: > Hi, > > > I'm attempting to calculate the 0.25 and 0.97 quantiles for tree height (0-50 > meters) against tree age (0-300 years) and I am running into some difficulty > with the plotted grafic. I've run the examples in the quantreg help and can > get those to work properly and by plugging in my data I can also get the > lines plotted on my dataset. Unfortunately I'm running into a problem with > the median and other regression lines with tree age younger than 50 years, > basically the median is in this range overestimated and even comes out of the > rage of oberservations. here is the code I'm using. > > > # then fit the median using nlrq > > spruce.nlrq <- nlrq(height ~ SSlogis(age, Asym, mid, scal),data=spruce, > tau=0.5, trace=TRUE) > lines(1:200, predict(spruce.nlrq, newdata=list(age=1:200)), col="2") > > > I believe this has something to do with the SSlogis, as this gives the > parameters for an S curve. My data set does not have the typical S curve > shape, instead you could image it as starting at the inflection point of an S > curve. This is what I expect the .025 quantile to be similar to: > > x <- seq(1,100,1) > plot(log(x)) > > > the 0,975 should also have a logarithmic shape but no such a steep incline. > Ive tried using different self starting models as found under: > > apropos("^ss") > > > however I have not gotten them to work, or at least to fix the problem. > Curves similar to mine look like these site index curves: > http://www.extension.umn.edu/distribution/naturalresources/components/3473-13.html > > In the example from the nlrq help the lines of the median and the various > quantiles all start from the same location, tha is basically (x=0, y=0) in > the coodinate plane. With my problem, the lines start to be drawn from > various different positions ( the lines always start at age(x)=0, but the > height(y) can range between 0 and 15). > Additionally, the data set is quite large. with about 50,000 oberservations > on age and height. > Does anyone have a suggestion on how to fix this problem? > Thanks in advance > Dan > > [[alternative HTML version deleted]] > > ______________________________________________ > R-help@r-project.org mailing list > https://stat.ethz.ch/mailman/listinfo/r-help > PLEASE do read the posting guide http://www.R-project.org/posting-guide.html > and provide commented, minimal, self-contained, reproducible code. ______________________________________________ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.