Re: [R] how to extract predicted values from a quantreg fit?

From: Dieter Menne <dieter.menne_at_menne-biomed.de>
Date: Mon 06 Feb 2006 - 19:37:01 EST

Denis Chabot <chabotd <at> globetrotter.net> writes:

.... Quantreg package ....

> But I'd like to extract the predicted values. The help for
> predict.qss1 indicates this:
..
> predict.qss1(object, newdata, ...)
> and states that newdata is a data frame describing the observations
> at which prediction is to be made.
..
>
> > y <- rnorm(500, 10, 5)
> > x <- rep(seq(1,50,1), 10)
> > My.data <- data.frame(x, y)
> > My.x <- data.frame(x=seq(5,45))
> >
> > fit <- rqss(y ~ qss(x, lambda=5), tau=0.05)
> > pred <- predict.qss1(fit, My.x)
>
> Could someone please help me creating a dataframe "newdata" that
> would satisfy predict.qss1?

Looks like quantreg has been reworked, but predict was not tested. Checking the code, I got a (hopefully) working solution

pred <- predict.qss1(fit$qss[[1]]$xyz, My.x$x)

but this follow neither convention nor documentation. Maybe you should contact the author of the package to provide an example in the documentation, which would have show the problem earlier.

Dieter



R-help@stat.math.ethz.ch mailing list
https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html Received on Mon Feb 06 19:48:13 2006

This archive was generated by hypermail 2.1.8 : Tue 07 Feb 2006 - 00:53:43 EST