Non-Parametric Statistical Methods

Homework 5

Patrick Oster

2019-03-28

Provided are two data sets: a training data set and a predictions data set. The training data set (full description below) contains ozone measurements as well as other factors. The prediction data set contains all of the factors but is missing the ozone measurement.

kable(head(train))
ID O3 vh wind humidity temp ibh dpg ibt vis doy
2 5 5700 3 37 45 590 -24 128 100 34
3 5 5760 3 51 54 1450 25 139 60 35
4 6 5720 4 69 35 1568 15 121 60 36
5 4 5790 6 19 45 2631 -33 123 100 37
6 4 5790 3 25 55 554 -28 182 250 38
8 7 5700 3 59 44 2654 -2 91 120 40

Variables

(1) Use the training data set to build a regression tree with ozone (O3) as the outcome.

set.seed(2634)

#Split the data into two parts
ind <- sample(1:dim(train)[1], 200, replace = FALSE)
df.train <- train[ind,]
df.test <- train[-ind,]

# Grow tree with rpart
redwood <- rpart(O3 ~ ., method = "class", data = df.train)

# Grow tree with tree
oak <- tree(O3 ~ ., data = df.train)
pruned.oak <- prune.tree(oak)

Visualizing/Analyzing Trees: rpart package

# rpart package
# detailed summary of splits
summary(redwood) 
## Call:
## rpart(formula = O3 ~ ., data = df.train, method = "class")
##   n= 200 
## 
##           CP nsplit rel error   xerror       xstd
## 1 0.03314917      0 1.0000000 1.060773 0.01531095
## 2 0.02762431      1 0.9668508 1.066298 0.01435933
## 3 0.02209945      2 0.9392265 1.066298 0.01435933
## 4 0.01841621      4 0.8950276 1.060773 0.01531095
## 5 0.01657459      7 0.8397790 1.066298 0.01435933
## 6 0.01104972     13 0.7403315 1.049724 0.01702877
## 7 0.01000000     15 0.7182320 1.060773 0.01531095
## 
## Variable importance
##      ibt     temp       vh       ID      doy      ibh humidity     wind 
##       19       16       15       11       10        9        8        6 
##      dpg 
##        6 
## 
## Node number 1: 200 observations,    complexity param=0.03314917
##   predicted class=4   expected loss=0.905  P(node) =1
##     class counts:     2     6    17    19    14    12    13     4    10    10     9    10     5     7     3     6     6     4     5     5     2     3     4     4     2     6     2     3     2     2     2     1
##    probabilities: 0.010 0.030 0.085 0.095 0.070 0.060 0.065 0.020 0.050 0.050 0.045 0.050 0.025 0.035 0.015 0.030 0.030 0.020 0.025 0.025 0.010 0.015 0.020 0.020 0.010 0.030 0.010 0.015 0.010 0.010 0.010 0.005 
##   left son=2 (104 obs) right son=3 (96 obs)
##   Primary splits:
##       temp     < 62.5   to the left,  improve=5.206154, (0 missing)
##       ibh      < 3573.5 to the right, improve=4.603695, (0 missing)
##       ibt      < 137    to the left,  improve=4.291239, (0 missing)
##       humidity < 27.5   to the left,  improve=3.693333, (0 missing)
##       dpg      < -19.5  to the left,  improve=3.599116, (0 missing)
##   Surrogate splits:
##       ibt < 159    to the left,  agree=0.835, adj=0.656, (0 split)
##       vh  < 5775   to the left,  agree=0.780, adj=0.542, (0 split)
##       ibh < 2043.5 to the right, agree=0.750, adj=0.479, (0 split)
##       ID  < 102.5  to the left,  agree=0.705, adj=0.385, (0 split)
##       doy < 138.5  to the left,  agree=0.705, adj=0.385, (0 split)
## 
## Node number 2: 104 observations,    complexity param=0.02209945
##   predicted class=4   expected loss=0.8269231  P(node) =0.52
##     class counts:     2     6    17    18     8    10    12     4     6     5     4     6     3     0     1     1     1     0     0     0     0     0     0     0     0     0     0     0     0     0     0     0
##    probabilities: 0.019 0.058 0.163 0.173 0.077 0.096 0.115 0.038 0.058 0.048 0.038 0.058 0.029 0.000 0.010 0.010 0.010 0.000 0.000 0.000 0.000 0.000 0.000 0.000 0.000 0.000 0.000 0.000 0.000 0.000 0.000 0.000 
##   left son=4 (8 obs) right son=5 (96 obs)
##   Primary splits:
##       ibt      < 32     to the left,  improve=2.549679, (0 missing)
##       dpg      < -20    to the left,  improve=2.312375, (0 missing)
##       vis      < 75     to the right, improve=2.044748, (0 missing)
##       humidity < 29     to the left,  improve=2.014957, (0 missing)
##       ID       < 17.5   to the left,  improve=1.995659, (0 missing)
##   Surrogate splits:
##       vh   < 5475   to the left,  agree=0.962, adj=0.500, (0 split)
##       temp < 35.5   to the left,  agree=0.952, adj=0.375, (0 split)
## 
## Node number 3: 96 observations,    complexity param=0.02762431
##   predicted class=14  expected loss=0.9270833  P(node) =0.48
##     class counts:     0     0     0     1     6     2     1     0     4     5     5     4     2     7     2     5     5     4     5     5     2     3     4     4     2     6     2     3     2     2     2     1
##    probabilities: 0.000 0.000 0.000 0.010 0.062 0.021 0.010 0.000 0.042 0.052 0.052 0.042 0.021 0.073 0.021 0.052 0.052 0.042 0.052 0.052 0.021 0.031 0.042 0.042 0.021 0.062 0.021 0.031 0.021 0.021 0.021 0.010 
##   left son=6 (20 obs) right son=7 (76 obs)
##   Primary splits:
##       ibt  < 175.5  to the left,  improve=2.550000, (0 missing)
##       ibh  < 3591.5 to the right, improve=2.271073, (0 missing)
##       temp < 65.5   to the left,  improve=2.234211, (0 missing)
##       vh   < 5755   to the left,  improve=1.887007, (0 missing)
##       vis  < 145    to the right, improve=1.750000, (0 missing)
##   Surrogate splits:
##       ibh      < 3016   to the right, agree=0.906, adj=0.55, (0 split)
##       vh       < 5755   to the left,  agree=0.885, adj=0.45, (0 split)
##       humidity < 20.5   to the left,  agree=0.812, adj=0.10, (0 split)
##       dpg      < 58.5   to the right, agree=0.812, adj=0.10, (0 split)
##       ID       < 23.5   to the left,  agree=0.802, adj=0.05, (0 split)
## 
## Node number 4: 8 observations
##   predicted class=4   expected loss=0.375  P(node) =0.04
##     class counts:     0     0     3     5     0     0     0     0     0     0     0     0     0     0     0     0     0     0     0     0     0     0     0     0     0     0     0     0     0     0     0     0
##    probabilities: 0.000 0.000 0.375 0.625 0.000 0.000 0.000 0.000 0.000 0.000 0.000 0.000 0.000 0.000 0.000 0.000 0.000 0.000 0.000 0.000 0.000 0.000 0.000 0.000 0.000 0.000 0.000 0.000 0.000 0.000 0.000 0.000 
## 
## Node number 5: 96 observations,    complexity param=0.02209945
##   predicted class=3   expected loss=0.8541667  P(node) =0.48
##     class counts:     2     6    14    13     8    10    12     4     6     5     4     6     3     0     1     1     1     0     0     0     0     0     0     0     0     0     0     0     0     0     0     0
##    probabilities: 0.021 0.062 0.146 0.135 0.083 0.104 0.125 0.042 0.062 0.052 0.042 0.062 0.031 0.000 0.010 0.010 0.010 0.000 0.000 0.000 0.000 0.000 0.000 0.000 0.000 0.000 0.000 0.000 0.000 0.000 0.000 0.000 
##   left son=10 (31 obs) right son=11 (65 obs)
##   Primary splits:
##       dpg      < -20    to the left,  improve=3.141884, (0 missing)
##       humidity < 29     to the left,  improve=2.947917, (0 missing)
##       ID       < 272    to the right, improve=2.354167, (0 missing)
##       doy      < 326    to the right, improve=2.354167, (0 missing)
##       vh       < 5745   to the right, improve=2.149539, (0 missing)
##   Surrogate splits:
##       humidity < 26.5   to the left,  agree=0.906, adj=0.710, (0 split)
##       vh       < 5805   to the right, agree=0.781, adj=0.323, (0 split)
##       ID       < 286.5  to the right, agree=0.771, adj=0.290, (0 split)
##       doy      < 344.5  to the right, agree=0.771, adj=0.290, (0 split)
##       wind     < 2.5    to the left,  agree=0.740, adj=0.194, (0 split)
## 
## Node number 6: 20 observations
##   predicted class=5   expected loss=0.7  P(node) =0.1
##     class counts:     0     0     0     1     6     0     0     0     1     3     2     1     0     2     0     3     0     0     1     0     0     0     0     0     0     0     0     0     0     0     0     0
##    probabilities: 0.000 0.000 0.000 0.050 0.300 0.000 0.000 0.000 0.050 0.150 0.100 0.050 0.000 0.100 0.000 0.150 0.000 0.000 0.050 0.000 0.000 0.000 0.000 0.000 0.000 0.000 0.000 0.000 0.000 0.000 0.000 0.000 
## 
## Node number 7: 76 observations,    complexity param=0.01841621
##   predicted class=26  expected loss=0.9210526  P(node) =0.38
##     class counts:     0     0     0     0     0     2     1     0     3     2     3     3     2     5     2     2     5     4     4     5     2     3     4     4     2     6     2     3     2     2     2     1
##    probabilities: 0.000 0.000 0.000 0.000 0.000 0.026 0.013 0.000 0.039 0.026 0.039 0.039 0.026 0.066 0.026 0.026 0.066 0.053 0.053 0.066 0.026 0.039 0.053 0.053 0.026 0.079 0.026 0.039 0.026 0.026 0.026 0.013 
##   left son=14 (7 obs) right son=15 (69 obs)
##   Primary splits:
##       ID   < 89.5   to the left,  improve=1.791925, (0 missing)
##       doy  < 125.5  to the left,  improve=1.791925, (0 missing)
##       temp < 79.5   to the left,  improve=1.703228, (0 missing)
##       ibh  < 539    to the right, improve=1.693443, (0 missing)
##       ibt  < 233.5  to the left,  improve=1.661111, (0 missing)
##   Surrogate splits:
##       doy      < 125.5  to the left,  agree=1.000, adj=1.000, (0 split)
##       temp     < 63.5   to the left,  agree=0.947, adj=0.429, (0 split)
##       humidity < 35     to the left,  agree=0.934, adj=0.286, (0 split)
##       ibt      < 193    to the left,  agree=0.921, adj=0.143, (0 split)
## 
## Node number 10: 31 observations,    complexity param=0.01657459
##   predicted class=3   expected loss=0.6774194  P(node) =0.155
##     class counts:     0     1    10     8     4     4     1     1     0     1     1     0     0     0     0     0     0     0     0     0     0     0     0     0     0     0     0     0     0     0     0     0
##    probabilities: 0.000 0.032 0.323 0.258 0.129 0.129 0.032 0.032 0.000 0.032 0.032 0.000 0.000 0.000 0.000 0.000 0.000 0.000 0.000 0.000 0.000 0.000 0.000 0.000 0.000 0.000 0.000 0.000 0.000 0.000 0.000 0.000 
##   left son=20 (24 obs) right son=21 (7 obs)
##   Primary splits:
##       vh   < 5715   to the right, improve=2.063748, (0 missing)
##       ID   < 46.5   to the right, improve=1.879765, (0 missing)
##       doy  < 80.5   to the right, improve=1.879765, (0 missing)
##       temp < 50.5   to the right, improve=1.526230, (0 missing)
##       dpg  < -39    to the left,  improve=1.053944, (0 missing)
##   Surrogate splits:
##       ibt      < 98.5   to the right, agree=0.903, adj=0.571, (0 split)
##       ID       < 317.5  to the left,  agree=0.839, adj=0.286, (0 split)
##       humidity < 29.5   to the left,  agree=0.839, adj=0.286, (0 split)
##       doy      < 375.5  to the left,  agree=0.839, adj=0.286, (0 split)
##       dpg      < -25.5  to the left,  agree=0.806, adj=0.143, (0 split)
## 
## Node number 11: 65 observations,    complexity param=0.01657459
##   predicted class=7   expected loss=0.8307692  P(node) =0.325
##     class counts:     2     5     4     5     4     6    11     3     6     4     3     6     3     0     1     1     1     0     0     0     0     0     0     0     0     0     0     0     0     0     0     0
##    probabilities: 0.031 0.077 0.062 0.077 0.062 0.092 0.169 0.046 0.092 0.062 0.046 0.092 0.046 0.000 0.015 0.015 0.015 0.000 0.000 0.000 0.000 0.000 0.000 0.000 0.000 0.000 0.000 0.000 0.000 0.000 0.000 0.000 
##   left son=22 (28 obs) right son=23 (37 obs)
##   Primary splits:
##       temp     < 52     to the left,  improve=2.276270, (0 missing)
##       humidity < 68.5   to the right, improve=2.098593, (0 missing)
##       ibt      < 153    to the left,  improve=2.065651, (0 missing)
##       wind     < 7.5    to the right, improve=1.968321, (0 missing)
##       vh       < 5575   to the left,  improve=1.830390, (0 missing)
##   Surrogate splits:
##       vh   < 5685   to the left,  agree=0.800, adj=0.536, (0 split)
##       ibt  < 86.5   to the left,  agree=0.785, adj=0.500, (0 split)
##       ID   < 283    to the right, agree=0.646, adj=0.179, (0 split)
##       wind < 8.5    to the right, agree=0.646, adj=0.179, (0 split)
##       doy  < 341    to the right, agree=0.646, adj=0.179, (0 split)
## 
## Node number 14: 7 observations
##   predicted class=9   expected loss=0.5714286  P(node) =0.035
##     class counts:     0     0     0     0     0     0     0     0     3     1     1     1     0     0     0     0     0     0     0     0     0     0     0     1     0     0     0     0     0     0     0     0
##    probabilities: 0.000 0.000 0.000 0.000 0.000 0.000 0.000 0.000 0.429 0.143 0.143 0.143 0.000 0.000 0.000 0.000 0.000 0.000 0.000 0.000 0.000 0.000 0.000 0.143 0.000 0.000 0.000 0.000 0.000 0.000 0.000 0.000 
## 
## Node number 15: 69 observations,    complexity param=0.01841621
##   predicted class=26  expected loss=0.9130435  P(node) =0.345
##     class counts:     0     0     0     0     0     2     1     0     0     1     2     2     2     5     2     2     5     4     4     5     2     3     4     3     2     6     2     3     2     2     2     1
##    probabilities: 0.000 0.000 0.000 0.000 0.000 0.029 0.014 0.000 0.000 0.014 0.029 0.029 0.029 0.072 0.029 0.029 0.072 0.058 0.058 0.072 0.029 0.043 0.058 0.043 0.029 0.087 0.029 0.043 0.029 0.029 0.029 0.014 
##   left son=30 (58 obs) right son=31 (11 obs)
##   Primary splits:
##       ibh  < 537.5  to the right, improve=1.888101, (0 missing)
##       ibt  < 233.5  to the left,  improve=1.756814, (0 missing)
##       temp < 79.5   to the left,  improve=1.651424, (0 missing)
##       ID   < 255    to the right, improve=1.588259, (0 missing)
##       doy  < 309    to the right, improve=1.588259, (0 missing)
##   Surrogate splits:
##       dpg      < -30.5  to the right, agree=0.870, adj=0.182, (0 split)
##       vh       < 5915   to the left,  agree=0.855, adj=0.091, (0 split)
##       humidity < 39.5   to the right, agree=0.855, adj=0.091, (0 split)
##       ibt      < 295.5  to the left,  agree=0.855, adj=0.091, (0 split)
## 
## Node number 20: 24 observations,    complexity param=0.01104972
##   predicted class=3   expected loss=0.5833333  P(node) =0.12
##     class counts:     0     1    10     5     3     1     1     1     0     1     1     0     0     0     0     0     0     0     0     0     0     0     0     0     0     0     0     0     0     0     0     0
##    probabilities: 0.000 0.042 0.417 0.208 0.125 0.042 0.042 0.042 0.000 0.042 0.042 0.000 0.000 0.000 0.000 0.000 0.000 0.000 0.000 0.000 0.000 0.000 0.000 0.000 0.000 0.000 0.000 0.000 0.000 0.000 0.000 0.000 
##   left son=40 (12 obs) right son=41 (12 obs)
##   Primary splits:
##       ID   < 294.5  to the right, improve=2.166667, (0 missing)
##       doy  < 352.5  to the right, improve=2.166667, (0 missing)
##       ibt  < 178.5  to the left,  improve=1.416667, (0 missing)
##       temp < 57.5   to the left,  improve=1.393557, (0 missing)
##       ibh  < 1648   to the right, improve=1.158263, (0 missing)
##   Surrogate splits:
##       doy      < 352.5  to the right, agree=1.000, adj=1.000, (0 split)
##       temp     < 53.5   to the left,  agree=0.875, adj=0.750, (0 split)
##       wind     < 4.5    to the left,  agree=0.750, adj=0.500, (0 split)
##       humidity < 20     to the left,  agree=0.667, adj=0.333, (0 split)
##       ibt      < 173    to the left,  agree=0.667, adj=0.333, (0 split)
## 
## Node number 21: 7 observations
##   predicted class=4   expected loss=0.5714286  P(node) =0.035
##     class counts:     0     0     0     3     1     3     0     0     0     0     0     0     0     0     0     0     0     0     0     0     0     0     0     0     0     0     0     0     0     0     0     0
##    probabilities: 0.000 0.000 0.000 0.429 0.143 0.429 0.000 0.000 0.000 0.000 0.000 0.000 0.000 0.000 0.000 0.000 0.000 0.000 0.000 0.000 0.000 0.000 0.000 0.000 0.000 0.000 0.000 0.000 0.000 0.000 0.000 0.000 
## 
## Node number 22: 28 observations,    complexity param=0.01657459
##   predicted class=7   expected loss=0.75  P(node) =0.14
##     class counts:     2     4     3     1     1     3     7     3     0     0     3     0     1     0     0     0     0     0     0     0     0     0     0     0     0     0     0     0     0     0     0     0
##    probabilities: 0.071 0.143 0.107 0.036 0.036 0.107 0.250 0.107 0.000 0.000 0.107 0.000 0.036 0.000 0.000 0.000 0.000 0.000 0.000 0.000 0.000 0.000 0.000 0.000 0.000 0.000 0.000 0.000 0.000 0.000 0.000 0.000 
##   left son=44 (13 obs) right son=45 (15 obs)
##   Primary splits:
##       humidity < 60     to the right, improve=2.419780, (0 missing)
##       vh       < 5575   to the left,  improve=1.571429, (0 missing)
##       wind     < 6.5    to the right, improve=1.476190, (0 missing)
##       ibt      < 72     to the left,  improve=1.476190, (0 missing)
##       ID       < 60.5   to the left,  improve=1.464495, (0 missing)
##   Surrogate splits:
##       ID   < 58     to the left,  agree=0.750, adj=0.462, (0 split)
##       doy  < 93.5   to the left,  agree=0.750, adj=0.462, (0 split)
##       vh   < 5575   to the left,  agree=0.643, adj=0.231, (0 split)
##       wind < 8      to the right, agree=0.643, adj=0.231, (0 split)
##       dpg  < -1     to the right, agree=0.643, adj=0.231, (0 split)
## 
## Node number 23: 37 observations,    complexity param=0.01657459
##   predicted class=9   expected loss=0.8378378  P(node) =0.185
##     class counts:     0     1     1     4     3     3     4     0     6     4     0     6     2     0     1     1     1     0     0     0     0     0     0     0     0     0     0     0     0     0     0     0
##    probabilities: 0.000 0.027 0.027 0.108 0.081 0.081 0.108 0.000 0.162 0.108 0.000 0.162 0.054 0.000 0.027 0.027 0.027 0.000 0.000 0.000 0.000 0.000 0.000 0.000 0.000 0.000 0.000 0.000 0.000 0.000 0.000 0.000 
##   left son=46 (16 obs) right son=47 (21 obs)
##   Primary splits:
##       wind     < 5.5    to the right, improve=2.467503, (0 missing)
##       ibt      < 153    to the left,  improve=1.723323, (0 missing)
##       ibh      < 3354   to the right, improve=1.438792, (0 missing)
##       temp     < 55.5   to the left,  improve=1.366421, (0 missing)
##       humidity < 74.5   to the right, improve=1.354613, (0 missing)
##   Surrogate splits:
##       ibh      < 3026   to the right, agree=0.703, adj=0.313, (0 split)
##       ibt      < 94.5   to the left,  agree=0.676, adj=0.250, (0 split)
##       ID       < 80.5   to the right, agree=0.649, adj=0.188, (0 split)
##       vh       < 5695   to the left,  agree=0.649, adj=0.188, (0 split)
##       humidity < 49.5   to the left,  agree=0.649, adj=0.188, (0 split)
## 
## Node number 30: 58 observations,    complexity param=0.01841621
##   predicted class=26  expected loss=0.8965517  P(node) =0.29
##     class counts:     0     0     0     0     0     1     1     0     0     1     1     2     2     5     2     2     5     2     4     5     2     2     4     3     2     6     1     0     2     2     0     1
##    probabilities: 0.000 0.000 0.000 0.000 0.000 0.017 0.017 0.000 0.000 0.017 0.017 0.034 0.034 0.086 0.034 0.034 0.086 0.034 0.069 0.086 0.034 0.034 0.069 0.052 0.034 0.103 0.017 0.000 0.034 0.034 0.000 0.017 
##   left son=60 (33 obs) right son=61 (25 obs)
##   Primary splits:
##       ibt      < 233.5  to the left,  improve=1.880752, (0 missing)
##       humidity < 68.5   to the left,  improve=1.780950, (0 missing)
##       vh       < 5855   to the left,  improve=1.724095, (0 missing)
##       temp     < 79.5   to the left,  improve=1.724095, (0 missing)
##       ibh      < 1157.5 to the right, improve=1.684246, (0 missing)
##   Surrogate splits:
##       vh       < 5845   to the left,  agree=0.862, adj=0.68, (0 split)
##       temp     < 79.5   to the left,  agree=0.862, adj=0.68, (0 split)
##       ibh      < 1115   to the right, agree=0.724, adj=0.36, (0 split)
##       humidity < 79.5   to the left,  agree=0.638, adj=0.16, (0 split)
##       dpg      < 40.5   to the right, agree=0.638, adj=0.16, (0 split)
## 
## Node number 31: 11 observations
##   predicted class=28  expected loss=0.7272727  P(node) =0.055
##     class counts:     0     0     0     0     0     1     0     0     0     0     1     0     0     0     0     0     0     2     0     0     0     1     0     0     0     0     1     3     0     0     2     0
##    probabilities: 0.000 0.000 0.000 0.000 0.000 0.091 0.000 0.000 0.000 0.000 0.091 0.000 0.000 0.000 0.000 0.000 0.000 0.182 0.000 0.000 0.000 0.091 0.000 0.000 0.000 0.000 0.091 0.273 0.000 0.000 0.182 0.000 
## 
## Node number 40: 12 observations
##   predicted class=3   expected loss=0.3333333  P(node) =0.06
##     class counts:     0     1     8     1     2     0     0     0     0     0     0     0     0     0     0     0     0     0     0     0     0     0     0     0     0     0     0     0     0     0     0     0
##    probabilities: 0.000 0.083 0.667 0.083 0.167 0.000 0.000 0.000 0.000 0.000 0.000 0.000 0.000 0.000 0.000 0.000 0.000 0.000 0.000 0.000 0.000 0.000 0.000 0.000 0.000 0.000 0.000 0.000 0.000 0.000 0.000 0.000 
## 
## Node number 41: 12 observations
##   predicted class=4   expected loss=0.6666667  P(node) =0.06
##     class counts:     0     0     2     4     1     1     1     1     0     1     1     0     0     0     0     0     0     0     0     0     0     0     0     0     0     0     0     0     0     0     0     0
##    probabilities: 0.000 0.000 0.167 0.333 0.083 0.083 0.083 0.083 0.000 0.083 0.083 0.000 0.000 0.000 0.000 0.000 0.000 0.000 0.000 0.000 0.000 0.000 0.000 0.000 0.000 0.000 0.000 0.000 0.000 0.000 0.000 0.000 
## 
## Node number 44: 13 observations
##   predicted class=2   expected loss=0.7692308  P(node) =0.065
##     class counts:     2     3     2     0     1     2     0     0     0     0     2     0     1     0     0     0     0     0     0     0     0     0     0     0     0     0     0     0     0     0     0     0
##    probabilities: 0.154 0.231 0.154 0.000 0.077 0.154 0.000 0.000 0.000 0.000 0.154 0.000 0.077 0.000 0.000 0.000 0.000 0.000 0.000 0.000 0.000 0.000 0.000 0.000 0.000 0.000 0.000 0.000 0.000 0.000 0.000 0.000 
## 
## Node number 45: 15 observations
##   predicted class=7   expected loss=0.5333333  P(node) =0.075
##     class counts:     0     1     1     1     0     1     7     3     0     0     1     0     0     0     0     0     0     0     0     0     0     0     0     0     0     0     0     0     0     0     0     0
##    probabilities: 0.000 0.067 0.067 0.067 0.000 0.067 0.467 0.200 0.000 0.000 0.067 0.000 0.000 0.000 0.000 0.000 0.000 0.000 0.000 0.000 0.000 0.000 0.000 0.000 0.000 0.000 0.000 0.000 0.000 0.000 0.000 0.000 
## 
## Node number 46: 16 observations
##   predicted class=4   expected loss=0.75  P(node) =0.08
##     class counts:     0     0     1     4     1     0     4     0     3     3     0     0     0     0     0     0     0     0     0     0     0     0     0     0     0     0     0     0     0     0     0     0
##    probabilities: 0.000 0.000 0.062 0.250 0.062 0.000 0.250 0.000 0.188 0.188 0.000 0.000 0.000 0.000 0.000 0.000 0.000 0.000 0.000 0.000 0.000 0.000 0.000 0.000 0.000 0.000 0.000 0.000 0.000 0.000 0.000 0.000 
## 
## Node number 47: 21 observations
##   predicted class=12  expected loss=0.7142857  P(node) =0.105
##     class counts:     0     1     0     0     2     3     0     0     3     1     0     6     2     0     1     1     1     0     0     0     0     0     0     0     0     0     0     0     0     0     0     0
##    probabilities: 0.000 0.048 0.000 0.000 0.095 0.143 0.000 0.000 0.143 0.048 0.000 0.286 0.095 0.000 0.048 0.048 0.048 0.000 0.000 0.000 0.000 0.000 0.000 0.000 0.000 0.000 0.000 0.000 0.000 0.000 0.000 0.000 
## 
## Node number 60: 33 observations,    complexity param=0.01657459
##   predicted class=14  expected loss=0.8787879  P(node) =0.165
##     class counts:     0     0     0     0     0     1     1     0     0     1     1     2     2     4     1     2     4     2     2     4     1     1     1     0     1     0     0     0     2     0     0     0
##    probabilities: 0.000 0.000 0.000 0.000 0.000 0.030 0.030 0.000 0.000 0.030 0.030 0.061 0.061 0.121 0.030 0.061 0.121 0.061 0.061 0.121 0.030 0.030 0.030 0.000 0.030 0.000 0.000 0.000 0.061 0.000 0.000 0.000 
##   left son=120 (26 obs) right son=121 (7 obs)
##   Primary splits:
##       ibt      < 223    to the left,  improve=1.633367, (0 missing)
##       dpg      < 28.5   to the left,  improve=1.474026, (0 missing)
##       vh       < 5815   to the right, improve=1.380041, (0 missing)
##       humidity < 67.5   to the left,  improve=1.361631, (0 missing)
##       ID       < 212.5  to the right, improve=1.336759, (0 missing)
##   Surrogate splits:
##       ibh < 868.5  to the right, agree=0.818, adj=0.143, (0 split)
## 
## Node number 61: 25 observations,    complexity param=0.01104972
##   predicted class=26  expected loss=0.76  P(node) =0.125
##     class counts:     0     0     0     0     0     0     0     0     0     0     0     0     0     1     1     0     1     0     2     1     1     1     3     3     1     6     1     0     0     2     0     1
##    probabilities: 0.000 0.000 0.000 0.000 0.000 0.000 0.000 0.000 0.000 0.000 0.000 0.000 0.000 0.040 0.040 0.000 0.040 0.000 0.080 0.040 0.040 0.040 0.120 0.120 0.040 0.240 0.040 0.000 0.000 0.080 0.000 0.040 
##   left son=122 (10 obs) right son=123 (15 obs)
##   Primary splits:
##       temp < 83.5   to the right, improve=1.693333, (0 missing)
##       ibh  < 1059   to the right, improve=1.525079, (0 missing)
##       ibt  < 260.5  to the left,  improve=1.523636, (0 missing)
##       dpg  < 25.5   to the right, improve=1.382222, (0 missing)
##       vh   < 5875   to the left,  improve=1.377949, (0 missing)
##   Surrogate splits:
##       ibt  < 263.5  to the right, agree=0.76, adj=0.4, (0 split)
##       ibh  < 1136   to the right, agree=0.72, adj=0.3, (0 split)
##       vh   < 5865   to the right, agree=0.68, adj=0.2, (0 split)
##       wind < 6.5    to the right, agree=0.68, adj=0.2, (0 split)
##       dpg  < 45.5   to the right, agree=0.68, adj=0.2, (0 split)
## 
## Node number 120: 26 observations,    complexity param=0.01657459
##   predicted class=14  expected loss=0.8461538  P(node) =0.13
##     class counts:     0     0     0     0     0     1     1     0     0     0     1     1     2     4     1     2     4     2     2     1     1     1     1     0     0     0     0     0     1     0     0     0
##    probabilities: 0.000 0.000 0.000 0.000 0.000 0.038 0.038 0.000 0.000 0.000 0.038 0.038 0.077 0.154 0.038 0.077 0.154 0.077 0.077 0.038 0.038 0.038 0.038 0.000 0.000 0.000 0.000 0.000 0.038 0.000 0.000 0.000 
##   left son=240 (14 obs) right son=241 (12 obs)
##   Primary splits:
##       vh       < 5815   to the right, improve=1.578755, (0 missing)
##       humidity < 67.5   to the left,  improve=1.563170, (0 missing)
##       ibh      < 1190.5 to the left,  improve=1.369231, (0 missing)
##       temp     < 72.5   to the left,  improve=1.307692, (0 missing)
##       dpg      < 28     to the left,  improve=1.242915, (0 missing)
##   Surrogate splits:
##       ibh  < 1190.5 to the right, agree=0.769, adj=0.500, (0 split)
##       ID   < 154.5  to the right, agree=0.731, adj=0.417, (0 split)
##       temp < 72.5   to the right, agree=0.731, adj=0.417, (0 split)
##       ibt  < 202    to the right, agree=0.731, adj=0.417, (0 split)
##       doy  < 194.5  to the right, agree=0.731, adj=0.417, (0 split)
## 
## Node number 121: 7 observations
##   predicted class=20  expected loss=0.5714286  P(node) =0.035
##     class counts:     0     0     0     0     0     0     0     0     0     1     0     1     0     0     0     0     0     0     0     3     0     0     0     0     1     0     0     0     1     0     0     0
##    probabilities: 0.000 0.000 0.000 0.000 0.000 0.000 0.000 0.000 0.000 0.143 0.000 0.143 0.000 0.000 0.000 0.000 0.000 0.000 0.000 0.429 0.000 0.000 0.000 0.000 0.143 0.000 0.000 0.000 0.143 0.000 0.000 0.000 
## 
## Node number 122: 10 observations
##   predicted class=19  expected loss=0.8  P(node) =0.05
##     class counts:     0     0     0     0     0     0     0     0     0     0     0     0     0     1     0     0     0     0     2     0     0     1     2     1     1     0     0     0     0     1     0     1
##    probabilities: 0.000 0.000 0.000 0.000 0.000 0.000 0.000 0.000 0.000 0.000 0.000 0.000 0.000 0.100 0.000 0.000 0.000 0.000 0.200 0.000 0.000 0.100 0.200 0.100 0.100 0.000 0.000 0.000 0.000 0.100 0.000 0.100 
## 
## Node number 123: 15 observations
##   predicted class=26  expected loss=0.6  P(node) =0.075
##     class counts:     0     0     0     0     0     0     0     0     0     0     0     0     0     0     1     0     1     0     0     1     1     0     1     2     0     6     1     0     0     1     0     0
##    probabilities: 0.000 0.000 0.000 0.000 0.000 0.000 0.000 0.000 0.000 0.000 0.000 0.000 0.000 0.000 0.067 0.000 0.067 0.000 0.000 0.067 0.067 0.000 0.067 0.133 0.000 0.400 0.067 0.000 0.000 0.067 0.000 0.000 
## 
## Node number 240: 14 observations
##   predicted class=14  expected loss=0.7142857  P(node) =0.07
##     class counts:     0     0     0     0     0     1     0     0     0     0     1     1     0     4     0     2     1     2     1     0     0     0     0     0     0     0     0     0     1     0     0     0
##    probabilities: 0.000 0.000 0.000 0.000 0.000 0.071 0.000 0.000 0.000 0.000 0.071 0.071 0.000 0.286 0.000 0.143 0.071 0.143 0.071 0.000 0.000 0.000 0.000 0.000 0.000 0.000 0.000 0.000 0.071 0.000 0.000 0.000 
## 
## Node number 241: 12 observations
##   predicted class=17  expected loss=0.75  P(node) =0.06
##     class counts:     0     0     0     0     0     0     1     0     0     0     0     0     2     0     1     0     3     0     1     1     1     1     1     0     0     0     0     0     0     0     0     0
##    probabilities: 0.000 0.000 0.000 0.000 0.000 0.000 0.083 0.000 0.000 0.000 0.000 0.000 0.167 0.000 0.083 0.000 0.250 0.000 0.083 0.083 0.083 0.083 0.083 0.000 0.000 0.000 0.000 0.000 0.000 0.000 0.000 0.000
# display the results 
printcp(redwood) 
## 
## Classification tree:
## rpart(formula = O3 ~ ., data = df.train, method = "class")
## 
## Variables actually used in tree construction:
## [1] dpg      humidity ibh      ibt      ID       temp     vh       wind    
## 
## Root node error: 181/200 = 0.905
## 
## n= 200 
## 
##         CP nsplit rel error xerror     xstd
## 1 0.033149      0   1.00000 1.0608 0.015311
## 2 0.027624      1   0.96685 1.0663 0.014359
## 3 0.022099      2   0.93923 1.0663 0.014359
## 4 0.018416      4   0.89503 1.0608 0.015311
## 5 0.016575      7   0.83978 1.0663 0.014359
## 6 0.011050     13   0.74033 1.0497 0.017029
## 7 0.010000     15   0.71823 1.0608 0.015311
plotcp(redwood, col = "red", lty = 1, upper = "size") 

