predict.ranktree: Predict the median rankings for new observations

Description Usage Arguments Value Author(s) See Also Examples

View source: R/predict.ranktree.R

Description

Predict the median rankings in a tree-based structure built with ranktree for new observations

Usage

1
2
## 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

ranktree validatetree

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
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

ConsRankClass documentation built on Sept. 28, 2021, 5:10 p.m.