predict.ranktree {ConsRankClass} | R Documentation |
Predict the median rankings for new observations
Description
Predict the median rankings in a tree-based structure built with ranktree
for new observations
Usage
## S3 method for class 'ranktree'
predict(object, newx, ...)
Arguments
object |
An object of the class "ranktree" |
newx |
A dataframe of the same nature of the predictor dataframe with which the tree has been built |
... |
System reserved (No specific usage) |
Value
A list containing:
rankings | the fit in terms of rankings | |
orderings | the fit in terms of orderings | |
info | dataframe containing the terminal nodes in which the new x fall down, then the new x and the fit (in terms of rankings) |
Author(s)
Antonio D'Ambrosio antdambr@unina.it
See Also
Examples
data(EVS)
EVS$rankings[is.na(EVS$rankings)] <- 3
set.seed(654)
training=sample(1911,1434)
tree <- ranktree(EVS$rankings[training,],EVS$predictors[training,],decrmin=0.001,num=50)
#use the function predict ro predict rankings for new predictors
rankfit <- predict(tree,newx=EVS$predictors[-training,])
#fit in terms of rankings
rankfit$rankings
#fit in terms of orderings
rankfit$orderings
# information about the fit (terminal node, predictor and fit (in terms of rankings))
rankfit$info
[Package ConsRankClass version 1.0.1 Index]