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

From: Denis Chabot <chabotd_at_globetrotter.net>
Date: Sun 05 Feb 2006 - 11:54:35 EST


I have used package quantreg to estimate a non-linear fit to the lowest part of my data points. It works great, by the way.

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.

I used the same technique I used to extract predicted values of GAM fits with mgcv package: if I fit a GAM using x as the x variable on which I smooth, I then create such a dataframe like this

MyX <- data.frame(x=seq(-1,60))

This works fine with GAM (mgcv) but not with quantreg:

> 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?

Thanks in advance,

Denis Chabot

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 Sun Feb 05 12:02:22 2006

This archive was generated by hypermail 2.1.8 : Fri 03 Mar 2006 - 03:42:23 EST