[R] predicted values from rq

Spencer Graves spencer.graves at pdf.com
Tue Oct 14 15:27:12 CEST 2003


I'm not familiar with "rq".  By searching "www.r-project.org" -> search 
-> "R site search" for "quantreg", I found documentation.  This referred 
to Koenker, R. W., et al., apparently at the Econometrics at the 
University of Illinois.  Have you attempted to contact Koenker? 

hope this helps.  spencer graves

Landis, R Matthew wrote:

>Dear statistics and R experts,
> 
>I'm reposting the following message - I orginally posted it last Friday, and
>generated exactly no response.  I assume it got lost over the weekend
>(either that or it is just unbelievably obvious!).
> 
>I would like to plot the predicted values from a quantile regression
>analysis (quantreg v.3.31; R v.1.7.1) so that I can evaluate the fit.  
> 
>I fit the model using something like:  fit.rq <- rq(growth ~ ht*spp*light,
>tau = 0.9)
> 
>My response variable is tree growth (continuous), and my predictor variables
>are height (continuous), species (factor with 3 levels), and light (ordered
>factor with 3 levels).  I'd like to look at the relationship between growth
>and height separately for each combination of species and light.  
> 
>I would simply use 'predict()' as in lm, but unfortunately, there does not
>seem to be a predict method for rq objects (unless I am missing something?).
>I know how to extract coefficients from the rq object, and I've calculated
>predicted values by simply adding the relevant coefficients for a particular
>level of spp*light as:  intercept <- fit.rq$coef[1,1] + fit.rq$coef[3,1] +
>...; slope <- fit.rq$coef[2,1] + fit.rq$coef[5,1] +...)  but this is slow
>and awkward to do for each of the 9 levels (not to mention different values
>of tau).  Plus, I would eventually like to do some non-linear fits, and then
>it will be even worse.  I'm sure there must be a way to do this with a
>matrix of coefficients, if only my poor memory of linear algebra didn't
>prevent me from seeing it.
> 
>Is there a simple straightforward way to generate the predicted values
>without having to manually add up all the relevant coefficients for each
>level?  Or, even better, is predict.rq out there somewhere that I haven't
>found?  The help on rq objects does refer to it, but ?predict.rq doesn't
>turn up anything.
> 
>Thanks for any help,
>Matt
> 
>R. Matthew Landis, Ph.D.
>Dept. Biology
>Middlebury College
>Middlebury VT 05753
> 
>tel. 802/443.3484
>fax.802/443.2072
> 
>
>	[[alternative HTML version deleted]]
>
>______________________________________________
>R-help at stat.math.ethz.ch mailing list
>https://www.stat.math.ethz.ch/mailman/listinfo/r-help
>  
>




More information about the R-help mailing list