R version 2.15.2 (2012-10-26) -- "Trick or Treat" Copyright (C) 2012 The R Foundation for Statistical Computing ISBN 3-900051-07-0 Platform: i686-pc-linux-gnu (32-bit) 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(493 + ,116 + ,377 + ,7.4 + ,9.1 + ,9 + ,481 + ,111 + ,370 + ,7.2 + ,9.1 + ,9 + ,462 + ,104 + ,358 + ,7 + ,9 + ,9 + ,457 + ,100 + ,357 + ,7 + ,8.9 + ,8.9 + ,442 + ,93 + ,349 + ,6.8 + ,8.8 + ,8.9 + ,439 + ,91 + ,348 + ,6.8 + ,8.7 + ,8.8 + ,488 + ,119 + ,369 + ,6.7 + ,8.7 + ,8.8 + ,521 + ,139 + ,381 + ,6.7 + ,8.6 + ,8.7 + ,501 + ,134 + ,368 + ,6.7 + ,8.5 + ,8.7 + ,485 + ,124 + ,361 + ,6.8 + ,8.4 + ,8.6 + ,464 + ,113 + ,351 + ,6.7 + ,8.4 + ,8.6 + ,460 + ,109 + ,351 + ,6.6 + ,8.3 + ,8.5 + ,467 + ,109 + ,358 + ,6.4 + ,8.2 + ,8.5 + ,460 + ,106 + ,354 + ,6.3 + ,8.2 + ,8.5 + ,448 + ,101 + ,347 + ,6.3 + ,8.1 + ,8.5 + ,443 + ,98 + ,345 + ,6.5 + ,8.1 + ,8.5 + ,436 + ,93 + ,343 + ,6.5 + ,8.1 + ,8.5 + ,431 + ,91 + ,340 + ,6.4 + ,8.1 + ,8.5 + ,484 + ,122 + ,362 + ,6.2 + ,8.1 + ,8.5 + ,510 + ,139 + ,370 + ,6.2 + ,8.1 + ,8.6 + ,513 + ,140 + ,373 + ,6.5 + ,8.1 + ,8.6 + ,503 + ,132 + ,371 + ,7 + ,8.2 + ,8.6 + ,471 + ,117 + ,354 + ,7.2 + ,8.2 + ,8.7 + ,471 + ,114 + ,357 + ,7.3 + ,8.3 + ,8.7 + ,476 + ,113 + ,363 + ,7.4 + ,8.2 + ,8.7 + ,475 + ,110 + ,364 + ,7.4 + ,8.3 + ,8.8 + ,470 + ,107 + ,363 + ,7.4 + ,8.3 + ,8.8 + ,461 + ,103 + ,358 + ,7.3 + ,8.4 + ,8.9 + ,455 + ,98 + ,357 + ,7.4 + ,8.5 + ,8.9 + ,456 + ,98 + ,357 + ,7.4 + ,8.5 + ,8.9 + ,517 + ,137 + ,380 + ,7.6 + ,8.6 + ,9 + ,525 + ,148 + ,378 + ,7.6 + ,8.6 + ,9 + ,523 + ,147 + ,376 + ,7.7 + ,8.7 + ,9 + ,519 + ,139 + ,380 + ,7.7 + ,8.7 + ,9 + ,509 + ,130 + ,379 + ,7.8 + ,8.8 + ,9 + ,512 + ,128 + ,384 + ,7.8 + ,8.8 + ,9 + ,519 + ,127 + ,392 + ,8 + ,8.9 + ,9.1 + ,517 + ,123 + ,394 + ,8.1 + ,9 + ,9.1 + ,510 + ,118 + ,392 + ,8.1 + ,9 + ,9.1 + ,509 + ,114 + ,396 + ,8.2 + ,9 + ,9.1 + ,501 + ,108 + ,392 + ,8.1 + ,9 + ,9.1 + ,507 + ,111 + ,396 + ,8.1 + ,9.1 + ,9.1 + ,569 + ,151 + ,419 + ,8.1 + ,9.1 + ,9.1 + ,580 + ,159 + ,421 + ,8.1 + ,9 + ,9.1 + ,578 + ,158 + ,420 + ,8.2 + ,9.1 + ,9.1 + ,565 + ,148 + ,418 + ,8.2 + ,9 + ,9.1 + ,547 + ,138 + ,410 + ,8.3 + ,9.1 + ,9.1 + ,555 + ,137 + ,418 + ,8.4 + ,9.1 + ,9.2 + ,562 + ,136 + ,426 + ,8.6 + ,9.2 + ,9.3 + ,561 + ,133 + ,428 + ,8.6 + ,9.2 + ,9.3 + ,555 + ,126 + ,430 + ,8.4 + ,9.2 + ,9.3 + ,544 + ,120 + ,424 + ,8 + ,9.2 + ,9.2 + ,537 + ,114 + ,423 + ,7.9 + ,9.2 + ,9.2 + ,543 + ,116 + ,427 + ,8.1 + ,9.3 + ,9.2 + ,594 + ,153 + ,441 + ,8.5 + ,9.3 + ,9.2 + ,611 + ,162 + ,449 + ,8.8 + ,9.3 + ,9.2 + ,613 + ,161 + ,452 + ,8.8 + ,9.3 + ,9.2 + ,611 + ,149 + ,462 + ,8.5 + ,9.3 + ,9.2 + ,594 + ,139 + ,455 + ,8.3 + ,9.4 + ,9.2 + ,595 + ,135 + ,461 + ,8.3 + ,9.4 + ,9.2 + ,591 + ,130 + ,461 + ,8.3 + ,9.3 + ,9.2 + ,589 + ,127 + ,463 + ,8.4 + ,9.3 + ,9.2 + ,584 + ,122 + ,462 + ,8.5 + ,9.3 + ,9.2 + ,573 + ,117 + ,456 + ,8.5 + ,9.3 + ,9.2 + ,567 + ,112 + ,455 + ,8.6 + ,9.2 + ,9.1 + ,569 + ,113 + ,456 + ,8.5 + ,9.2 + ,9.1 + ,621 + ,149 + ,472 + ,8.6 + ,9.2 + ,9 + ,629 + ,157 + ,472 + ,8.6 + ,9.1 + ,8.9 + ,628 + ,157 + ,471 + ,8.6 + ,9.1 + ,8.9 + ,612 + ,147 + ,465 + ,8.5 + ,9.1 + ,9 + ,595 + ,137 + ,459 + ,8.4 + ,9.1 + ,8.9 + ,597 + ,132 + ,465 + ,8.4 + ,9 + ,8.8 + ,593 + ,125 + ,468 + ,8.5 + ,8.9 + ,8.7 + ,590 + ,123 + ,467 + ,8.5 + ,8.8 + ,8.6 + ,580 + ,117 + ,463 + ,8.5 + ,8.7 + ,8.5 + ,574 + ,114 + ,460 + ,8.6 + ,8.6 + ,8.5 + ,573 + ,111 + ,462 + ,8.6 + ,8.6 + ,8.4 + ,573 + ,112 + ,461 + ,8.4 + ,8.5 + ,8.3 + ,620 + ,144 + ,476 + ,8.2 + ,8.4 + ,8.2 + ,626 + ,150 + ,476 + ,8 + ,8.4 + ,8.2 + ,620 + ,149 + ,471 + ,8 + ,8.3 + ,8.1 + ,588 + ,134 + ,453 + ,8 + ,8.2 + ,8 + ,566 + ,123 + ,443 + ,8 + ,8.2 + ,7.9 + ,557 + ,116 + ,442 + ,7.9 + ,8 + ,7.8 + ,561 + ,117 + ,444 + ,7.9 + ,7.9 + ,7.6 + ,549 + ,111 + ,438 + ,7.9 + ,7.8 + ,7.5 + ,532 + ,105 + ,427 + ,7.9 + ,7.7 + ,7.4 + ,526 + ,102 + ,424 + ,8 + ,7.6 + ,7.3 + ,511 + ,95 + ,416 + ,7.9 + ,7.6 + ,7.3 + ,499 + ,93 + ,406 + ,7.4 + ,7.6 + ,7.2 + ,555 + ,124 + ,431 + ,7.2 + ,7.6 + ,7.2 + ,565 + ,130 + ,434 + ,7 + ,7.6 + ,7.2 + ,542 + ,124 + ,418 + ,6.9 + ,7.5 + ,7.1 + ,527 + ,115 + ,412 + ,7.1 + ,7.5 + ,7 + ,510 + ,106 + ,404 + ,7.2 + ,7.4 + ,7 + ,514 + ,105 + ,409 + ,7.2 + ,7.4 + ,6.9 + ,517 + ,105 + ,412 + ,7.1 + ,7.4 + ,6.9 + ,508 + ,101 + ,406 + ,6.9 + ,7.3 + ,6.8 + ,493 + ,95 + ,398 + ,6.8 + ,7.3 + ,6.8 + ,490 + ,93 + ,397 + ,6.8 + ,7.4 + ,6.8 + ,469 + ,84 + ,385 + ,6.8 + ,7.5 + ,6.9 + ,478 + ,87 + ,390 + ,6.9 + ,7.6 + ,7 + ,528 + ,116 + ,413 + ,7.1 + ,7.6 + ,7 + ,534 + ,120 + ,413 + ,7.2 + ,7.7 + ,7.1 + ,518 + ,117 + ,401 + ,7.2 + ,7.7 + ,7.2 + ,506 + ,109 + ,397 + ,7.1 + ,7.9 + ,7.3 + ,502 + ,105 + ,397 + ,7.1 + ,8.1 + ,7.5 + ,516 + ,107 + ,409 + ,7.2 + ,8.4 + ,7.7 + ,528 + ,109 + ,419 + ,7.5 + ,8.7 + ,8.1 + ,533 + ,109 + ,424 + ,7.7 + ,9 + ,8.4 + ,536 + ,108 + ,428 + ,7.8 + ,9.3 + ,8.6 + ,537 + ,107 + ,430 + ,7.7 + ,9.4 + ,8.8 + ,524 + ,99 + ,424 + ,7.7 + ,9.5 + ,8.9 + ,536 + ,103 + ,433 + ,7.8 + ,9.6 + ,9.1 + ,587 + ,131 + ,456 + ,8 + ,9.8 + ,9.2 + ,597 + ,137 + ,459 + ,8.1 + ,9.8 + ,9.3 + ,581 + ,135 + ,446 + ,8.1 + ,9.9 + ,9.4 + ,564 + ,124 + ,441 + ,8 + ,10 + ,9.4 + ,558 + ,118 + ,439 + ,8.1 + ,10 + ,9.5 + ,575 + ,121 + ,454 + ,8.2 + ,10.1 + ,9.5 + ,580 + ,121 + ,460 + ,8.4 + ,10.1 + ,9.7 + ,575 + ,118 + ,457 + ,8.5 + ,10.1 + ,9.7 + ,563 + ,113 + ,451 + ,8.5 + ,10.1 + ,9.7 + ,552 + ,107 + ,444 + ,8.5 + ,10.2 + ,9.7 + ,537 + ,100 + ,437 + ,8.5 + ,10.2 + ,9.7 + ,545 + ,102 + ,443 + ,8.5 + ,10.1 + ,9.6 + ,601 + ,130 + ,471 + ,8.4 + ,10.1 + ,9.6 + ,604 + ,136 + ,469 + ,8.3 + ,10.1 + ,9.6 + ,586 + ,133 + ,454 + ,8.2 + ,10.1 + ,9.6 + ,564 + ,120 + ,444 + ,8.1 + ,10.1 + ,9.6 + ,549 + ,112 + ,436 + ,7.9 + ,10.1 + ,9.6 + ,551 + ,109 + ,442 + ,7.6 + ,10.1 + ,9.6 + ,556 + ,110 + ,446 + ,7.3 + ,10 + ,9.5 + ,548 + ,106 + ,442 + ,7.1 + ,9.9 + ,9.5 + ,540 + ,102 + ,438 + ,7 + ,9.9 + ,9.4 + ,531 + ,98 + ,433 + ,7.1 + ,9.9 + ,9.4 + ,521 + ,92 + ,428 + ,7.1 + ,9.9 + ,9.5 + ,519 + ,92 + ,426 + ,7.1 + ,10 + ,9.5 + ,572 + ,120 + ,452 + ,7.3 + ,10.1 + ,9.6 + ,581 + ,127 + ,455 + ,7.3 + ,10.2 + ,9.7 + ,563 + ,124 + ,439 + ,7.3 + ,10.3 + ,9.8 + ,548 + ,114 + ,434 + ,7.2 + ,10.5 + ,9.9 + ,539 + ,108 + ,431 + ,7.2 + ,10.6 + ,10 + ,541 + ,106 + ,435 + ,7.1 + ,10.7 + ,10 + ,562 + ,111 + ,450 + ,7.1 + ,10.8 + ,10.1) + ,dim=c(6 + ,145) + ,dimnames=list(c('Totaal_werklozen' + ,'Jonger_dan_25_jaar' + ,'Vanaf_25_jaar' + ,'Belgie' + ,'Eurogebied' + ,'EU_27') + ,1:145)) > y <- array(NA,dim=c(6,145),dimnames=list(c('Totaal_werklozen','Jonger_dan_25_jaar','Vanaf_25_jaar','Belgie','Eurogebied','EU_27'),1:145)) > 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 = '5' > 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, 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) Hmisc library by Frank E Harrell Jr Type library(help='Hmisc'), ?Overview, or ?Hmisc.Overview') to see overall documentation. NOTE:Hmisc no longer redefines [.factor to drop unused levels when subsetting. To get the old behavior of Hmisc type dropUnusedLevels(). 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] "Eurogebied" > x[,par1] [1] 9.1 9.1 9.0 8.9 8.8 8.7 8.7 8.6 8.5 8.4 8.4 8.3 8.2 8.2 8.1 [16] 8.1 8.1 8.1 8.1 8.1 8.1 8.2 8.2 8.3 8.2 8.3 8.3 8.4 8.5 8.5 [31] 8.6 8.6 8.7 8.7 8.8 8.8 8.9 9.0 9.0 9.0 9.0 9.1 9.1 9.0 9.1 [46] 9.0 9.1 9.1 9.2 9.2 9.2 9.2 9.2 9.3 9.3 9.3 9.3 9.3 9.4 9.4 [61] 9.3 9.3 9.3 9.3 9.2 9.2 9.2 9.1 9.1 9.1 9.1 9.0 8.9 8.8 8.7 [76] 8.6 8.6 8.5 8.4 8.4 8.3 8.2 8.2 8.0 7.9 7.8 7.7 7.6 7.6 7.6 [91] 7.6 7.6 7.5 7.5 7.4 7.4 7.4 7.3 7.3 7.4 7.5 7.6 7.6 7.7 7.7 [106] 7.9 8.1 8.4 8.7 9.0 9.3 9.4 9.5 9.6 9.8 9.8 9.9 10.0 10.0 10.1 [121] 10.1 10.1 10.1 10.2 10.2 10.1 10.1 10.1 10.1 10.1 10.1 10.1 10.0 9.9 9.9 [136] 9.9 9.9 10.0 10.1 10.2 10.3 10.5 10.6 10.7 10.8 > 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]) 7.3 7.4 7.5 7.6 7.7 7.8 7.9 8 8.1 8.2 8.3 8.4 8.5 8.6 8.7 8.8 2 4 3 7 3 1 2 1 8 7 5 6 4 5 6 4 8.9 9 9.1 9.2 9.3 9.4 9.5 9.6 9.8 9.9 10 10.1 10.2 10.3 10.5 10.6 3 9 11 8 10 3 1 1 2 5 4 12 3 1 1 1 10.7 10.8 1 1 > colnames(x) [1] "Totaal_werklozen" "Jonger_dan_25_jaar" "Vanaf_25_jaar" [4] "Belgie" "Eurogebied" "EU_27" > colnames(x)[par1] [1] "Eurogebied" > x[,par1] [1] 9.1 9.1 9.0 8.9 8.8 8.7 8.7 8.6 8.5 8.4 8.4 8.3 8.2 8.2 8.1 [16] 8.1 8.1 8.1 8.1 8.1 8.1 8.2 8.2 8.3 8.2 8.3 8.3 8.4 8.5 8.5 [31] 8.6 8.6 8.7 8.7 8.8 8.8 8.9 9.0 9.0 9.0 9.0 9.1 9.1 9.0 9.1 [46] 9.0 9.1 9.1 9.2 9.2 9.2 9.2 9.2 9.3 9.3 9.3 9.3 9.3 9.4 9.4 [61] 9.3 9.3 9.3 9.3 9.2 9.2 9.2 9.1 9.1 9.1 9.1 9.0 8.9 8.8 8.7 [76] 8.6 8.6 8.5 8.4 8.4 8.3 8.2 8.2 8.0 7.9 7.8 7.7 7.6 7.6 7.6 [91] 7.6 7.6 7.5 7.5 7.4 7.4 7.4 7.3 7.3 7.4 7.5 7.6 7.6 7.7 7.7 [106] 7.9 8.1 8.4 8.7 9.0 9.3 9.4 9.5 9.6 9.8 9.8 9.9 10.0 10.0 10.1 [121] 10.1 10.1 10.1 10.2 10.2 10.1 10.1 10.1 10.1 10.1 10.1 10.1 10.0 9.9 9.9 [136] 9.9 9.9 10.0 10.1 10.2 10.3 10.5 10.6 10.7 10.8 > if (par2 == 'none') { + m <- ctree(as.formula(paste(colnames(x)[par1],' ~ .',sep='')),data = x) + } > > #Note: the /var/wessaorg/rcomp/createtable file can be downloaded at http://www.wessa.net/cretab > load(file="/var/wessaorg/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/wessaorg/rcomp/tmp/1idi61354907766.tab") + } + } > m Conditional inference tree with 10 terminal nodes Response: Eurogebied Inputs: Totaal_werklozen, Jonger_dan_25_jaar, Vanaf_25_jaar, Belgie, EU_27 Number of observations: 145 1) EU_27 <= 9; criterion = 1, statistic = 120.592 2) EU_27 <= 7.6; criterion = 1, statistic = 61.466 3) EU_27 <= 7; criterion = 1, statistic = 16.792 4)* weights = 10 3) EU_27 > 7 5)* weights = 13 2) EU_27 > 7.6 6) EU_27 <= 8.7; criterion = 1, statistic = 16.288 7) Belgie <= 7.4; criterion = 0.992, statistic = 10.066 8)* weights = 19 7) Belgie > 7.4 9)* weights = 15 6) EU_27 > 8.7 10) Vanaf_25_jaar <= 384; criterion = 0.995, statistic = 10.804 11)* weights = 18 10) Vanaf_25_jaar > 384 12)* weights = 8 1) EU_27 > 9 13) EU_27 <= 9.3; criterion = 1, statistic = 54.905 14) Vanaf_25_jaar <= 426; criterion = 1, statistic = 16.5 15)* weights = 15 14) Vanaf_25_jaar > 426 16)* weights = 18 13) EU_27 > 9.3 17) EU_27 <= 9.6; criterion = 1, statistic = 25.69 18)* weights = 18 17) EU_27 > 9.6 19)* weights = 11 > postscript(file="/var/wessaorg/rcomp/tmp/2rrco1354907766.ps",horizontal=F,onefile=F,pagecentre=F,paper="special",width=8.3333333333333,height=5.5555555555556) > plot(m) > dev.off() null device 1 > postscript(file="/var/wessaorg/rcomp/tmp/3z3ne1354907766.ps",horizontal=F,onefile=F,pagecentre=F,paper="special",width=8.3333333333333,height=5.5555555555556) > 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 9.1 8.694444 0.405555556 2 9.1 8.694444 0.405555556 3 9.0 8.694444 0.305555556 4 8.9 8.694444 0.205555556 5 8.8 8.694444 0.105555556 6 8.7 8.694444 0.005555556 7 8.7 8.694444 0.005555556 8 8.6 8.242105 0.357894737 9 8.5 8.242105 0.257894737 10 8.4 8.242105 0.157894737 11 8.4 8.242105 0.157894737 12 8.3 8.242105 0.057894737 13 8.2 8.242105 -0.042105263 14 8.2 8.242105 -0.042105263 15 8.1 8.242105 -0.142105263 16 8.1 8.242105 -0.142105263 17 8.1 8.242105 -0.142105263 18 8.1 8.242105 -0.142105263 19 8.1 8.242105 -0.142105263 20 8.1 8.242105 -0.142105263 21 8.1 8.242105 -0.142105263 22 8.2 8.242105 -0.042105263 23 8.2 8.242105 -0.042105263 24 8.3 8.242105 0.057894737 25 8.2 8.242105 -0.042105263 26 8.3 8.694444 -0.394444444 27 8.3 8.694444 -0.394444444 28 8.4 8.694444 -0.294444444 29 8.5 8.694444 -0.194444444 30 8.5 8.694444 -0.194444444 31 8.6 8.694444 -0.094444444 32 8.6 8.694444 -0.094444444 33 8.7 8.694444 0.005555556 34 8.7 8.694444 0.005555556 35 8.8 8.694444 0.105555556 36 8.8 8.694444 0.105555556 37 8.9 9.066667 -0.166666667 38 9.0 9.066667 -0.066666667 39 9.0 9.066667 -0.066666667 40 9.0 9.066667 -0.066666667 41 9.0 9.066667 -0.066666667 42 9.1 9.066667 0.033333333 43 9.1 9.066667 0.033333333 44 9.0 9.066667 -0.066666667 45 9.1 9.066667 0.033333333 46 9.0 9.066667 -0.066666667 47 9.1 9.066667 0.033333333 48 9.1 9.066667 0.033333333 49 9.2 9.066667 0.133333333 50 9.2 9.361111 -0.161111111 51 9.2 9.361111 -0.161111111 52 9.2 9.066667 0.133333333 53 9.2 9.066667 0.133333333 54 9.3 9.361111 -0.061111111 55 9.3 9.361111 -0.061111111 56 9.3 9.361111 -0.061111111 57 9.3 9.361111 -0.061111111 58 9.3 9.361111 -0.061111111 59 9.4 9.361111 0.038888889 60 9.4 9.361111 0.038888889 61 9.3 9.361111 -0.061111111 62 9.3 9.361111 -0.061111111 63 9.3 9.361111 -0.061111111 64 9.3 9.361111 -0.061111111 65 9.2 9.361111 -0.161111111 66 9.2 9.361111 -0.161111111 67 9.2 9.187500 0.012500000 68 9.1 9.187500 -0.087500000 69 9.1 9.187500 -0.087500000 70 9.1 9.187500 -0.087500000 71 9.1 9.187500 -0.087500000 72 9.0 9.187500 -0.187500000 73 8.9 8.573333 0.326666667 74 8.8 8.573333 0.226666667 75 8.7 8.573333 0.126666667 76 8.6 8.573333 0.026666667 77 8.6 8.573333 0.026666667 78 8.5 8.573333 -0.073333333 79 8.4 8.573333 -0.173333333 80 8.4 8.573333 -0.173333333 81 8.3 8.573333 -0.273333333 82 8.2 8.573333 -0.373333333 83 8.2 8.573333 -0.373333333 84 8.0 8.573333 -0.573333333 85 7.9 7.715385 0.184615385 86 7.8 7.715385 0.084615385 87 7.7 7.715385 -0.015384615 88 7.6 7.715385 -0.115384615 89 7.6 7.715385 -0.115384615 90 7.6 7.715385 -0.115384615 91 7.6 7.715385 -0.115384615 92 7.6 7.715385 -0.115384615 93 7.5 7.715385 -0.215384615 94 7.5 7.440000 0.060000000 95 7.4 7.440000 -0.040000000 96 7.4 7.440000 -0.040000000 97 7.4 7.440000 -0.040000000 98 7.3 7.440000 -0.140000000 99 7.3 7.440000 -0.140000000 100 7.4 7.440000 -0.040000000 101 7.5 7.440000 0.060000000 102 7.6 7.440000 0.160000000 103 7.6 7.440000 0.160000000 104 7.7 7.715385 -0.015384615 105 7.7 7.715385 -0.015384615 106 7.9 7.715385 0.184615385 107 8.1 7.715385 0.384615385 108 8.4 8.242105 0.157894737 109 8.7 8.573333 0.126666667 110 9.0 8.573333 0.426666667 111 9.3 8.573333 0.726666667 112 9.4 9.187500 0.212500000 113 9.5 9.187500 0.312500000 114 9.6 9.361111 0.238888889 115 9.8 9.361111 0.438888889 116 9.8 9.361111 0.438888889 117 9.9 10.022222 -0.122222222 118 10.0 10.022222 -0.022222222 119 10.0 10.022222 -0.022222222 120 10.1 10.022222 0.077777778 121 10.1 10.345455 -0.245454545 122 10.1 10.345455 -0.245454545 123 10.1 10.345455 -0.245454545 124 10.2 10.345455 -0.145454545 125 10.2 10.345455 -0.145454545 126 10.1 10.022222 0.077777778 127 10.1 10.022222 0.077777778 128 10.1 10.022222 0.077777778 129 10.1 10.022222 0.077777778 130 10.1 10.022222 0.077777778 131 10.1 10.022222 0.077777778 132 10.1 10.022222 0.077777778 133 10.0 10.022222 -0.022222222 134 9.9 10.022222 -0.122222222 135 9.9 10.022222 -0.122222222 136 9.9 10.022222 -0.122222222 137 9.9 10.022222 -0.122222222 138 10.0 10.022222 -0.022222222 139 10.1 10.022222 0.077777778 140 10.2 10.345455 -0.145454545 141 10.3 10.345455 -0.045454545 142 10.5 10.345455 0.154545455 143 10.6 10.345455 0.254545455 144 10.7 10.345455 0.354545455 145 10.8 10.345455 0.454545455 > if (par2 != 'none') { + print(cbind(as.factor(x[,par1]),predict(m))) + myt <- table(as.factor(x[,par1]),predict(m)) + print(myt) + } > postscript(file="/var/wessaorg/rcomp/tmp/40idu1354907766.ps",horizontal=F,onefile=F,pagecentre=F,paper="special",width=8.3333333333333,height=5.5555555555556) > 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/wessaorg/rcomp/tmp/50bqn1354907766.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/wessaorg/rcomp/tmp/6au2e1354907766.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/wessaorg/rcomp/tmp/74m6x1354907766.tab") + } > > try(system("convert tmp/2rrco1354907766.ps tmp/2rrco1354907766.png",intern=TRUE)) character(0) > try(system("convert tmp/3z3ne1354907766.ps tmp/3z3ne1354907766.png",intern=TRUE)) character(0) > try(system("convert tmp/40idu1354907766.ps tmp/40idu1354907766.png",intern=TRUE)) character(0) > > > proc.time() user system elapsed 5.202 0.370 5.550