Learn R Programming

ConsRankClass (version 1.0.1)

predict.ranktree: 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 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

See Also

ranktree validatetree

Examples

Run this code
# NOT RUN {
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
# }
# NOT RUN {


# }

Run the code above in your browser using DataLab