plotcp(redwood, col = "red", lty = 1, upper = "splits") 

rpart.plot(redwood, box.palette = "RdBu", shadow.col = "gray", nn = TRUE)

plot(redwood, uniform = TRUE, main = "Classification Tree for O3")
text(redwood, all = FALSE, cex = .8)

plot(redwood, uniform = FALSE, main = "Classification Tree for O3")
text(redwood, all = FALSE, cex = .8)

plot(redwood, uniform = TRUE, main = "Classification Tree for O3", branch = 0.5, compress = TRUE)
text(redwood, all = FALSE, cex = .8)

prp(redwood)

prp(redwood, varlen = 3)

prp(redwood)

fancyRpartPlot(redwood, main = "Classification Tree for O3", type = 1)

fancyRpartPlot(redwood, main = "Classification Tree for O3", type = 2)

draw.tree(redwood)

Visualizing/Analyzing Trees: tree package

# tree package
summary(oak)
## 
## Regression tree:
## tree(formula = O3 ~ ., data = df.train)
## Variables actually used in tree construction:
## [1] "temp"     "ibh"      "dpg"      "ibt"      "humidity"
## Number of terminal nodes:  9 
## Residual mean deviance:  13.55 = 2587 / 191 
## Distribution of residuals:
##    Min. 1st Qu.  Median    Mean 3rd Qu.    Max. 
## -12.250  -2.235  -0.325   0.000   2.045  11.600
cv.tree(oak, FUN = prune.tree)
## $size
## [1] 9 8 7 6 5 4 3 2 1
## 
## $dev
## [1]  5095.894  5094.726  5666.017  5593.034  5372.997  5197.395  6053.768
## [8]  6513.781 13289.561
## 
## $k
## [1]      -Inf  159.9671  240.6667  272.1132  296.3526  403.8372  612.8978
## [8]  949.2013 7599.2870
## 
## $method
## [1] "deviance"
## 
## attr(,"class")
## [1] "prune"         "tree.sequence"
deviance(oak, detail = TRUE)
##  [1] 13121.5000  2368.9924  1265.8594   176.9524   685.0698   142.9565
##  [7]   270.0000   490.2353  3153.2206   793.4667   108.8000   444.0000
## [13]  1410.5526   365.5000   748.7000   239.4286   349.3043
plot.tree.sequence(x = pruned.oak, order = "decreasing")

