[R-sig-eco] Quantile regressions across several predictors

Drew Tyre atyre2 at unl.edu
Thu May 26 16:47:55 CEST 2016


I'm not sure I understand what you want to do. 

> but in this case, we might want to use the
> 50% quantile (i.e., mean) of each predictor.  

You mean, use the median of pred1 to predict variation in dependent? But then all rows would have the same value - just predicting using a constant. 

library(readr)
library(dplyr)
test <- read_delim("test.txt", " ")
apply(test,2,median)
#    pred1     pred2     pred3 dependent 
#  11.000    17.000     8.000  1048.716


> standard approach for dealing with multiple predictors, that when binned,

So by "binned" do you mean converting pred1 to a categorical predictor that divides the continuous pred1 into, say, two bins, above the median and below the median? And then a different predictor is pred1 cut into 4 bins, like this:

test <- mutate(test,pred1_2 = cut(pred1,2), pred1_4 = cut(pred1,4))
test
#Source: local data frame [71 x 6]

#   pred1 pred2 pred3 dependent  pred1_2    pred1_4
#  (int) (int) (int)     (dbl)   (fctr)     (fctr)
#1      2    14     4  800.5987 (1.99,9] (1.99,5.5]
#2      2    18    11  414.1341 (1.99,9] (1.99,5.5]
#3     11    15    12  825.5466   (9,16]   (9,12.5]
#4     11    15    12 1143.9720   (9,16]   (9,12.5]
#5     11    14     3  904.4725   (9,16]   (9,12.5]
#6     11    18    15  433.1852   (9,16]   (9,12.5]
#7     11    22    14  726.6624   (9,16]   (9,12.5]
#8     11    16     2 1450.1500   (9,16]   (9,12.5]
#9     12    20     2  670.4164   (9,16]   (9,12.5]
#10    12    19     7  741.6311   (9,16]   (9,12.5]
#..   ...   ...   ...       ...      ...        ...

And you question is how to compare a model
Dependent~pred1_2
Vs
Dependent~pred1_4
? You don't want to include both in the same model because they are highly correlated. Assuming my interpretation of what you want is correct, I believe your best approach is to compare multiple models with AIC, which works with non-nested models. 


-- 
Drew Tyre

School of Natural Resources
University of Nebraska-Lincoln
416 Hardin Hall, East Campus
3310 Holdrege Street
Lincoln, NE 68583-0974

phone: +1 402 472 4054 
fax: +1 402 472 2946
email: atyre2 at unl.edu
http://snr.unl.edu/tyre
http://atyre2.github.io
ORCID: orcid.org/0000-0001-9736-641X



More information about the R-sig-ecology mailing list