Unlimited learning, half price | 50% off

Last chance! 50% off unlimited learning

Sale ends in


quantregForest (version 0.2-2)

quantregForest: Quantile Regression Forests

Description

Quantile Regression Forests infer conditional quantile functions from data

Usage

quantregForest(x, y, mtry = ceiling(ncol(x)/3), nodesize = 10, ntree = 1000)

Arguments

x
A matrix or data.frame containing the predictor variables
y
The response variable; a numerical vector
mtry
The number of variables to try for each split; same default setting as for Random Forests
nodesize
The minimal number of instances in each terminal node; the default setting is slightly higher than for Random Forests
ntree
The number of trees to be grown

Value

  • A value of class quantregForest, for which print, plot, and predict methods are available.

Details

It might be useful to try various values of mtry and see which one works best; however, results are typically not heavily dependent on this parameter.

References

N. Meinshausen (2006) "Quantile Regression Forests", Journal of Machine Learning Research 7, 983-999 http://jmlr.csail.mit.edu/papers/v7/

See Also

For prediction, see predict.quantregForest

Examples

Run this code
################################################
##  Load air-quality data (and preprocessing) ##
################################################

data(airquality)
set.seed(1)


## remove observations with mising values
airquality <- airquality[ !apply(is.na(airquality), 1,any), ]

## number of remining samples
n <- nrow(airquality)


## divide into training and test data
indextrain <- sample(1:n,round(0.6*n),replace=FALSE)
Xtrain     <- airquality[ indextrain,2:6]
Xtest      <- airquality[-indextrain,2:6]
Ytrain     <- airquality[ indextrain,1]
Ytest      <- airquality[-indextrain,1]



################################################
##     compute Quantile Regression Forests    ##
################################################

qrf <- quantregForest(x=Xtrain, y=Ytrain)


## plot out-of-bag predictions for the training data
plot(qrf)

## compute out-of-bag predictions 
quant.outofbag <- predict(qrf)

## predict test data
quant.newdata  <- predict(qrf, newdata= Xtest)

Run the code above in your browser using DataLab