plot(oak, type = "uni")
text(oak, all=TRUE, cex=.8)

plot(oak, type = "prop")
text(oak, all = TRUE, cex = .8)

draw.tree(oak)

(2) Use the tree you built to predict the missing values of ozone based on the observed factors.

set.seed(2634)

redwood.pred <- predict(redwood, type = "vector")
oak.pred <- predict(oak, type = "vector")

# MSE
redwood.mse <- mean((redwood.pred - train$O3)^2); redwood.mse
## Warning in redwood.pred - train$O3: longer object length is not a multiple
## of shorter object length
## [1] 125.1294
oak.mse <- mean((oak.pred - train$O3)^2); oak.mse
## Warning in oak.pred - train$O3: longer object length is not a multiple of
## shorter object length
## [1] 112.0374

Use CART and random forest modeling to predict the mssing ozone values. Whoever’s prediction minimize mean squared error (MSE) wins a prize or something.

set.seed(2634)
forest <- randomForest(O3 ~., 
                       data = train, 
                       ntree = 1000, 
                       nodesize = 5, 
                       maxnodes = 10, 
                       importance = TRUE, 
                       localImp = TRUE, 
                       nPerm = 2, 
                       proximity = TRUE, 
                       norm.votes = TRUE, 
                       do.trace = TRUE, 
                       keep.forest = TRUE, 
                       corr.bias = FALSE)
