1. Home
  2. BRVALUES procedure

BRVALUES procedure

Forms values for nodes of a regression tree (R.W. Payne).

Options

Y = variate Values of the response variate for the new data set
TREE = tree Tree for which predictions and accuracy values are to be formed
REPLACE = string token Whether to replace the values stored in the tree (yes, no); default no
PREDICTION = pointer New predictions for the nodes of the tree
ACCURACY = pointer New accuracy values for the nodes of the tree
NOBSERVATIONS = pointer New numbers of observarions for the nodes of the tree

Parameter

X = variates Values of the x-variates for the new data set

Description

When pruning a regression tree, it is best to use “accuracy” figures that are derived from a different set or sets of data from that which was used to construct the tree. BRVALUES allows these to be calculated, together with predictions for the nodes of the tree.

The TREE option specifies the tree for which the values are to be formed. The Y option specifies the values of the response variate for the observations in the new data set, and the X parameter defines their values for the x-variates as used to construct the tree. You can set option REPLACE=yes to use the new values to replace those already stored in the tree. Alternatively, you can use the PREDICTION parameter to save the predictions, in a pointer. This has an element for each node of the tree (and with the same suffix as that node) pointing to a scalar storing the prediction for the node. Similarly, the ACCURACY parameter saves the accuracies, and the NOBSERVATIONS parameter saves the numbers of observations at each node. You can use these later to replace the prediction and accuracy values in the original tree by

CALCULATE Tree[]['accuracy'] = ACCURACY[]

& Tree[]['prediction'] = PREDICTION[]

& Tree[]['nobservations'] = NOBSERVATIONS[]

Alternatively, you may want to combine them first with other estimates, for example to form bootstrapped estimates.

Options: Y, TREE, REPLACE, PREDICTION, ACCURACY, NOBSERVATIONS.

Parameter: X

Method

BRVALUES uses the standard Genstat tree functions to obtain the necessary information about the tree.

Action with RESTRICT

BRVALUES takes account of any restrictions on the Y or X variates.

See also

Procedures: BREGRESSION, BRDISPLAY, BRKEEP, BRPREDICT, BPRUNE.

Commands for: Regression analysis, Multivariate and cluster analysis.

Example

CAPTION 'BRVALUES example',!t('Water usage data (Draper & Smith 1981,',\
     'Applied Regression Analysis, Wiley, New York).'); STYLE=meta,plain
READ  temp,product,opdays,employ,water
58.8  7.107 21 129 3.067
65.2  6.373 22 141 2.828
70.9  6.796 22 153 2.891
77.4  9.208 20 166 2.994
79.3 14.792 25 193 3.082
81.0 14.564 23 189 3.898
71.9 11.964 20 175 3.502
63.9 13.526 23 186 3.060
54.5 12.656 20 190 3.211
39.5 14.119 20 187 3.286
44.5 16.691 22 195 3.542
43.6 14.571 19 206 3.125
56.0 13.619 22 198 3.022
64.7 14.575 22 192 2.922
73.0 14.556 21 191 3.950
78.9 18.573 21 200 4.488
79.4 15.618 22 200 3.295 :
"form the regression tree"
BREGRESSION [PRINT=indented; Y=water; TREE=tree]\
            employ,opdays,product,temp
"read a new set of values"
READ  [SETNVALUES=yes] temp,product,opdays,employ,water
79.8 15.689 22 201 3.310
80.0 14.929 25 195 3.111
39.7 14.208 20 188 3.307
81.6 14.672 23 190 3.927
65.3 14.707 22 194 2.949
64.5 13.653 23 188 3.089
71.9 11.965 20 175 3.502
43.7 14.595 19 206 3.130
79.6 15.656 22 200 3.303
43.6 14.580 19 206 3.127
64.0 13.548 23 186 3.065
44.8 16.811 22 196 3.567
56.5 13.740 22 200 3.049
79.6 14.846 25 194 3.093
73.1 14.574 21 191 3.955
77.5  9.218 20 166 2.997
65.5  6.404 22 142 2.842
71.1  6.818 22 153 2.900
79.1 18.627 21 201 4.501
73.2 14.597 21 192 3.961
44.6 16.724 22 195 3.549
56.1 13.633 22 198 3.025
78.0  9.282 20 167 3.018
59.1  7.139 21 130 3.081
54.7 12.695 20 191 3.221 :
"form new predictions and accuracy values"
BRVALUES    [Y=water; TREE=tree; REPLACE=yes] employ,opdays,product,temp
"prune the tree"
BPRUNE      [PRINT=table,graph] tree; NEWTREES=pruned
"use tree 10 - renumber nodes"
BCUT        [RENUMBER=yes] pruned[10]; NEWTREE=tree
"display the tree"
BRDISPLAY   [PRINT=indented,graph] tree
Updated on March 8, 2019

Was this article helpful?