PartitionParty: Plot the partitions of a partykit tree model

Description Usage Arguments Author(s) Examples

Description

COmputes and plots the partitions of a partykit tree model in 2 dimensions.

Usage

1
2
3
4
PartitionParty(ct, vars = c("lon", "lat"), BBOX, PLOT = TRUE, 


    labs = TRUE, verbose = 0)

Arguments

ct

object of class partykit

vars

variable names in 2D

BBOX

bounding box

PLOT

overlay retangles?

labs

add node ID labels to plot ?

verbose

level of verbosity

Author(s)

Markus Loecher

Examples

  1
  2
  3
  4
  5
  6
  7
  8
  9
 10
 11
 12
 13
 14
 15
 16
 17
 18
 19
 20
 21
 22
 23
 24
 25
 26
 27
 28
 29
 30
 31
 32
 33
 34
 35
 36
 37
 38
 39
 40
 41
 42
 43
 44
 45
 46
 47
 48
 49
 50
 51
 52
 53
 54
 55
 56
 57
 58
 59
 60
 61
 62
 63
 64
 65
 66
 67
 68
 69
 70
 71
 72
 73
 74
 75
 76
 77
 78
 79
 80
 81
 82
 83
 84
 85
 86
 87
 88
 89
 90
 91
 92
 93
 94
 95
 96
 97
 98
 99
100
if (0){


  


  library(partykit)


  library(rpart)


  #unimodal bump


  data(data1, envir = environment())


  rp = rpart(l ~ x + y, data = data1)


  #plot(rp)


  party_rp <- partykit::as.party(rp)


  plot(party_rp)


  


  plot(y ~ x, col = as.numeric(l), data = data1, cex = 0.5, pch=20)


  PartitionParty(party_rp,vars=c("x","y"), verbose=0)


  


  #elliptical bump:


  data(data2, envir = environment())


  rp = rpart(l ~ x + y, data = data2)


  #plot(rp)


  party_rp <- as.party(rp)


  plot(party_rp)


  


  plot(y ~ x, col = as.numeric(l)-1, data = data2, cex = 0.5, pch=20)


  PartitionParty(party_rp,vars=c("x","y"), verbose=0) 


  


  #Artifial data at multiple scales and angles:


  data(msdata, envir = environment())


  ct <- ctree(clus ~ lon+lat,data = msdata,


              control = ctree_control(multiway=TRUE))


  


  plot(ct)


  plot(lat ~ lon,data = msdata, col = clus, pch=20,cex=0.6)


  PartitionParty(ct,vars=c("lon","lat"), verbose=0)


}


print(1)

TreeHotspots documentation built on May 2, 2019, 5:17 p.m.