##      |      Out-of-bag   |
## Tree |      MSE  %Var(y) |
##    1 |     25.1    41.58 |
##    2 |    24.66    40.85 |
##    3 |    22.66    37.54 |
##    4 |    22.43    37.16 |
##    5 |    23.48    38.90 |
##    6 |     22.9    37.94 |
##    7 |    22.39    37.10 |
##    8 |    20.95    34.71 |
##    9 |    20.29    33.62 |
##   10 |     19.5    32.30 |
##   11 |    18.82    31.18 |
##   12 |    18.01    29.83 |
##   13 |    17.95    29.73 |
##   14 |    17.82    29.52 |
##   15 |     17.6    29.16 |
##   16 |    17.66    29.26 |
##   17 |     17.3    28.66 |
##   18 |    17.47    28.95 |
##   19 |    17.46    28.93 |
##   20 |    17.62    29.20 |
##   21 |    17.32    28.70 |
##   22 |    16.99    28.14 |
##   23 |    17.09    28.32 |
##   24 |    17.21    28.51 |
##   25 |    17.15    28.41 |
##   26 |    16.97    28.11 |
##   27 |    16.75    27.75 |
##   28 |    16.63    27.55 |
##   29 |    16.48    27.30 |
##   30 |    16.46    27.27 |
##   31 |    16.39    27.16 |
##   32 |    16.57    27.45 |
##   33 |    16.65    27.58 |
##   34 |    16.74    27.73 |
##   35 |    16.69    27.64 |
##   36 |    16.58    27.48 |
##   37 |    16.71    27.68 |
##   38 |    16.83    27.88 |
##   39 |    16.78    27.80 |
##   40 |    16.75    27.75 |
##   41 |    16.83    27.89 |
##   42 |    16.76    27.76 |
##   43 |    16.82    27.86 |
##   44 |    16.78    27.80 |
##   45 |    16.72    27.70 |
##   46 |    16.72    27.70 |
##   47 |    16.68    27.63 |
##   48 |    16.68    27.64 |
##   49 |    16.63    27.55 |
##   50 |    16.62    27.53 |
##   51 |     16.6    27.50 |
##   52 |    16.66    27.60 |
##   53 |     16.7    27.67 |
##   54 |    16.73    27.71 |
##   55 |    16.69    27.65 |
##   56 |    16.72    27.70 |
##   57 |    16.72    27.69 |
##   58 |    16.65    27.59 |
##   59 |    16.71    27.69 |
##   60 |    16.63    27.55 |
##   61 |    16.64    27.57 |
##   62 |    16.65    27.59 |
##   63 |    16.64    27.57 |
##   64 |    16.69    27.64 |
##   65 |    16.65    27.58 |
##   66 |    16.61    27.52 |
##   67 |    16.61    27.52 |
##   68 |    16.58    27.47 |
##   69 |    16.63    27.56 |
##   70 |    16.59    27.49 |
##   71 |     16.6    27.50 |
##   72 |    16.61    27.51 |
##   73 |    16.66    27.61 |
##   74 |    16.72    27.70 |
##   75 |    16.72    27.70 |
##   76 |    16.65    27.59 |
##   77 |    16.57    27.44 |
##   78 |    16.54    27.41 |
##   79 |     16.6    27.50 |
##   80 |    16.53    27.39 |
##   81 |    16.55    27.43 |
##   82 |    16.55    27.42 |
##   83 |    16.53    27.38 |
##   84 |    16.55    27.42 |
##   85 |    16.54    27.40 |
##   86 |    16.56    27.43 |
##   87 |    16.53    27.39 |
##   88 |    16.55    27.43 |
##   89 |    16.58    27.47 |
##   90 |    16.63    27.56 |
##   91 |    16.64    27.56 |
##   92 |    16.68    27.64 |
##   93 |    16.65    27.59 |
##   94 |    16.63    27.56 |
##   95 |    16.64    27.57 |
##   96 |     16.7    27.66 |
##   97 |    16.63    27.56 |
##   98 |    16.65    27.59 |
##   99 |    16.66    27.60 |
##  100 |    16.69    27.64 |
##  101 |    16.67    27.62 |
##  102 |    16.66    27.59 |
##  103 |    16.66    27.60 |
##  104 |    16.66    27.59 |
##  105 |    16.68    27.63 |
##  106 |    16.72    27.71 |
##  107 |    16.72    27.70 |
##  108 |    16.69    27.66 |
##  109 |     16.7    27.67 |
##  110 |     16.7    27.67 |
##  111 |    16.71    27.69 |
##  112 |    16.74    27.73 |
##  113 |    16.74    27.73 |
##  114 |    16.73    27.72 |
##  115 |    16.69    27.65 |
##  116 |    16.68    27.63 |
##  117 |    16.71    27.68 |
##  118 |    16.74    27.73 |
##  119 |    16.75    27.74 |
##  120 |    16.75    27.74 |
##  121 |    16.81    27.85 |
##  122 |    16.82    27.87 |
##  123 |    16.79    27.82 |
##  124 |     16.8    27.83 |
##  125 |    16.81    27.84 |
##  126 |    16.83    27.88 |
##  127 |    16.86    27.93 |
##  128 |    16.84    27.91 |
##  129 |    16.86    27.93 |
##  130 |    16.88    27.96 |
##  131 |    16.93    28.05 |
##  132 |    16.92    28.03 |
##  133 |    16.89    27.99 |
##  134 |    16.88    27.96 |
##  135 |    16.87    27.95 |
##  136 |    16.88    27.97 |
##  137 |    16.87    27.94 |
##  138 |    16.88    27.96 |
##  139 |    16.91    28.02 |
##  140 |    16.91    28.01 |
##  141 |     16.9    27.99 |
##  142 |    16.93    28.04 |
##  143 |    16.92    28.03 |
##  144 |    16.91    28.02 |
##  145 |    16.92    28.03 |
##  146 |    16.91    28.02 |
##  147 |    16.94    28.07 |
##  148 |    16.93    28.05 |
##  149 |    16.93    28.05 |
##  150 |    16.92    28.04 |
##  151 |    16.92    28.04 |
##  152 |     16.9    28.01 |
##  153 |    16.92    28.03 |
##  154 |    16.93    28.06 |
##  155 |    16.89    27.99 |
##  156 |     16.9    28.01 |
##  157 |    16.91    28.02 |
##  158 |    16.93    28.05 |
##  159 |    16.95    28.08 |
##  160 |    16.96    28.10 |
##  161 |    16.96    28.10 |
##  162 |    16.95    28.08 |
##  163 |    16.96    28.10 |
##  164 |    16.94    28.07 |
##  165 |    16.94    28.06 |
##  166 |     16.9    28.00 |
##  167 |    16.92    28.03 |
##  168 |    16.93    28.04 |
##  169 |    16.94    28.07 |
##  170 |    16.93    28.04 |
##  171 |    16.92    28.03 |
##  172 |    16.92    28.03 |
##  173 |    16.91    28.01 |
##  174 |    16.92    28.03 |
##  175 |    16.94    28.07 |
##  176 |    16.93    28.05 |
##  177 |    16.93    28.05 |
##  178 |    16.93    28.04 |
##  179 |    16.94    28.07 |
##  180 |    16.92    28.03 |
##  181 |     16.9    28.00 |
##  182 |    16.91    28.02 |
##  183 |    16.93    28.04 |
##  184 |    16.93    28.05 |
##  185 |    16.93    28.06 |
##  186 |    16.94    28.07 |
##  187 |    16.94    28.07 |
##  188 |    16.92    28.03 |
##  189 |    16.94    28.07 |
##  190 |    16.97    28.12 |
##  191 |    16.98    28.14 |
##  192 |    16.98    28.14 |
##  193 |    16.98    28.13 |
##  194 |    16.97    28.11 |
##  195 |    16.96    28.09 |
##  196 |    16.92    28.03 |
##  197 |    16.92    28.04 |
##  198 |    16.94    28.07 |
##  199 |    16.94    28.07 |
##  200 |    16.95    28.08 |
##  201 |    16.92    28.04 |
##  202 |    16.93    28.05 |
##  203 |     16.9    28.00 |
##  204 |    16.87    27.94 |
##  205 |    16.89    27.98 |
##  206 |    16.91    28.02 |
##  207 |    16.89    27.98 |
##  208 |    16.88    27.96 |
##  209 |     16.9    28.00 |
##  210 |     16.9    27.99 |
##  211 |    16.89    27.99 |
##  212 |    16.91    28.01 |
##  213 |    16.92    28.03 |
##  214 |    16.93    28.04 |
##  215 |     16.9    27.99 |
##  216 |    16.89    27.98 |
##  217 |    16.89    27.99 |
##  218 |    16.86    27.93 |
##  219 |    16.87    27.94 |
##  220 |    16.84    27.91 |
##  221 |    16.84    27.90 |
##  222 |    16.84    27.89 |
##  223 |    16.82    27.86 |
##  224 |    16.82    27.87 |
##  225 |    16.83    27.88 |
##  226 |    16.84    27.90 |
##  227 |    16.82    27.87 |
##  228 |    16.82    27.86 |
##  229 |     16.8    27.84 |
##  230 |    16.76    27.76 |
##  231 |    16.74    27.73 |
##  232 |    16.73    27.73 |
##  233 |    16.74    27.74 |
##  234 |    16.75    27.74 |
##  235 |    16.73    27.72 |
##  236 |    16.73    27.72 |
##  237 |    16.74    27.74 |
##  238 |    16.76    27.76 |
##  239 |    16.77    27.78 |
##  240 |    16.76    27.77 |
##  241 |    16.77    27.78 |
##  242 |    16.77    27.78 |
##  243 |    16.77    27.78 |
##  244 |    16.79    27.82 |
##  245 |    16.78    27.80 |
##  246 |    16.77    27.78 |
##  247 |    16.77    27.78 |
##  248 |    16.76    27.76 |
##  249 |    16.77    27.78 |
##  250 |    16.76    27.76 |
##  251 |    16.75    27.76 |
##  252 |    16.75    27.75 |
##  253 |    16.76    27.77 |
##  254 |    16.78    27.80 |
##  255 |    16.77    27.79 |
##  256 |    16.78    27.79 |
##  257 |    16.76    27.77 |
##  258 |    16.76    27.76 |
##  259 |    16.74    27.73 |
##  260 |    16.73    27.72 |
##  261 |    16.76    27.76 |
##  262 |    16.74    27.74 |
##  263 |    16.74    27.74 |
##  264 |    16.75    27.76 |
##  265 |    16.75    27.75 |
##  266 |    16.76    27.77 |
##  267 |    16.77    27.79 |
##  268 |    16.77    27.78 |
##  269 |    16.78    27.80 |
##  270 |    16.78    27.80 |
##  271 |    16.78    27.81 |
##  272 |    16.77    27.79 |
##  273 |    16.78    27.79 |
##  274 |    16.77    27.78 |
##  275 |    16.77    27.78 |
##  276 |    16.78    27.79 |
##  277 |    16.78    27.79 |
##  278 |    16.76    27.76 |
##  279 |    16.76    27.76 |
##  280 |    16.76    27.76 |
##  281 |    16.76    27.76 |
##  282 |    16.78    27.79 |
##  283 |    16.78    27.81 |
##  284 |    16.78    27.81 |
##  285 |    16.79    27.82 |
##  286 |    16.78    27.80 |
##  287 |    16.76    27.77 |
##  288 |    16.74    27.73 |
##  289 |    16.74    27.73 |
##  290 |    16.76    27.77 |
##  291 |    16.76    27.76 |
##  292 |    16.76    27.77 |
##  293 |    16.79    27.81 |
##  294 |    16.79    27.81 |
##  295 |    16.78    27.80 |
##  296 |    16.78    27.80 |
##  297 |    16.79    27.81 |
##  298 |    16.76    27.77 |
##  299 |    16.78    27.80 |
##  300 |    16.76    27.76 |
##  301 |    16.75    27.75 |
##  302 |    16.73    27.72 |
##  303 |    16.72    27.69 |
##  304 |     16.7    27.67 |
##  305 |    16.71    27.68 |
##  306 |     16.7    27.66 |
##  307 |    16.71    27.68 |
##  308 |     16.7    27.67 |
##  309 |    16.69    27.65 |
##  310 |    16.71    27.69 |
##  311 |     16.7    27.67 |
##  312 |     16.7    27.66 |
##  313 |     16.7    27.67 |
##  314 |    16.71    27.68 |
##  315 |    16.71    27.68 |
##  316 |     16.7    27.67 |
##  317 |    16.71    27.68 |
##  318 |    16.72    27.70 |
##  319 |    16.72    27.70 |
##  320 |    16.71    27.69 |
##  321 |    16.71    27.68 |
##  322 |    16.71    27.68 |
##  323 |    16.71    27.69 |
##  324 |    16.73    27.72 |
##  325 |    16.75    27.75 |
##  326 |    16.75    27.74 |
##  327 |    16.75    27.75 |
##  328 |    16.75    27.75 |
##  329 |    16.74    27.73 |
##  330 |    16.74    27.73 |
##  331 |    16.72    27.70 |
##  332 |    16.72    27.69 |
##  333 |     16.7    27.67 |
##  334 |    16.72    27.70 |
##  335 |    16.73    27.72 |
##  336 |    16.71    27.69 |
##  337 |    16.72    27.69 |
##  338 |    16.72    27.70 |
##  339 |    16.72    27.70 |
##  340 |    16.71    27.69 |
##  341 |    16.71    27.68 |
##  342 |    16.71    27.69 |
##  343 |    16.72    27.70 |
##  344 |    16.73    27.72 |
##  345 |    16.73    27.72 |
##  346 |    16.74    27.73 |
##  347 |    16.74    27.73 |
##  348 |    16.72    27.70 |
##  349 |    16.73    27.71 |
##  350 |    16.72    27.70 |
##  351 |    16.73    27.71 |
##  352 |    16.72    27.70 |
##  353 |    16.71    27.68 |
##  354 |     16.7    27.67 |
##  355 |    16.71    27.68 |
##  356 |    16.71    27.69 |
##  357 |    16.71    27.68 |
##  358 |    16.71    27.68 |
##  359 |    16.72    27.70 |
##  360 |    16.72    27.71 |
##  361 |    16.72    27.71 |
##  362 |    16.72    27.70 |
##  363 |    16.71    27.68 |
##  364 |    16.71    27.68 |
##  365 |    16.72    27.70 |
##  366 |    16.71    27.69 |
##  367 |    16.72    27.70 |
##  368 |    16.72    27.70 |
##  369 |    16.73    27.71 |
##  370 |    16.71    27.68 |
##  371 |     16.7    27.67 |
##  372 |     16.7    27.67 |
##  373 |     16.7    27.67 |
##  374 |    16.71    27.68 |
##  375 |    16.71    27.68 |
##  376 |    16.71    27.68 |
##  377 |    16.71    27.69 |
##  378 |    16.71    27.69 |
##  379 |    16.71    27.69 |
##  380 |    16.72    27.70 |
##  381 |    16.72    27.70 |
##  382 |    16.72    27.70 |
##  383 |    16.71    27.69 |
##  384 |    16.71    27.69 |
##  385 |    16.72    27.70 |
##  386 |    16.73    27.71 |
##  387 |    16.73    27.72 |
##  388 |    16.73    27.72 |
##  389 |    16.72    27.71 |
##  390 |    16.71    27.68 |
##  391 |     16.7    27.66 |
##  392 |    16.69    27.65 |
##  393 |    16.69    27.66 |
##  394 |    16.71    27.68 |
##  395 |    16.71    27.69 |
##  396 |    16.71    27.68 |
##  397 |     16.7    27.67 |
##  398 |     16.7    27.67 |
##  399 |     16.7    27.67 |
##  400 |     16.7    27.67 |
##  401 |    16.72    27.70 |
##  402 |    16.73    27.72 |
##  403 |    16.72    27.70 |
##  404 |    16.72    27.70 |
##  405 |    16.73    27.71 |
##  406 |    16.73    27.72 |
##  407 |    16.74    27.73 |
##  408 |    16.73    27.72 |
##  409 |    16.74    27.74 |
##  410 |    16.73    27.72 |
##  411 |    16.73    27.73 |
##  412 |    16.73    27.72 |
##  413 |    16.73    27.72 |
##  414 |    16.74    27.74 |
##  415 |    16.75    27.75 |
##  416 |    16.74    27.73 |
##  417 |    16.74    27.74 |
##  418 |    16.75    27.74 |
##  419 |    16.75    27.75 |
##  420 |    16.74    27.73 |
##  421 |    16.75    27.75 |
##  422 |    16.73    27.72 |
##  423 |    16.74    27.73 |
##  424 |    16.74    27.73 |
##  425 |    16.73    27.72 |
##  426 |    16.73    27.72 |
##  427 |    16.75    27.75 |
##  428 |    16.76    27.77 |
##  429 |    16.75    27.76 |
##  430 |    16.74    27.73 |
##  431 |    16.74    27.73 |
##  432 |    16.73    27.72 |
##  433 |    16.74    27.73 |
##  434 |    16.73    27.72 |
##  435 |    16.73    27.71 |
##  436 |    16.72    27.70 |
##  437 |    16.72    27.71 |
##  438 |    16.72    27.70 |
##  439 |    16.71    27.68 |
##  440 |    16.73    27.72 |
##  441 |    16.74    27.73 |
##  442 |    16.73    27.72 |
##  443 |    16.74    27.73 |
##  444 |    16.73    27.72 |
##  445 |    16.73    27.72 |
##  446 |    16.73    27.72 |
##  447 |    16.72    27.70 |
##  448 |    16.73    27.72 |
##  449 |    16.74    27.73 |
##  450 |    16.73    27.71 |
##  451 |    16.72    27.70 |
##  452 |    16.72    27.71 |
##  453 |    16.72    27.71 |
##  454 |    16.73    27.72 |
##  455 |    16.73    27.72 |
##  456 |    16.72    27.71 |
##  457 |    16.72    27.70 |
##  458 |    16.72    27.70 |
##  459 |    16.74    27.73 |
##  460 |    16.74    27.73 |
##  461 |    16.73    27.73 |
##  462 |    16.73    27.72 |
##  463 |    16.74    27.73 |
##  464 |    16.74    27.74 |
##  465 |    16.75    27.75 |
##  466 |    16.75    27.75 |
##  467 |    16.74    27.73 |
##  468 |    16.73    27.72 |
##  469 |    16.72    27.71 |
##  470 |    16.73    27.71 |
##  471 |    16.72    27.70 |
##  472 |    16.72    27.70 |
##  473 |    16.72    27.70 |
##  474 |    16.72    27.70 |
##  475 |    16.71    27.69 |
##  476 |     16.7    27.67 |
##  477 |    16.69    27.65 |
##  478 |    16.69    27.65 |
##  479 |     16.7    27.66 |
##  480 |    16.69    27.64 |
##  481 |    16.68    27.64 |
##  482 |    16.68    27.64 |
##  483 |    16.68    27.63 |
##  484 |    16.68    27.64 |
##  485 |    16.68    27.63 |
##  486 |    16.67    27.62 |
##  487 |    16.68    27.63 |
##  488 |    16.66    27.61 |
##  489 |    16.67    27.61 |
##  490 |    16.67    27.62 |
##  491 |    16.67    27.62 |
##  492 |    16.68    27.63 |
##  493 |    16.69    27.65 |
##  494 |    16.69    27.66 |
##  495 |    16.69    27.66 |
##  496 |    16.68    27.64 |
##  497 |    16.69    27.65 |
##  498 |    16.69    27.66 |
##  499 |     16.7    27.68 |
##  500 |     16.7    27.67 |
##  501 |    16.71    27.68 |
##  502 |    16.69    27.66 |
##  503 |     16.7    27.66 |
##  504 |    16.69    27.65 |
##  505 |     16.7    27.66 |
##  506 |    16.69    27.65 |
##  507 |    16.69    27.65 |
##  508 |    16.68    27.64 |
##  509 |    16.68    27.64 |
##  510 |    16.68    27.64 |
##  511 |    16.68    27.64 |
##  512 |    16.68    27.64 |
##  513 |    16.68    27.63 |
##  514 |    16.68    27.64 |
##  515 |    16.69    27.65 |
##  516 |    16.69    27.64 |
##  517 |    16.69    27.64 |
##  518 |    16.69    27.65 |
##  519 |    16.69    27.65 |
##  520 |    16.68    27.63 |
##  521 |    16.68    27.64 |
##  522 |    16.68    27.63 |
##  523 |    16.68    27.64 |
##  524 |    16.69    27.65 |
##  525 |    16.69    27.66 |
##  526 |     16.7    27.67 |
##  527 |    16.71    27.69 |
##  528 |    16.71    27.68 |
##  529 |     16.7    27.67 |
##  530 |    16.71    27.68 |
##  531 |     16.7    27.67 |
##  532 |    16.71    27.68 |
##  533 |    16.72    27.70 |
##  534 |    16.72    27.70 |
##  535 |    16.72    27.70 |
##  536 |    16.71    27.69 |
##  537 |    16.72    27.70 |
##  538 |    16.74    27.73 |
##  539 |    16.74    27.74 |
##  540 |    16.74    27.73 |
##  541 |    16.74    27.74 |
##  542 |    16.75    27.75 |
##  543 |    16.75    27.74 |
##  544 |    16.75    27.74 |
##  545 |    16.74    27.74 |
##  546 |    16.74    27.73 |
##  547 |    16.73    27.72 |
##  548 |    16.72    27.70 |
##  549 |    16.71    27.68 |
##  550 |    16.71    27.68 |
##  551 |    16.71    27.69 |
##  552 |    16.71    27.68 |
##  553 |    16.71    27.68 |
##  554 |    16.71    27.69 |
##  555 |    16.71    27.69 |
##  556 |    16.72    27.70 |
##  557 |    16.72    27.70 |
##  558 |    16.72    27.71 |
##  559 |    16.72    27.71 |
##  560 |    16.73    27.71 |
##  561 |    16.73    27.72 |
##  562 |    16.73    27.72 |
##  563 |    16.74    27.74 |
##  564 |    16.74    27.73 |
##  565 |    16.73    27.71 |
##  566 |    16.72    27.70 |
##  567 |    16.73    27.71 |
##  568 |    16.73    27.71 |
##  569 |    16.73    27.72 |
##  570 |    16.72    27.71 |
##  571 |    16.71    27.69 |
##  572 |    16.72    27.69 |
##  573 |    16.72    27.70 |
##  574 |    16.71    27.69 |
##  575 |    16.72    27.70 |
##  576 |    16.72    27.69 |
##  577 |    16.72    27.71 |
##  578 |    16.73    27.71 |
##  579 |    16.73    27.72 |
##  580 |    16.72    27.71 |
##  581 |    16.72    27.70 |
##  582 |    16.72    27.70 |
##  583 |    16.72    27.71 |
##  584 |    16.72    27.71 |
##  585 |    16.72    27.70 |
##  586 |    16.72    27.71 |
##  587 |    16.73    27.71 |
##  588 |    16.72    27.70 |
##  589 |    16.71    27.69 |
##  590 |    16.72    27.69 |
##  591 |    16.72    27.70 |
##  592 |    16.72    27.70 |
##  593 |    16.72    27.70 |
##  594 |    16.73    27.71 |
##  595 |    16.73    27.71 |
##  596 |    16.72    27.71 |
##  597 |    16.72    27.71 |
##  598 |    16.73    27.71 |
##  599 |    16.74    27.73 |
##  600 |    16.73    27.71 |
##  601 |    16.72    27.70 |
##  602 |    16.73    27.71 |
##  603 |    16.72    27.70 |
##  604 |    16.71    27.69 |
##  605 |    16.71    27.69 |
##  606 |     16.7    27.67 |
##  607 |    16.71    27.68 |
##  608 |     16.7    27.67 |
##  609 |     16.7    27.67 |
##  610 |     16.7    27.67 |
##  611 |     16.7    27.67 |
##  612 |     16.7    27.67 |
##  613 |    16.71    27.68 |
##  614 |    16.71    27.68 |
##  615 |    16.72    27.70 |
##  616 |    16.72    27.71 |
##  617 |    16.73    27.71 |
##  618 |    16.73    27.72 |
##  619 |    16.73    27.72 |
##  620 |    16.74    27.73 |
##  621 |    16.74    27.73 |
##  622 |    16.73    27.72 |
##  623 |    16.74    27.73 |
##  624 |    16.75    27.75 |
##  625 |    16.75    27.75 |
##  626 |    16.75    27.75 |
##  627 |    16.74    27.74 |
##  628 |    16.74    27.74 |
##  629 |    16.74    27.74 |
##  630 |    16.75    27.75 |
##  631 |    16.75    27.75 |
##  632 |    16.74    27.74 |
##  633 |    16.74    27.73 |
##  634 |    16.74    27.74 |
##  635 |    16.74    27.73 |
##  636 |    16.73    27.72 |
##  637 |    16.74    27.74 |
##  638 |    16.74    27.73 |
##  639 |    16.73    27.72 |
##  640 |    16.73    27.71 |
##  641 |    16.72    27.70 |
##  642 |    16.72    27.70 |
##  643 |    16.71    27.68 |
##  644 |    16.71    27.69 |
##  645 |    16.71    27.69 |
##  646 |    16.72    27.69 |
##  647 |    16.72    27.70 |
##  648 |    16.72    27.71 |
##  649 |    16.72    27.70 |
##  650 |    16.72    27.70 |
##  651 |    16.72    27.71 |
##  652 |    16.73    27.71 |
##  653 |    16.74    27.74 |
##  654 |    16.74    27.73 |
##  655 |    16.73    27.72 |
##  656 |    16.73    27.71 |
##  657 |    16.73    27.72 |
##  658 |    16.73    27.71 |
##  659 |    16.72    27.71 |
##  660 |    16.73    27.72 |
##  661 |    16.73    27.72 |
##  662 |    16.73    27.72 |
##  663 |    16.73    27.72 |
##  664 |    16.74    27.73 |
##  665 |    16.74    27.73 |
##  666 |    16.74    27.73 |
##  667 |    16.74    27.73 |
##  668 |    16.74    27.74 |
##  669 |    16.75    27.75 |
##  670 |    16.75    27.75 |
##  671 |    16.75    27.74 |
##  672 |    16.75    27.74 |
##  673 |    16.74    27.74 |
##  674 |    16.75    27.75 |
##  675 |    16.74    27.73 |
##  676 |    16.73    27.72 |
##  677 |    16.72    27.70 |
##  678 |    16.73    27.71 |
##  679 |    16.72    27.71 |
##  680 |    16.72    27.71 |
##  681 |    16.73    27.71 |
##  682 |    16.72    27.71 |
##  683 |    16.72    27.71 |
##  684 |    16.72    27.71 |
##  685 |    16.72    27.71 |
##  686 |    16.72    27.70 |
##  687 |    16.72    27.70 |
##  688 |    16.71    27.69 |
##  689 |    16.71    27.68 |
##  690 |    16.71    27.68 |
##  691 |     16.7    27.67 |
##  692 |     16.7    27.67 |
##  693 |    16.69    27.66 |
##  694 |    16.69    27.65 |
##  695 |    16.69    27.65 |
##  696 |     16.7    27.66 |
##  697 |     16.7    27.66 |
##  698 |     16.7    27.67 |
##  699 |     16.7    27.67 |
##  700 |     16.7    27.67 |
##  701 |    16.71    27.68 |
##  702 |     16.7    27.67 |
##  703 |    16.71    27.68 |
##  704 |     16.7    27.67 |
##  705 |     16.7    27.66 |
##  706 |    16.69    27.65 |
##  707 |    16.69    27.65 |
##  708 |    16.69    27.66 |
##  709 |     16.7    27.67 |
##  710 |    16.71    27.68 |
##  711 |     16.7    27.67 |
##  712 |    16.71    27.68 |
##  713 |    16.71    27.68 |
##  714 |     16.7    27.67 |
##  715 |     16.7    27.67 |
##  716 |     16.7    27.66 |
##  717 |    16.69    27.65 |
##  718 |    16.69    27.65 |
##  719 |     16.7    27.67 |
##  720 |    16.71    27.68 |
##  721 |    16.71    27.68 |
##  722 |    16.71    27.68 |
##  723 |    16.71    27.68 |
##  724 |    16.71    27.69 |
##  725 |    16.71    27.69 |
##  726 |    16.71    27.69 |
##  727 |    16.71    27.68 |
##  728 |    16.71    27.68 |
##  729 |    16.71    27.69 |
##  730 |    16.72    27.70 |
##  731 |    16.72    27.71 |
##  732 |    16.73    27.72 |
##  733 |    16.73    27.71 |
##  734 |    16.72    27.71 |
##  735 |    16.72    27.70 |
##  736 |    16.72    27.71 |
##  737 |    16.73    27.71 |
##  738 |    16.73    27.72 |
##  739 |    16.74    27.73 |
##  740 |    16.73    27.73 |
##  741 |    16.73    27.72 |
##  742 |    16.74    27.73 |
##  743 |    16.74    27.73 |
##  744 |    16.74    27.74 |
##  745 |    16.74    27.74 |
##  746 |    16.75    27.75 |
##  747 |    16.75    27.74 |
##  748 |    16.74    27.73 |
##  749 |    16.73    27.72 |
##  750 |    16.74    27.73 |
##  751 |    16.74    27.73 |
##  752 |    16.74    27.74 |
##  753 |    16.74    27.74 |
##  754 |    16.74    27.74 |
##  755 |    16.74    27.74 |
##  756 |    16.74    27.74 |
##  757 |    16.75    27.74 |
##  758 |    16.75    27.75 |
##  759 |    16.75    27.75 |
##  760 |    16.75    27.75 |
##  761 |    16.74    27.74 |
##  762 |    16.74    27.74 |
##  763 |    16.75    27.76 |
##  764 |    16.76    27.76 |
##  765 |    16.76    27.76 |
##  766 |    16.76    27.76 |
##  767 |    16.76    27.77 |
##  768 |    16.76    27.77 |
##  769 |    16.75    27.76 |
##  770 |    16.76    27.76 |
##  771 |    16.76    27.77 |
##  772 |    16.76    27.77 |
##  773 |    16.76    27.77 |
##  774 |    16.76    27.77 |
##  775 |    16.76    27.77 |
##  776 |    16.76    27.76 |
##  777 |    16.76    27.76 |
##  778 |    16.76    27.77 |
##  779 |    16.76    27.77 |
##  780 |    16.76    27.77 |
##  781 |    16.76    27.77 |
##  782 |    16.77    27.78 |
##  783 |    16.77    27.79 |
##  784 |    16.78    27.80 |
##  785 |    16.78    27.80 |
##  786 |    16.78    27.80 |
##  787 |    16.78    27.80 |
##  788 |    16.79    27.81 |
##  789 |    16.79    27.81 |
##  790 |    16.79    27.81 |
##  791 |    16.79    27.82 |
##  792 |    16.79    27.81 |
##  793 |    16.79    27.81 |
##  794 |    16.79    27.82 |
##  795 |    16.79    27.81 |
##  796 |    16.79    27.81 |
##  797 |    16.78    27.81 |
##  798 |    16.78    27.80 |
##  799 |    16.77    27.79 |
##  800 |    16.77    27.78 |
##  801 |    16.77    27.78 |
##  802 |    16.77    27.78 |
##  803 |    16.77    27.78 |
##  804 |    16.77    27.78 |
##  805 |    16.76    27.77 |
##  806 |    16.77    27.78 |
##  807 |    16.78    27.79 |
##  808 |    16.78    27.80 |
##  809 |    16.78    27.80 |
##  810 |    16.78    27.80 |
##  811 |    16.78    27.80 |
##  812 |    16.78    27.81 |
##  813 |    16.78    27.80 |
##  814 |    16.77    27.79 |
##  815 |    16.77    27.79 |
##  816 |    16.78    27.80 |
##  817 |    16.78    27.80 |
##  818 |    16.77    27.79 |
##  819 |    16.77    27.79 |
##  820 |    16.77    27.79 |
##  821 |    16.77    27.79 |
##  822 |    16.77    27.79 |
##  823 |    16.77    27.79 |
##  824 |    16.77    27.78 |
##  825 |    16.76    27.77 |
##  826 |    16.76    27.77 |
##  827 |    16.76    27.77 |
##  828 |    16.76    27.77 |
##  829 |    16.75    27.76 |
##  830 |    16.75    27.76 |
##  831 |    16.76    27.77 |
##  832 |    16.76    27.77 |
##  833 |    16.76    27.77 |
##  834 |    16.76    27.77 |
##  835 |    16.77    27.78 |
##  836 |    16.77    27.78 |
##  837 |    16.76    27.77 |
##  838 |    16.77    27.78 |
##  839 |    16.77    27.78 |
##  840 |    16.76    27.77 |
##  841 |    16.77    27.78 |
##  842 |    16.77    27.78 |
##  843 |    16.77    27.79 |
##  844 |    16.77    27.79 |
##  845 |    16.77    27.78 |
##  846 |    16.77    27.78 |
##  847 |    16.77    27.79 |
##  848 |    16.77    27.78 |
##  849 |    16.77    27.79 |
##  850 |    16.78    27.79 |
##  851 |    16.77    27.79 |
##  852 |    16.77    27.78 |
##  853 |    16.76    27.77 |
##  854 |    16.75    27.75 |
##  855 |    16.75    27.75 |
##  856 |    16.76    27.77 |
##  857 |    16.76    27.76 |
##  858 |    16.76    27.77 |
##  859 |    16.76    27.77 |
##  860 |    16.77    27.78 |
##  861 |    16.77    27.78 |
##  862 |    16.77    27.78 |
##  863 |    16.76    27.77 |
##  864 |    16.77    27.78 |
##  865 |    16.77    27.78 |
##  866 |    16.77    27.79 |
##  867 |    16.78    27.80 |
##  868 |    16.78    27.80 |
##  869 |    16.78    27.80 |
##  870 |    16.78    27.81 |
##  871 |    16.79    27.81 |
##  872 |     16.8    27.83 |
##  873 |    16.79    27.82 |
##  874 |    16.79    27.82 |
##  875 |    16.79    27.82 |
##  876 |    16.79    27.82 |
##  877 |    16.79    27.81 |
##  878 |    16.78    27.81 |
##  879 |    16.79    27.81 |
##  880 |    16.79    27.82 |
##  881 |    16.79    27.81 |
##  882 |    16.79    27.81 |
##  883 |    16.79    27.82 |
##  884 |    16.79    27.82 |
##  885 |    16.79    27.82 |
##  886 |    16.79    27.82 |
##  887 |    16.79    27.82 |
##  888 |    16.79    27.81 |
##  889 |    16.79    27.82 |
##  890 |     16.8    27.83 |
##  891 |     16.8    27.84 |
##  892 |     16.8    27.83 |
##  893 |     16.8    27.84 |
##  894 |    16.81    27.85 |
##  895 |    16.81    27.85 |
##  896 |    16.81    27.85 |
##  897 |    16.81    27.84 |
##  898 |     16.8    27.84 |
##  899 |     16.8    27.83 |
##  900 |     16.8    27.83 |
##  901 |    16.79    27.82 |
##  902 |     16.8    27.83 |
##  903 |    16.79    27.82 |
##  904 |    16.79    27.82 |
##  905 |    16.79    27.82 |
##  906 |    16.78    27.81 |
##  907 |    16.79    27.81 |
##  908 |    16.79    27.82 |
##  909 |    16.79    27.81 |
##  910 |    16.79    27.81 |
##  911 |    16.78    27.81 |
##  912 |    16.78    27.80 |
##  913 |    16.78    27.80 |
##  914 |    16.78    27.80 |
##  915 |    16.78    27.81 |
##  916 |    16.79    27.81 |
##  917 |    16.78    27.80 |
##  918 |    16.79    27.81 |
##  919 |    16.79    27.81 |
##  920 |    16.79    27.81 |
##  921 |    16.79    27.81 |
##  922 |    16.79    27.82 |
##  923 |    16.79    27.82 |
##  924 |     16.8    27.83 |
##  925 |     16.8    27.83 |
##  926 |     16.8    27.83 |
##  927 |     16.8    27.83 |
##  928 |     16.8    27.83 |
##  929 |     16.8    27.83 |
##  930 |    16.79    27.82 |
##  931 |    16.79    27.82 |
##  932 |    16.79    27.82 |
##  933 |    16.79    27.82 |
##  934 |    16.79    27.82 |
##  935 |     16.8    27.83 |
##  936 |     16.8    27.83 |
##  937 |     16.8    27.83 |
##  938 |     16.8    27.84 |
##  939 |     16.8    27.84 |
##  940 |     16.8    27.83 |
##  941 |     16.8    27.84 |
##  942 |    16.81    27.84 |
##  943 |    16.81    27.84 |
##  944 |    16.81    27.85 |
##  945 |    16.81    27.85 |
##  946 |    16.82    27.86 |
##  947 |    16.82    27.87 |
##  948 |    16.82    27.87 |
##  949 |    16.82    27.87 |
##  950 |    16.83    27.88 |
##  951 |    16.83    27.89 |
##  952 |    16.84    27.90 |
##  953 |    16.83    27.89 |
##  954 |    16.84    27.90 |
##  955 |    16.84    27.90 |
##  956 |    16.84    27.91 |
##  957 |    16.84    27.90 |
##  958 |    16.84    27.90 |
##  959 |    16.84    27.90 |
##  960 |    16.84    27.90 |
##  961 |    16.84    27.89 |
##  962 |    16.83    27.89 |
##  963 |    16.83    27.89 |
##  964 |    16.83    27.89 |
##  965 |    16.83    27.89 |
##  966 |    16.83    27.88 |
##  967 |    16.82    27.87 |
##  968 |    16.82    27.87 |
##  969 |    16.82    27.87 |
##  970 |    16.82    27.86 |
##  971 |    16.82    27.86 |
##  972 |    16.82    27.86 |
##  973 |    16.83    27.88 |
##  974 |    16.83    27.88 |
##  975 |    16.83    27.88 |
##  976 |    16.83    27.89 |
##  977 |    16.83    27.88 |
##  978 |    16.83    27.88 |
##  979 |    16.83    27.88 |
##  980 |    16.83    27.88 |
##  981 |    16.83    27.88 |
##  982 |    16.83    27.89 |
##  983 |    16.84    27.89 |
##  984 |    16.83    27.89 |
##  985 |    16.83    27.88 |
##  986 |    16.83    27.88 |
##  987 |    16.83    27.88 |
##  988 |    16.83    27.89 |
##  989 |    16.83    27.89 |
##  990 |    16.83    27.88 |
##  991 |    16.82    27.87 |
##  992 |    16.83    27.88 |
##  993 |    16.83    27.88 |
##  994 |    16.83    27.89 |
##  995 |    16.83    27.89 |
##  996 |    16.83    27.88 |
##  997 |    16.82    27.87 |
##  998 |    16.82    27.87 |
##  999 |    16.82    27.87 |
## 1000 |    16.82    27.87 |
forest
## 
## Call:
##  randomForest(formula = O3 ~ ., data = train, ntree = 1000, nodesize = 5,      maxnodes = 10, importance = TRUE, localImp = TRUE, nPerm = 2,      proximity = TRUE, norm.votes = TRUE, do.trace = TRUE, keep.forest = TRUE,      corr.bias = FALSE) 
##                Type of random forest: regression
##                      Number of trees: 1000
## No. of variables tried at each split: 3
## 
##           Mean of squared residuals: 16.82176
##                     % Var explained: 72.13
varImpPlot(x = forest, sort = TRUE, main = "Variable Importance Relative to O3", scale = TRUE)

varImpPlot(x = forest, sort = TRUE, main = "Variable Importance Relative to O3", scale = FALSE)

min_depth_frame <- min_depth_distribution(forest)
## Warning: Factor `split var` contains implicit NA, consider using
## `forcats::fct_explicit_na`
save(min_depth_frame, file = "min_depth_frame.rda")
load("min_depth_frame.rda")
head(min_depth_frame, n = 10)
##    tree variable minimal_depth
## 1     1      dpg             2
## 2     1      ibt             0
## 3     1       ID             2
## 4     1     temp             1
## 5     1      vis             3
## 6     2      dpg             0
## 7     2      ibt             1
## 8     2     temp             2
## 9     2      vis             2
## 10    2      doy             2

Cool stuff I found while trying to visualize trees

data(chiroptera)
groupInfo <- split(chiroptera$tip.label, gsub("_\\w+", "", chiroptera$tip.label))
chiroptera <- groupOTU(chiroptera, groupInfo)
ggtree(chiroptera, aes(color = group), layout = 'circular') + geom_tiplab(size = 1, aes(angle = angle))

#rpart.predict(redwood)
#ggtree(redwood, aes(color = group), layout = 'circular') + geom_tiplab(size = 1, aes(angle = angle))