R version 2.9.0 (2009-04-17) Copyright (C) 2009 The R Foundation for Statistical Computing ISBN 3-900051-07-0 R is free software and comes with ABSOLUTELY NO WARRANTY. You are welcome to redistribute it under certain conditions. Type 'license()' or 'licence()' for distribution details. R is a collaborative project with many contributors. Type 'contributors()' for more information and 'citation()' on how to cite R or R packages in publications. Type 'demo()' for some demos, 'help()' for on-line help, or 'help.start()' for an HTML browser interface to help. Type 'q()' to quit R. > x <- array(list(3.04 + ,493 + ,9 + ,3.030 + ,9.026 + ,25.64 + ,104.8 + ,3.28 + ,481 + ,11 + ,2.803 + ,9.787 + ,27.97 + ,105.2 + ,3.51 + ,462 + ,13 + ,2.768 + ,9.536 + ,27.62 + ,105.6 + ,3.69 + ,457 + ,12 + ,2.883 + ,9.490 + ,23.31 + ,105.8 + ,3.92 + ,442 + ,13 + ,2.863 + ,9.736 + ,29.07 + ,106.1 + ,4.29 + ,439 + ,15 + ,2.897 + ,9.694 + ,29.58 + ,106.5 + ,4.31 + ,488 + ,13 + ,3.013 + ,9.647 + ,28.63 + ,106.71 + ,4.42 + ,521 + ,16 + ,3.143 + ,9.753 + ,29.92 + ,106.68 + ,4.59 + ,501 + ,10 + ,3.033 + ,10.070 + ,32.68 + ,107.41 + ,4.76 + ,485 + ,14 + ,3.046 + ,10.137 + ,31.54 + ,107.15 + ,4.83 + ,464 + ,14 + ,3.111 + ,9.984 + ,32.43 + ,107.5 + ,4.83 + ,460 + ,45 + ,3.013 + ,9.732 + ,26.54 + ,107.22 + ,4.76 + ,467 + ,13 + ,2.987 + ,9.103 + ,25.85 + ,107.11 + ,4.99 + ,460 + ,8 + ,2.996 + ,9.155 + ,27.60 + ,107.57 + ,4.78 + ,448 + ,7 + ,2.833 + ,9.308 + ,25.71 + ,107.81 + ,5.06 + ,443 + ,3 + ,2.849 + ,9.394 + ,25.38 + ,108.75 + ,4.65 + ,436 + ,3 + ,2.795 + ,9.948 + ,28.57 + ,109.43 + ,4.54 + ,431 + ,4 + ,2.845 + ,10.177 + ,27.64 + ,109.62 + ,4.51 + ,484 + ,4 + ,2.915 + ,10.002 + ,25.36 + ,109.54 + ,4.49 + ,510 + ,0 + ,2.893 + ,9.728 + ,25.90 + ,109.53 + ,3.99 + ,513 + ,-4 + ,2.604 + ,10.002 + ,26.29 + ,109.84 + ,3.97 + ,503 + ,-14 + ,2.642 + ,10.063 + ,21.74 + ,109.67 + ,3.51 + ,471 + ,-18 + ,2.660 + ,10.018 + ,19.20 + ,109.79 + ,3.34 + ,471 + ,-8 + ,2.639 + ,9.960 + ,19.32 + ,109.56 + ,3.29 + ,476 + ,-1 + ,2.720 + ,10.236 + ,19.82 + ,110.22 + ,3.28 + ,475 + ,1 + ,2.746 + ,10.893 + ,20.36 + ,110.4 + ,3.26 + ,470 + ,2 + ,2.736 + ,10.756 + ,24.31 + ,110.69 + ,3.32 + ,461 + ,0 + ,2.812 + ,10.940 + ,25.97 + ,110.72 + ,3.31 + ,455 + ,1 + ,2.799 + ,10.997 + ,25.61 + ,110.89 + ,3.35 + ,456 + ,0 + ,2.555 + ,10.827 + ,24.67 + ,110.58 + ,3.30 + ,517 + ,-1 + ,2.305 + ,10.166 + ,25.59 + ,110.94 + ,3.29 + ,525 + ,-3 + ,2.215 + ,10.186 + ,26.09 + ,110.91 + ,3.32 + ,523 + ,-3 + ,2.066 + ,10.457 + ,28.37 + ,111.22 + ,3.30 + ,519 + ,-3 + ,1.940 + ,10.368 + ,27.34 + ,111.09 + ,3.30 + ,509 + ,-4 + ,2.042 + ,10.244 + ,24.46 + ,111 + ,3.09 + ,512 + ,-8 + ,1.995 + ,10.511 + ,27.46 + ,111.06 + ,2.79 + ,519 + ,-9 + ,1.947 + ,10.812 + ,30.23 + ,111.55 + ,2.76 + ,517 + ,-13 + ,1.766 + ,10.738 + ,32.33 + ,112.32 + ,2.75 + ,510 + ,-18 + ,1.635 + ,10.171 + ,29.87 + ,112.64 + ,2.56 + ,509 + ,-11 + ,1.833 + ,9.721 + ,24.87 + ,112.36 + ,2.56 + ,501 + ,-9 + ,1.910 + ,9.897 + ,25.48 + ,112.04 + ,2.21 + ,507 + ,-10 + ,1.960 + ,9.828 + ,27.28 + ,112.37 + ,2.08 + ,569 + ,-13 + ,1.970 + ,9.924 + ,28.24 + ,112.59 + ,2.10 + ,580 + ,-11 + ,2.061 + ,10.371 + ,29.58 + ,112.89 + ,2.02 + ,578 + ,-5 + ,2.093 + ,10.846 + ,26.95 + ,113.22 + ,2.01 + ,565 + ,-15 + ,2.121 + ,10.413 + ,29.08 + ,112.85 + ,1.97 + ,547 + ,-6 + ,2.175 + ,10.709 + ,28.76 + ,113.06 + ,2.06 + ,555 + ,-6 + ,2.197 + ,10.662 + ,29.59 + ,112.99 + ,2.02 + ,562 + ,-3 + ,2.350 + ,10.570 + ,30.70 + ,113.32 + ,2.03 + ,561 + ,-1 + ,2.440 + ,10.297 + ,30.52 + ,113.74 + ,2.01 + ,555 + ,-3 + ,2.409 + ,10.635 + ,32.67 + ,113.91 + ,2.08 + ,544 + ,-4 + ,2.473 + ,10.872 + ,33.19 + ,114.52 + ,2.02 + ,537 + ,-6 + ,2.408 + ,10.296 + ,37.13 + ,114.96 + ,2.03 + ,543 + ,0 + ,2.455 + ,10.383 + ,35.54 + ,114.91 + ,2.07 + ,594 + ,-4 + ,2.448 + ,10.431 + ,37.75 + ,115.3 + ,2.04 + ,611 + ,-2 + ,2.498 + ,10.574 + ,41.84 + ,115.44 + ,2.05 + ,613 + ,-2 + ,2.646 + ,10.653 + ,42.94 + ,115.52 + ,2.11 + ,611 + ,-6 + ,2.757 + ,10.805 + ,49.14 + ,116.08 + ,2.09 + ,594 + ,-7 + ,2.849 + ,10.872 + ,44.61 + ,115.94 + ,2.05 + ,595 + ,-6 + ,2.921 + ,10.625 + ,40.22 + ,115.56 + ,2.08 + ,591 + ,-6 + ,2.982 + ,10.407 + ,44.23 + ,115.88 + ,2.06 + ,589 + ,-3 + ,3.081 + ,10.463 + ,45.85 + ,116.66 + ,2.06 + ,584 + ,-2 + ,3.106 + ,10.556 + ,53.38 + ,117.41 + ,2.08 + ,573 + ,-5 + ,3.119 + ,10.646 + ,53.26 + ,117.68 + ,2.07 + ,567 + ,-11 + ,3.061 + ,10.702 + ,51.80 + ,117.85 + ,2.06 + ,569 + ,-11 + ,3.097 + ,11.353 + ,55.30 + ,118.21 + ,2.07 + ,621 + ,-11 + ,3.162 + ,11.346 + ,57.81 + ,118.92 + ,2.06 + ,629 + ,-10 + ,3.257 + ,11.451 + ,63.96 + ,119.03 + ,2.09 + ,628 + ,-14 + ,3.277 + ,11.964 + ,63.77 + ,119.17 + ,2.07 + ,612 + ,-8 + ,3.295 + ,12.574 + ,59.15 + ,118.95 + ,2.09 + ,595 + ,-9 + ,3.364 + ,13.031 + ,56.12 + ,118.92 + ,2.28 + ,597 + ,-5 + ,3.494 + ,13.812 + ,57.42 + ,118.9 + ,2.33 + ,593 + ,-1 + ,3.667 + ,14.544 + ,63.52 + ,118.92 + ,2.35 + ,590 + ,-2 + ,3.813 + ,14.931 + ,61.71 + ,119.44 + ,2.52 + ,580 + ,-5 + ,3.918 + ,14.886 + ,63.01 + ,119.40 + ,2.63 + ,574 + ,-4 + ,3.896 + ,16.005 + ,68.18 + ,119.98 + ,2.58 + ,573 + ,-6 + ,3.801 + ,17.064 + ,72.03 + ,120.43 + ,2.70 + ,573 + ,-2 + ,3.570 + ,15.168 + ,69.75 + ,120.41 + ,2.81 + ,620 + ,-2 + ,3.702 + ,16.050 + ,74.41 + ,120.82 + ,2.97 + ,626 + ,-2 + ,3.862 + ,15.839 + ,74.33 + ,120.97 + ,3.04 + ,620 + ,-2 + ,3.970 + ,15.137 + ,64.24 + ,120.63 + ,3.28 + ,588 + ,2 + ,4.139 + ,14.954 + ,60.03 + ,120.38 + ,3.33 + ,566 + ,1 + ,4.200 + ,15.648 + ,59.44 + ,120.68 + ,3.50 + ,557 + ,-8 + ,4.291 + ,15.305 + ,62.50 + ,120.84 + ,3.56 + ,561 + ,-1 + ,4.444 + ,15.579 + ,55.04 + ,120.90 + ,3.57 + ,549 + ,1 + ,4.503 + ,16.348 + ,58.34 + ,121.56 + ,3.69 + ,532 + ,-1 + ,4.357 + ,15.928 + ,61.92 + ,121.57 + ,3.82 + ,526 + ,2 + ,4.591 + ,16.171 + ,67.65 + ,122.12 + ,3.79 + ,511 + ,2 + ,4.697 + ,15.937 + ,67.68 + ,121.97 + ,3.96 + ,499 + ,1 + ,4.621 + ,15.713 + ,70.30 + ,121.96 + ,4.06 + ,555 + ,-1 + ,4.563 + ,15.594 + ,75.26 + ,122.48 + ,4.05 + ,565 + ,-2 + ,4.203 + ,15.683 + ,71.44 + ,122.33 + ,4.03 + ,542 + ,-2 + ,4.296 + ,16.438 + ,76.36 + ,122.44 + ,3.94 + ,527 + ,-1 + ,4.435 + ,17.032 + ,81.71 + ,123.08 + ,4.02 + ,510 + ,-8 + ,4.105 + ,17.696 + ,92.60 + ,124.23 + ,3.88 + ,514 + ,-4 + ,4.117 + ,17.745 + ,90.60 + ,124.58 + ,4.02 + ,517 + ,-6 + ,3.844 + ,19.394 + ,92.23 + ,125.08 + ,4.03 + ,508 + ,-3 + ,3.721 + ,20.148 + ,94.09 + ,125.98 + ,4.09 + ,493 + ,-3 + ,3.674 + ,20.108 + ,102.79 + ,126.90 + ,3.99 + ,490 + ,-7 + ,3.858 + ,18.584 + ,109.65 + ,127.19 + ,4.01 + ,469 + ,-9 + ,3.801 + ,18.441 + ,124.05 + ,128.33 + ,4.01 + ,478 + ,-11 + ,3.504 + ,18.391 + ,132.69 + ,129.04 + ,4.19 + ,528 + ,-13 + ,3.033 + ,19.178 + ,135.81 + ,129.72 + ,4.30 + ,534 + ,-11 + ,3.047 + ,18.079 + ,116.07 + ,128.92 + ,4.27 + ,518 + ,-9 + ,2.962 + ,18.483 + ,101.42 + ,129.13 + ,3.82 + ,506 + ,-17 + ,2.198 + ,19.644 + ,75.73 + ,128.90 + ,3.15 + ,502 + ,-22 + ,2.014 + ,19.195 + ,55.48 + ,128.13 + ,2.49 + ,516 + ,-25 + ,1.863 + ,19.650 + ,43.80 + ,127.85 + ,1.81 + ,528 + ,-20 + ,1.905 + ,20.830 + ,45.29 + ,127.98 + ,1.26 + ,533 + ,-24 + ,1.811 + ,23.595 + ,44.01 + ,128.42 + ,1.06 + ,536 + ,-24 + ,1.670 + ,22.937 + ,47.48 + ,127.68 + ,0.84 + ,537 + ,-22 + ,1.864 + ,21.814 + ,51.07 + ,127.95 + ,0.78 + ,524 + ,-19 + ,2.052 + ,21.928 + ,57.84 + ,127.85 + ,0.70 + ,536 + ,-18 + ,2.030 + ,21.777 + ,69.04 + ,127.61 + ,0.36 + ,587 + ,-17 + ,2.071 + ,21.383 + ,65.61 + ,127.53 + ,0.35 + ,597 + ,-11 + ,2.293 + ,21.467 + ,72.87 + ,127.92 + ,0.36 + ,581 + ,-11 + ,2.443 + ,22.052 + ,68.41 + ,127.59 + ,0.36 + ,564 + ,-12 + ,2.513 + ,22.680 + ,73.25 + ,127.65 + ,0.36 + ,558 + ,-10 + ,2.467 + ,24.320 + ,77.43 + ,127.98 + ,0.35 + ,575 + ,-15 + ,2.503 + ,24.977 + ,75.28 + ,128.19 + ,0.34 + ,580 + ,-15 + ,2.540 + ,25.204 + ,77.33 + ,128.77 + ,0.34 + ,575 + ,-15 + ,2.483 + ,25.739 + ,74.31 + ,129.31 + ,0.35 + ,563 + ,-13 + ,2.626 + ,26.434 + ,79.70 + ,129.80 + ,0.35 + ,552 + ,-8 + ,2.656 + ,27.525 + ,85.47 + ,130.24 + ,0.34 + ,537 + ,-13 + ,2.447 + ,30.695 + ,77.98 + ,130.76 + ,0.35 + ,545 + ,-9 + ,2.467 + ,32.436 + ,75.69 + ,130.75 + ,0.48 + ,601 + ,-7 + ,2.462 + ,30.160 + ,75.20 + ,130.81 + ,0.43 + ,604 + ,-4 + ,2.505 + ,30.236 + ,77.21 + ,130.89 + ,0.45 + ,586 + ,-4 + ,2.579 + ,31.293 + ,77.85 + ,131.30 + ,0.70 + ,564 + ,-2 + ,2.649 + ,31.077 + ,83.53 + ,131.49 + ,0.59 + ,549 + ,0 + ,2.637 + ,32.226 + ,85.99 + ,131.65) + ,dim=c(7 + ,131) + ,dimnames=list(c('Eonia' + ,'Werkloosheid' + ,'Consumentenvertrouwen' + ,'BEL20' + ,'Goudprijs' + ,'Olieprijs' + ,'CPI') + ,1:131)) > y <- array(NA,dim=c(7,131),dimnames=list(c('Eonia','Werkloosheid','Consumentenvertrouwen','BEL20','Goudprijs','Olieprijs','CPI'),1:131)) > for (i in 1:dim(x)[1]) + { + for (j in 1:dim(x)[2]) + { + y[i,j] <- as.numeric(x[i,j]) + } + } > par4 = 'no' > par3 = '3' > par2 = 'none' > par1 = '4' > #'GNU S' R Code compiled by R2WASP v. 1.0.44 () > #Author: Dr. Ian E. Holliday > #To cite this work: Ian E. Holliday, 2009, YOUR SOFTWARE TITLE (vNUMBER) in Free Statistics Software (v$_version), Office for Research Development and Education, URL http://www.wessa.net/rwasp_YOURPAGE.wasp/ > #Source of accompanying publication: > #Technical description: > library(party) Loading required package: survival Loading required package: splines Loading required package: grid Loading required package: modeltools Loading required package: stats4 Loading required package: coin Loading required package: mvtnorm Loading required package: zoo Attaching package: 'zoo' The following object(s) are masked from package:base : as.Date.numeric Loading required package: sandwich Loading required package: strucchange Loading required package: vcd Loading required package: MASS Loading required package: colorspace > library(Hmisc) Attaching package: 'Hmisc' The following object(s) are masked from package:survival : untangle.specials The following object(s) are masked from package:base : format.pval, round.POSIXt, trunc.POSIXt, units > par1 <- as.numeric(par1) > par3 <- as.numeric(par3) > x <- data.frame(t(y)) > is.data.frame(x) [1] TRUE > x <- x[!is.na(x[,par1]),] > k <- length(x[1,]) > n <- length(x[,1]) > colnames(x)[par1] [1] "BEL20" > x[,par1] [1] 3.030 2.803 2.768 2.883 2.863 2.897 3.013 3.143 3.033 3.046 3.111 3.013 [13] 2.987 2.996 2.833 2.849 2.795 2.845 2.915 2.893 2.604 2.642 2.660 2.639 [25] 2.720 2.746 2.736 2.812 2.799 2.555 2.305 2.215 2.066 1.940 2.042 1.995 [37] 1.947 1.766 1.635 1.833 1.910 1.960 1.970 2.061 2.093 2.121 2.175 2.197 [49] 2.350 2.440 2.409 2.473 2.408 2.455 2.448 2.498 2.646 2.757 2.849 2.921 [61] 2.982 3.081 3.106 3.119 3.061 3.097 3.162 3.257 3.277 3.295 3.364 3.494 [73] 3.667 3.813 3.918 3.896 3.801 3.570 3.702 3.862 3.970 4.139 4.200 4.291 [85] 4.444 4.503 4.357 4.591 4.697 4.621 4.563 4.203 4.296 4.435 4.105 4.117 [97] 3.844 3.721 3.674 3.858 3.801 3.504 3.033 3.047 2.962 2.198 2.014 1.863 [109] 1.905 1.811 1.670 1.864 2.052 2.030 2.071 2.293 2.443 2.513 2.467 2.503 [121] 2.540 2.483 2.626 2.656 2.447 2.467 2.462 2.505 2.579 2.649 2.637 > if (par2 == 'kmeans') { + cl <- kmeans(x[,par1], par3) + print(cl) + clm <- matrix(cbind(cl$centers,1:par3),ncol=2) + clm <- clm[sort.list(clm[,1]),] + for (i in 1:par3) { + cl$cluster[cl$cluster==clm[i,2]] <- paste('C',i,sep='') + } + cl$cluster <- as.factor(cl$cluster) + print(cl$cluster) + x[,par1] <- cl$cluster + } > if (par2 == 'quantiles') { + x[,par1] <- cut2(x[,par1],g=par3) + } > if (par2 == 'hclust') { + hc <- hclust(dist(x[,par1])^2, 'cen') + print(hc) + memb <- cutree(hc, k = par3) + dum <- c(mean(x[memb==1,par1])) + for (i in 2:par3) { + dum <- c(dum, mean(x[memb==i,par1])) + } + hcm <- matrix(cbind(dum,1:par3),ncol=2) + hcm <- hcm[sort.list(hcm[,1]),] + for (i in 1:par3) { + memb[memb==hcm[i,2]] <- paste('C',i,sep='') + } + memb <- as.factor(memb) + print(memb) + x[,par1] <- memb + } > if (par2=='equal') { + ed <- cut(as.numeric(x[,par1]),par3,labels=paste('C',1:par3,sep='')) + x[,par1] <- as.factor(ed) + } > table(x[,par1]) 1.635 1.67 1.766 1.811 1.833 1.863 1.864 1.905 1.91 1.94 1.947 1.96 1.97 1 1 1 1 1 1 1 1 1 1 1 1 1 1.995 2.014 2.03 2.042 2.052 2.061 2.066 2.071 2.093 2.121 2.175 2.197 2.198 1 1 1 1 1 1 1 1 1 1 1 1 1 2.215 2.293 2.305 2.35 2.408 2.409 2.44 2.443 2.447 2.448 2.455 2.462 2.467 1 1 1 1 1 1 1 1 1 1 1 1 2 2.473 2.483 2.498 2.503 2.505 2.513 2.54 2.555 2.579 2.604 2.626 2.637 2.639 1 1 1 1 1 1 1 1 1 1 1 1 1 2.642 2.646 2.649 2.656 2.66 2.72 2.736 2.746 2.757 2.768 2.795 2.799 2.803 1 1 1 1 1 1 1 1 1 1 1 1 1 2.812 2.833 2.845 2.849 2.863 2.883 2.893 2.897 2.915 2.921 2.962 2.982 2.987 1 1 1 2 1 1 1 1 1 1 1 1 1 2.996 3.013 3.03 3.033 3.046 3.047 3.061 3.081 3.097 3.106 3.111 3.119 3.143 1 2 1 2 1 1 1 1 1 1 1 1 1 3.162 3.257 3.277 3.295 3.364 3.494 3.504 3.57 3.667 3.674 3.702 3.721 3.801 1 1 1 1 1 1 1 1 1 1 1 1 2 3.813 3.844 3.858 3.862 3.896 3.918 3.97 4.105 4.117 4.139 4.2 4.203 4.291 1 1 1 1 1 1 1 1 1 1 1 1 1 4.296 4.357 4.435 4.444 4.503 4.563 4.591 4.621 4.697 1 1 1 1 1 1 1 1 1 > colnames(x) [1] "Eonia" "Werkloosheid" "Consumentenvertrouwen" [4] "BEL20" "Goudprijs" "Olieprijs" [7] "CPI" > colnames(x)[par1] [1] "BEL20" > x[,par1] [1] 3.030 2.803 2.768 2.883 2.863 2.897 3.013 3.143 3.033 3.046 3.111 3.013 [13] 2.987 2.996 2.833 2.849 2.795 2.845 2.915 2.893 2.604 2.642 2.660 2.639 [25] 2.720 2.746 2.736 2.812 2.799 2.555 2.305 2.215 2.066 1.940 2.042 1.995 [37] 1.947 1.766 1.635 1.833 1.910 1.960 1.970 2.061 2.093 2.121 2.175 2.197 [49] 2.350 2.440 2.409 2.473 2.408 2.455 2.448 2.498 2.646 2.757 2.849 2.921 [61] 2.982 3.081 3.106 3.119 3.061 3.097 3.162 3.257 3.277 3.295 3.364 3.494 [73] 3.667 3.813 3.918 3.896 3.801 3.570 3.702 3.862 3.970 4.139 4.200 4.291 [85] 4.444 4.503 4.357 4.591 4.697 4.621 4.563 4.203 4.296 4.435 4.105 4.117 [97] 3.844 3.721 3.674 3.858 3.801 3.504 3.033 3.047 2.962 2.198 2.014 1.863 [109] 1.905 1.811 1.670 1.864 2.052 2.030 2.071 2.293 2.443 2.513 2.467 2.503 [121] 2.540 2.483 2.626 2.656 2.447 2.467 2.462 2.505 2.579 2.649 2.637 > if (par2 == 'none') { + m <- ctree(as.formula(paste(colnames(x)[par1],' ~ .',sep='')),data = x) + } > > #Note: the /var/www/html/rcomp/createtable file can be downloaded at http://www.wessa.net/cretab > load(file="/var/www/html/rcomp/createtable") > > if (par2 != 'none') { + m <- ctree(as.formula(paste('as.factor(',colnames(x)[par1],') ~ .',sep='')),data = x) + if (par4=='yes') { + a<-table.start() + a<-table.row.start(a) + a<-table.element(a,'10-Fold Cross Validation',3+2*par3,TRUE) + a<-table.row.end(a) + a<-table.row.start(a) + a<-table.element(a,'',1,TRUE) + a<-table.element(a,'Prediction (training)',par3+1,TRUE) + a<-table.element(a,'Prediction (testing)',par3+1,TRUE) + a<-table.row.end(a) + a<-table.row.start(a) + a<-table.element(a,'Actual',1,TRUE) + for (jjj in 1:par3) a<-table.element(a,paste('C',jjj,sep=''),1,TRUE) + a<-table.element(a,'CV',1,TRUE) + for (jjj in 1:par3) a<-table.element(a,paste('C',jjj,sep=''),1,TRUE) + a<-table.element(a,'CV',1,TRUE) + a<-table.row.end(a) + for (i in 1:10) { + ind <- sample(2, nrow(x), replace=T, prob=c(0.9,0.1)) + m.ct <- ctree(as.formula(paste('as.factor(',colnames(x)[par1],') ~ .',sep='')),data =x[ind==1,]) + if (i==1) { + m.ct.i.pred <- predict(m.ct, newdata=x[ind==1,]) + m.ct.i.actu <- x[ind==1,par1] + m.ct.x.pred <- predict(m.ct, newdata=x[ind==2,]) + m.ct.x.actu <- x[ind==2,par1] + } else { + m.ct.i.pred <- c(m.ct.i.pred,predict(m.ct, newdata=x[ind==1,])) + m.ct.i.actu <- c(m.ct.i.actu,x[ind==1,par1]) + m.ct.x.pred <- c(m.ct.x.pred,predict(m.ct, newdata=x[ind==2,])) + m.ct.x.actu <- c(m.ct.x.actu,x[ind==2,par1]) + } + } + print(m.ct.i.tab <- table(m.ct.i.actu,m.ct.i.pred)) + numer <- 0 + for (i in 1:par3) { + print(m.ct.i.tab[i,i] / sum(m.ct.i.tab[i,])) + numer <- numer + m.ct.i.tab[i,i] + } + print(m.ct.i.cp <- numer / sum(m.ct.i.tab)) + print(m.ct.x.tab <- table(m.ct.x.actu,m.ct.x.pred)) + numer <- 0 + for (i in 1:par3) { + print(m.ct.x.tab[i,i] / sum(m.ct.x.tab[i,])) + numer <- numer + m.ct.x.tab[i,i] + } + print(m.ct.x.cp <- numer / sum(m.ct.x.tab)) + for (i in 1:par3) { + a<-table.row.start(a) + a<-table.element(a,paste('C',i,sep=''),1,TRUE) + for (jjj in 1:par3) a<-table.element(a,m.ct.i.tab[i,jjj]) + a<-table.element(a,round(m.ct.i.tab[i,i]/sum(m.ct.i.tab[i,]),4)) + for (jjj in 1:par3) a<-table.element(a,m.ct.x.tab[i,jjj]) + a<-table.element(a,round(m.ct.x.tab[i,i]/sum(m.ct.x.tab[i,]),4)) + a<-table.row.end(a) + } + a<-table.row.start(a) + a<-table.element(a,'Overall',1,TRUE) + for (jjj in 1:par3) a<-table.element(a,'-') + a<-table.element(a,round(m.ct.i.cp,4)) + for (jjj in 1:par3) a<-table.element(a,'-') + a<-table.element(a,round(m.ct.x.cp,4)) + a<-table.row.end(a) + a<-table.end(a) + table.save(a,file="/var/www/html/rcomp/tmp/1f6jt1293040702.tab") + } + } > m Conditional inference tree with 10 terminal nodes Response: BEL20 Inputs: Eonia, Werkloosheid, Consumentenvertrouwen, Goudprijs, Olieprijs, CPI Number of observations: 131 1) Olieprijs <= 51.07; criterion = 1, statistic = 26.184 2) Consumentenvertrouwen <= -1; criterion = 1, statistic = 36.508 3) Consumentenvertrouwen <= -9; criterion = 0.996, statistic = 11.817 4)* weights = 16 3) Consumentenvertrouwen > -9 5) Olieprijs <= 37.75; criterion = 0.985, statistic = 9.123 6)* weights = 18 5) Olieprijs > 37.75 7)* weights = 7 2) Consumentenvertrouwen > -1 8) Eonia <= 3.51; criterion = 0.996, statistic = 11.412 9)* weights = 9 8) Eonia > 3.51 10)* weights = 17 1) Olieprijs > 51.07 11) Consumentenvertrouwen <= -9; criterion = 1, statistic = 37.163 12) Consumentenvertrouwen <= -15; criterion = 0.997, statistic = 11.908 13)* weights = 8 12) Consumentenvertrouwen > -15 14)* weights = 18 11) Consumentenvertrouwen > -9 15) Eonia <= 2.08; criterion = 1, statistic = 30.307 16)* weights = 9 15) Eonia > 2.08 17) Eonia <= 3.04; criterion = 0.986, statistic = 9.257 18)* weights = 10 17) Eonia > 3.04 19)* weights = 19 > postscript(file="/var/www/html/rcomp/tmp/28f1w1293040702.ps",horizontal=F,onefile=F,pagecentre=F,paper="special",width=12.5,height=8.3333333333333) > plot(m) > dev.off() null device 1 > postscript(file="/var/www/html/rcomp/tmp/38f1w1293040702.ps",horizontal=F,onefile=F,pagecentre=F,paper="special",width=12.5,height=8.3333333333333) > plot(x[,par1] ~ as.factor(where(m)),main='Response by Terminal Node',xlab='Terminal Node',ylab='Response') > dev.off() null device 1 > if (par2 == 'none') { + forec <- predict(m) + result <- as.data.frame(cbind(x[,par1],forec,x[,par1]-forec)) + colnames(result) <- c('Actuals','Forecasts','Residuals') + print(result) + } Actuals Forecasts Residuals 1 3.030 2.744889 0.285111111 2 2.803 2.744889 0.058111111 3 2.768 2.744889 0.023111111 4 2.883 2.947941 -0.064941176 5 2.863 2.947941 -0.084941176 6 2.897 2.947941 -0.050941176 7 3.013 2.947941 0.065058824 8 3.143 2.947941 0.195058824 9 3.033 2.947941 0.085058824 10 3.046 2.947941 0.098058824 11 3.111 2.947941 0.163058824 12 3.013 2.947941 0.065058824 13 2.987 2.947941 0.039058824 14 2.996 2.947941 0.048058824 15 2.833 2.947941 -0.114941176 16 2.849 2.947941 -0.098941176 17 2.795 2.947941 -0.152941176 18 2.845 2.947941 -0.102941176 19 2.915 2.947941 -0.032941176 20 2.893 2.947941 -0.054941176 21 2.604 2.306611 0.297388889 22 2.642 1.976125 0.665875000 23 2.660 1.976125 0.683875000 24 2.639 2.306611 0.332388889 25 2.720 2.306611 0.413388889 26 2.746 2.744889 0.001111111 27 2.736 2.744889 -0.008888889 28 2.812 2.744889 0.067111111 29 2.799 2.744889 0.054111111 30 2.555 2.744889 -0.189888889 31 2.305 2.306611 -0.001611111 32 2.215 2.306611 -0.091611111 33 2.066 2.306611 -0.240611111 34 1.940 2.306611 -0.366611111 35 2.042 2.306611 -0.264611111 36 1.995 2.306611 -0.311611111 37 1.947 1.976125 -0.029125000 38 1.766 1.976125 -0.210125000 39 1.635 1.976125 -0.341125000 40 1.833 1.976125 -0.143125000 41 1.910 1.976125 -0.066125000 42 1.960 1.976125 -0.016125000 43 1.970 1.976125 -0.006125000 44 2.061 1.976125 0.084875000 45 2.093 2.306611 -0.213611111 46 2.121 1.976125 0.144875000 47 2.175 2.306611 -0.131611111 48 2.197 2.306611 -0.109611111 49 2.350 2.306611 0.043388889 50 2.440 2.306611 0.133388889 51 2.409 2.306611 0.102388889 52 2.473 2.306611 0.166388889 53 2.408 2.306611 0.101388889 54 2.455 2.744889 -0.289888889 55 2.448 2.306611 0.141388889 56 2.498 2.819143 -0.321142857 57 2.646 2.819143 -0.173142857 58 2.757 2.819143 -0.062142857 59 2.849 2.819143 0.029857143 60 2.921 2.819143 0.101857143 61 2.982 2.819143 0.162857143 62 3.081 2.819143 0.261857143 63 3.106 2.778667 0.327333333 64 3.119 2.778667 0.340333333 65 3.061 2.934500 0.126500000 66 3.097 2.934500 0.162500000 67 3.162 2.934500 0.227500000 68 3.257 2.934500 0.322500000 69 3.277 2.934500 0.342500000 70 3.295 2.778667 0.516333333 71 3.364 2.934500 0.429500000 72 3.494 3.769300 -0.275300000 73 3.667 3.769300 -0.102300000 74 3.813 3.769300 0.043700000 75 3.918 3.769300 0.148700000 76 3.896 3.769300 0.126700000 77 3.801 3.769300 0.031700000 78 3.570 3.769300 -0.199300000 79 3.702 3.769300 -0.067300000 80 3.862 3.769300 0.092700000 81 3.970 3.769300 0.200700000 82 4.139 4.245211 -0.106210526 83 4.200 4.245211 -0.045210526 84 4.291 4.245211 0.045789474 85 4.444 4.245211 0.198789474 86 4.503 4.245211 0.257789474 87 4.357 4.245211 0.111789474 88 4.591 4.245211 0.345789474 89 4.697 4.245211 0.451789474 90 4.621 4.245211 0.375789474 91 4.563 4.245211 0.317789474 92 4.203 4.245211 -0.042210526 93 4.296 4.245211 0.050789474 94 4.435 4.245211 0.189789474 95 4.105 4.245211 -0.140210526 96 4.117 4.245211 -0.128210526 97 3.844 4.245211 -0.401210526 98 3.721 4.245211 -0.524210526 99 3.674 4.245211 -0.571210526 100 3.858 4.245211 -0.387210526 101 3.801 2.934500 0.866500000 102 3.504 2.934500 0.569500000 103 3.033 2.934500 0.098500000 104 3.047 2.934500 0.112500000 105 2.962 2.934500 0.027500000 106 2.198 2.236375 -0.038375000 107 2.014 2.236375 -0.222375000 108 1.863 1.976125 -0.113125000 109 1.905 1.976125 -0.071125000 110 1.811 1.976125 -0.165125000 111 1.670 1.976125 -0.306125000 112 1.864 1.976125 -0.112125000 113 2.052 2.236375 -0.184375000 114 2.030 2.236375 -0.206375000 115 2.071 2.236375 -0.165375000 116 2.293 2.934500 -0.641500000 117 2.443 2.934500 -0.491500000 118 2.513 2.934500 -0.421500000 119 2.467 2.934500 -0.467500000 120 2.503 2.236375 0.266625000 121 2.540 2.236375 0.303625000 122 2.483 2.236375 0.246625000 123 2.626 2.934500 -0.308500000 124 2.656 2.778667 -0.122666667 125 2.447 2.934500 -0.487500000 126 2.467 2.934500 -0.467500000 127 2.462 2.778667 -0.316666667 128 2.505 2.778667 -0.273666667 129 2.579 2.778667 -0.199666667 130 2.649 2.778667 -0.129666667 131 2.637 2.778667 -0.141666667 > if (par2 != 'none') { + print(cbind(as.factor(x[,par1]),predict(m))) + myt <- table(as.factor(x[,par1]),predict(m)) + print(myt) + } > postscript(file="/var/www/html/rcomp/tmp/4joiy1293040702.ps",horizontal=F,onefile=F,pagecentre=F,paper="special",width=12.5,height=8.3333333333333) > if(par2=='none') { + op <- par(mfrow=c(2,2)) + plot(density(result$Actuals),main='Kernel Density Plot of Actuals') + plot(density(result$Residuals),main='Kernel Density Plot of Residuals') + plot(result$Forecasts,result$Actuals,main='Actuals versus Predictions',xlab='Predictions',ylab='Actuals') + plot(density(result$Forecasts),main='Kernel Density Plot of Predictions') + par(op) + } > if(par2!='none') { + plot(myt,main='Confusion Matrix',xlab='Actual',ylab='Predicted') + } > dev.off() null device 1 > if (par2 == 'none') { + detcoef <- cor(result$Forecasts,result$Actuals) + a<-table.start() + a<-table.row.start(a) + a<-table.element(a,'Goodness of Fit',2,TRUE) + a<-table.row.end(a) + a<-table.row.start(a) + a<-table.element(a,'Correlation',1,TRUE) + a<-table.element(a,round(detcoef,4)) + a<-table.row.end(a) + a<-table.row.start(a) + a<-table.element(a,'R-squared',1,TRUE) + a<-table.element(a,round(detcoef*detcoef,4)) + a<-table.row.end(a) + a<-table.row.start(a) + a<-table.element(a,'RMSE',1,TRUE) + a<-table.element(a,round(sqrt(mean((result$Residuals)^2)),4)) + a<-table.row.end(a) + a<-table.end(a) + table.save(a,file="/var/www/html/rcomp/tmp/5m7y41293040702.tab") + a<-table.start() + a<-table.row.start(a) + a<-table.element(a,'Actuals, Predictions, and Residuals',4,TRUE) + a<-table.row.end(a) + a<-table.row.start(a) + a<-table.element(a,'#',header=TRUE) + a<-table.element(a,'Actuals',header=TRUE) + a<-table.element(a,'Forecasts',header=TRUE) + a<-table.element(a,'Residuals',header=TRUE) + a<-table.row.end(a) + for (i in 1:length(result$Actuals)) { + a<-table.row.start(a) + a<-table.element(a,i,header=TRUE) + a<-table.element(a,result$Actuals[i]) + a<-table.element(a,result$Forecasts[i]) + a<-table.element(a,result$Residuals[i]) + a<-table.row.end(a) + } + a<-table.end(a) + table.save(a,file="/var/www/html/rcomp/tmp/687xa1293040702.tab") + } > if (par2 != 'none') { + a<-table.start() + a<-table.row.start(a) + a<-table.element(a,'Confusion Matrix (predicted in columns / actuals in rows)',par3+1,TRUE) + a<-table.row.end(a) + a<-table.row.start(a) + a<-table.element(a,'',1,TRUE) + for (i in 1:par3) { + a<-table.element(a,paste('C',i,sep=''),1,TRUE) + } + a<-table.row.end(a) + for (i in 1:par3) { + a<-table.row.start(a) + a<-table.element(a,paste('C',i,sep=''),1,TRUE) + for (j in 1:par3) { + a<-table.element(a,myt[i,j]) + } + a<-table.row.end(a) + } + a<-table.end(a) + table.save(a,file="/var/www/html/rcomp/tmp/70hed1293040702.tab") + } > > try(system("convert tmp/28f1w1293040702.ps tmp/28f1w1293040702.png",intern=TRUE)) character(0) > try(system("convert tmp/38f1w1293040702.ps tmp/38f1w1293040702.png",intern=TRUE)) character(0) > try(system("convert tmp/4joiy1293040702.ps tmp/4joiy1293040702.png",intern=TRUE)) character(0) > > > proc.time() user system elapsed 3.223 0.643 7.604