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(22.037 + ,17.759 + ,14.116 + ,104.708 + ,158.620 + ,21.732 + ,17.530 + ,13.504 + ,101.817 + ,154.583 + ,21.172 + ,17.139 + ,13.168 + ,97.898 + ,149.377 + ,21.388 + ,16.916 + ,13.064 + ,95.559 + ,146.927 + ,22.053 + ,16.543 + ,12.828 + ,92.822 + ,144.246 + ,22.687 + ,16.317 + ,12.541 + ,90.848 + ,142.393 + ,24.793 + ,18.161 + ,13.547 + ,101.141 + ,157.642 + ,26.113 + ,19.144 + ,13.710 + ,105.841 + ,164.808 + ,23.708 + ,16.947 + ,12.535 + ,93.647 + ,146.837 + ,23.554 + ,16.491 + ,12.386 + ,90.923 + ,143.354 + ,23.222 + ,16.428 + ,12.253 + ,89.130 + ,141.033 + ,23.363 + ,16.639 + ,12.484 + ,90.212 + ,142.698 + ,24.023 + ,16.821 + ,12.966 + ,93.196 + ,147.006 + ,23.355 + ,16.765 + ,12.770 + ,91.861 + ,144.751 + ,23.276 + ,16.533 + ,12.660 + ,90.593 + ,143.062 + ,23.085 + ,16.554 + ,12.514 + ,89.895 + ,142.048 + ,23.173 + ,16.494 + ,12.430 + ,88.819 + ,140.916 + ,23.487 + ,16.612 + ,12.372 + ,87.924 + ,140.395 + ,25.576 + ,17.933 + ,13.085 + ,96.906 + ,153.500 + ,26.311 + ,19.070 + ,13.454 + ,101.217 + ,160.052 + ,27.109 + ,18.179 + ,13.361 + ,98.709 + ,157.358 + ,27.060 + ,17.830 + ,13.713 + ,98.139 + ,156.742 + ,26.490 + ,17.349 + ,13.601 + ,95.529 + ,152.969 + ,27.157 + ,17.919 + ,14.090 + ,98.577 + ,157.743 + ,26.973 + ,18.269 + ,14.452 + ,100.772 + ,160.466 + ,27.589 + ,18.385 + ,14.108 + ,100.180 + ,160.262 + ,27.246 + ,18.260 + ,14.036 + ,99.200 + ,158.742 + ,26.845 + ,17.905 + ,13.332 + ,96.251 + ,154.333 + ,26.582 + ,17.730 + ,13.421 + ,94.514 + ,152.247 + ,26.544 + ,17.827 + ,13.279 + ,93.780 + ,151.430 + ,29.105 + ,19.978 + ,14.583 + ,105.192 + ,168.858 + ,28.703 + ,20.315 + ,14.991 + ,107.682 + ,171.691 + ,27.921 + ,18.931 + ,14.313 + ,99.687 + ,160.852 + ,28.566 + ,18.732 + ,14.769 + ,99.436 + ,161.503 + ,29.860 + ,19.155 + ,15.365 + ,102.049 + ,166.429 + ,30.194 + ,19.270 + ,15.448 + ,102.673 + ,167.585 + ,31.330 + ,19.754 + ,16.485 + ,105.813 + ,173.382 + ,31.018 + ,19.845 + ,16.493 + ,105.056 + ,172.412 + ,30.954 + ,19.937 + ,16.748 + ,103.916 + ,171.555 + ,31.398 + ,20.097 + ,16.921 + ,103.513 + ,171.929 + ,31.267 + ,19.981 + ,16.906 + ,101.893 + ,170.047 + ,32.069 + ,20.502 + ,17.050 + ,102.503 + ,172.124 + ,34.665 + ,22.712 + ,18.873 + ,113.149 + ,189.399 + ,35.834 + ,23.101 + ,19.684 + ,116.696 + ,195.315 + ,34.034 + ,21.381 + ,18.260 + ,108.500 + ,182.175 + ,34.435 + ,21.255 + ,18.338 + ,107.800 + ,181.828 + ,34.000 + ,21.053 + ,18.358 + ,105.941 + ,179.352 + ,35.216 + ,21.561 + ,19.394 + ,108.742 + ,184.913 + ,35.734 + ,21.923 + ,20.568 + ,111.680 + ,189.905 + ,35.347 + ,22.001 + ,20.956 + ,111.270 + ,189.574 + ,35.357 + ,22.369 + ,21.523 + ,110.698 + ,189.947 + ,34.802 + ,22.320 + ,22.712 + ,108.517 + ,188.351 + ,34.493 + ,22.149 + ,22.382 + ,107.127 + ,186.151 + ,35.047 + ,22.581 + ,23.168 + ,107.088 + ,187.884 + ,37.386 + ,24.896 + ,24.777 + ,116.321 + ,203.380 + ,38.691 + ,26.610 + ,33.608 + ,125.045 + ,223.954 + ,37.249 + ,25.417 + ,33.137 + ,116.779 + ,212.582 + ,37.668 + ,26.484 + ,34.897 + ,122.887 + ,221.936 + ,36.764 + ,26.329 + ,35.344 + ,120.162 + ,218.599 + ,37.926 + ,26.989 + ,36.152 + ,123.198 + ,224.265 + ,38.145 + ,27.180 + ,37.291 + ,123.610 + ,226.226 + ,37.664 + ,27.284 + ,37.625 + ,122.293 + ,224.866 + ,37.449 + ,27.436 + ,38.034 + ,121.289 + ,224.208 + ,37.389 + ,27.082 + ,38.244 + ,119.393 + ,222.108 + ,37.121 + ,26.818 + ,38.461 + ,117.494 + ,219.894 + ,37.447 + ,27.003 + ,39.078 + ,116.693 + ,220.221 + ,39.751 + ,29.344 + ,40.701 + ,125.062 + ,234.858 + ,40.154 + ,29.777 + ,41.686 + ,127.281 + ,238.898 + ,38.814 + ,28.070 + ,41.294 + ,120.195 + ,228.373 + ,38.673 + ,27.993 + ,41.927 + ,119.804 + ,228.397 + ,37.948 + ,27.672 + ,42.339 + ,117.113 + ,225.072 + ,39.161 + ,27.802 + ,43.170 + ,119.240 + ,229.373 + ,37.408 + ,27.328 + ,43.703 + ,115.823 + ,224.262 + ,37.356 + ,27.666 + ,44.177 + ,116.281 + ,225.480 + ,36.606 + ,27.456 + ,44.703 + ,113.816 + ,222.581 + ,37.040 + ,27.796 + ,45.319 + ,114.632 + ,224.787 + ,36.349 + ,27.642 + ,45.790 + ,112.987 + ,222.768 + ,36.158 + ,27.651 + ,45.838 + ,111.633 + ,221.280 + ,37.342 + ,29.604 + ,46.806 + ,116.721 + ,230.473 + ,36.800 + ,29.196 + ,47.014 + ,114.850 + ,227.860 + ,37.135 + ,28.328 + ,47.381 + ,112.797 + ,225.641 + ,34.265 + ,27.986 + ,47.049 + ,105.368 + ,214.668 + ,33.226 + ,27.738 + ,46.910 + ,102.524 + ,210.398 + ,32.357 + ,27.867 + ,46.853 + ,101.327 + ,208.404 + ,36.870 + ,27.580 + ,46.608 + ,98.873 + ,209.931 + ,35.880 + ,27.381 + ,46.139 + ,95.993 + ,205.393 + ,34.808 + ,27.292 + ,45.954 + ,93.244 + ,201.298 + ,34.025 + ,26.944 + ,45.367 + ,90.403 + ,196.739 + ,33.901 + ,26.329 + ,44.538 + ,88.539 + ,193.307 + ,37.459 + ,29.023 + ,45.897 + ,98.106 + ,210.485 + ,37.152 + ,28.705 + ,45.744 + ,96.963 + ,208.564 + ,34.929 + ,27.213 + ,44.819 + ,90.781 + ,197.742 + ,34.116 + ,27.063 + ,44.836 + ,89.253 + ,195.268 + ,33.710 + ,27.010 + ,44.779 + ,87.794 + ,193.293 + ,34.264 + ,27.709 + ,45.383 + ,89.810 + ,197.166 + ,34.826 + ,27.802 + ,45.613 + ,90.864 + ,199.105 + ,34.096 + ,27.687 + ,45.331 + ,89.025 + ,196.139 + ,33.955 + ,27.719 + ,45.212 + ,87.621 + ,194.507 + ,34.111 + ,27.961 + ,45.329 + ,87.718 + ,195.119 + ,32.344 + ,27.203 + ,44.603 + ,83.433 + ,187.583 + ,32.871 + ,27.747 + ,44.405 + ,84.535 + ,189.558 + ,36.244 + ,30.713 + ,45.701 + ,92.223 + ,204.881 + ,35.988 + ,30.395 + ,45.647 + ,91.052 + ,203.082 + ,35.439 + ,28.895 + ,45.186 + ,88.456 + ,197.976 + ,35.692 + ,28.460 + ,45.113 + ,88.706 + ,197.971 + ,35.804 + ,28.286 + ,45.301 + ,89.137 + ,198.528 + ,37.747 + ,28.984 + ,46.342 + ,94.066 + ,207.139 + ,40.673 + ,29.624 + ,47.309 + ,99.258 + ,216.864 + ,41.601 + ,29.734 + ,47.659 + ,100.673 + ,219.667 + ,42.273 + ,30.603 + ,48.106 + ,102.269 + ,223.251 + ,41.952 + ,30.427 + ,48.087 + ,100.833 + ,221.299 + ,41.463 + ,30.269 + ,48.188 + ,99.314 + ,219.234 + ,42.759 + ,30.798 + ,48.917 + ,101.764 + ,224.238 + ,45.434 + ,32.676 + ,50.312 + ,108.242 + ,236.664 + ,45.776 + ,32.680 + ,50.531 + ,108.148 + ,237.135 + ,44.630 + ,30.737 + ,50.005 + ,104.761 + ,230.133 + ,44.793 + ,30.300 + ,50.306 + ,103.772 + ,229.171 + ,44.757 + ,30.321 + ,50.598 + ,103.737 + ,229.413 + ,49.099 + ,31.282 + ,51.856 + ,111.043 + ,243.280 + ,47.974 + ,30.868 + ,52.132 + ,109.906 + ,240.880 + ,47.919 + ,30.749 + ,52.167 + ,109.335 + ,240.170 + ,47.519 + ,30.236 + ,52.149 + ,107.247 + ,237.151 + ,47.136 + ,29.990 + ,51.976 + ,105.690 + ,234.792 + ,45.910 + ,29.427 + ,51.797 + ,102.755 + ,229.889 + ,46.436 + ,29.376 + ,51.907 + ,102.280 + ,229.999 + ,50.334 + ,30.828 + ,53.589 + ,110.590 + ,245.341 + ,50.294 + ,30.532 + ,53.814 + ,109.122 + ,243.762 + ,47.224 + ,29.166 + ,52.436 + ,102.795 + ,231.621 + ,47.030 + ,29.124 + ,52.448 + ,101.416 + ,230.018 + ,45.790 + ,28.904 + ,52.322 + ,99.138 + ,226.154 + ,38.252 + ,27.992 + ,47.040 + ,102.612 + ,215.896) + ,dim=c(5 + ,131) + ,dimnames=list(c('Allochtonen' + ,'PmAH' + ,'50+' + ,'Kort-geschoolden' + ,'Totaal_NWW') + ,1:131)) > y <- array(NA,dim=c(5,131),dimnames=list(c('Allochtonen','PmAH','50+','Kort-geschoolden','Totaal_NWW'),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 = '2' > #'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] "PmAH" > x[,par1] [1] 17.759 17.530 17.139 16.916 16.543 16.317 18.161 19.144 16.947 16.491 [11] 16.428 16.639 16.821 16.765 16.533 16.554 16.494 16.612 17.933 19.070 [21] 18.179 17.830 17.349 17.919 18.269 18.385 18.260 17.905 17.730 17.827 [31] 19.978 20.315 18.931 18.732 19.155 19.270 19.754 19.845 19.937 20.097 [41] 19.981 20.502 22.712 23.101 21.381 21.255 21.053 21.561 21.923 22.001 [51] 22.369 22.320 22.149 22.581 24.896 26.610 25.417 26.484 26.329 26.989 [61] 27.180 27.284 27.436 27.082 26.818 27.003 29.344 29.777 28.070 27.993 [71] 27.672 27.802 27.328 27.666 27.456 27.796 27.642 27.651 29.604 29.196 [81] 28.328 27.986 27.738 27.867 27.580 27.381 27.292 26.944 26.329 29.023 [91] 28.705 27.213 27.063 27.010 27.709 27.802 27.687 27.719 27.961 27.203 [101] 27.747 30.713 30.395 28.895 28.460 28.286 28.984 29.624 29.734 30.603 [111] 30.427 30.269 30.798 32.676 32.680 30.737 30.300 30.321 31.282 30.868 [121] 30.749 30.236 29.990 29.427 29.376 30.828 30.532 29.166 29.124 28.904 [131] 27.992 > 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]) 16.317 16.428 16.491 16.494 16.533 16.543 16.554 16.612 16.639 16.765 16.821 1 1 1 1 1 1 1 1 1 1 1 16.916 16.947 17.139 17.349 17.53 17.73 17.759 17.827 17.83 17.905 17.919 1 1 1 1 1 1 1 1 1 1 1 17.933 18.161 18.179 18.26 18.269 18.385 18.732 18.931 19.07 19.144 19.155 1 1 1 1 1 1 1 1 1 1 1 19.27 19.754 19.845 19.937 19.978 19.981 20.097 20.315 20.502 21.053 21.255 1 1 1 1 1 1 1 1 1 1 1 21.381 21.561 21.923 22.001 22.149 22.32 22.369 22.581 22.712 23.101 24.896 1 1 1 1 1 1 1 1 1 1 1 25.417 26.329 26.484 26.61 26.818 26.944 26.989 27.003 27.01 27.063 27.082 1 2 1 1 1 1 1 1 1 1 1 27.18 27.203 27.213 27.284 27.292 27.328 27.381 27.436 27.456 27.58 27.642 1 1 1 1 1 1 1 1 1 1 1 27.651 27.666 27.672 27.687 27.709 27.719 27.738 27.747 27.796 27.802 27.867 1 1 1 1 1 1 1 1 1 2 1 27.961 27.986 27.992 27.993 28.07 28.286 28.328 28.46 28.705 28.895 28.904 1 1 1 1 1 1 1 1 1 1 1 28.984 29.023 29.124 29.166 29.196 29.344 29.376 29.427 29.604 29.624 29.734 1 1 1 1 1 1 1 1 1 1 1 29.777 29.99 30.236 30.269 30.3 30.321 30.395 30.427 30.532 30.603 30.713 1 1 1 1 1 1 1 1 1 1 1 30.737 30.749 30.798 30.828 30.868 31.282 32.676 32.68 1 1 1 1 1 1 1 1 > colnames(x) [1] "Allochtonen" "PmAH" "X50." "Kort.geschoolden" [5] "Totaal_NWW" > colnames(x)[par1] [1] "PmAH" > x[,par1] [1] 17.759 17.530 17.139 16.916 16.543 16.317 18.161 19.144 16.947 16.491 [11] 16.428 16.639 16.821 16.765 16.533 16.554 16.494 16.612 17.933 19.070 [21] 18.179 17.830 17.349 17.919 18.269 18.385 18.260 17.905 17.730 17.827 [31] 19.978 20.315 18.931 18.732 19.155 19.270 19.754 19.845 19.937 20.097 [41] 19.981 20.502 22.712 23.101 21.381 21.255 21.053 21.561 21.923 22.001 [51] 22.369 22.320 22.149 22.581 24.896 26.610 25.417 26.484 26.329 26.989 [61] 27.180 27.284 27.436 27.082 26.818 27.003 29.344 29.777 28.070 27.993 [71] 27.672 27.802 27.328 27.666 27.456 27.796 27.642 27.651 29.604 29.196 [81] 28.328 27.986 27.738 27.867 27.580 27.381 27.292 26.944 26.329 29.023 [91] 28.705 27.213 27.063 27.010 27.709 27.802 27.687 27.719 27.961 27.203 [101] 27.747 30.713 30.395 28.895 28.460 28.286 28.984 29.624 29.734 30.603 [111] 30.427 30.269 30.798 32.676 32.680 30.737 30.300 30.321 31.282 30.868 [121] 30.749 30.236 29.990 29.427 29.376 30.828 30.532 29.166 29.124 28.904 [131] 27.992 > 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/1ude91292855864.tab") + } + } > m Conditional inference tree with 10 terminal nodes Response: PmAH Inputs: Allochtonen, X50., Kort.geschoolden, Totaal_NWW Number of observations: 131 1) X50. <= 23.168; criterion = 1, statistic = 123.066 2) Totaal_NWW <= 167.585; criterion = 1, statistic = 52.075 3) Totaal_NWW <= 149.377; criterion = 1, statistic = 30.986 4)* weights = 14 3) Totaal_NWW > 149.377 5) Totaal_NWW <= 158.742; criterion = 1, statistic = 14.832 6)* weights = 12 5) Totaal_NWW > 158.742 7)* weights = 8 2) Totaal_NWW > 167.585 8) Totaal_NWW <= 179.352; criterion = 1, statistic = 17.799 9)* weights = 9 8) Totaal_NWW > 179.352 10)* weights = 11 1) X50. > 23.168 11) X50. <= 47.381; criterion = 1, statistic = 42.426 12) X50. <= 39.078; criterion = 1, statistic = 20.223 13)* weights = 12 12) X50. > 39.078 14) Allochtonen <= 34.929; criterion = 0.995, statistic = 10.421 15)* weights = 16 14) Allochtonen > 34.929 16)* weights = 27 11) X50. > 47.381 17) Kort.geschoolden <= 107.247; criterion = 0.983, statistic = 8.162 18)* weights = 15 17) Kort.geschoolden > 107.247 19)* weights = 7 > postscript(file="/var/www/html/rcomp/tmp/2ude91292855864.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/www/html/rcomp/tmp/3ude91292855864.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 17.759 17.86517 -0.10616667 2 17.530 17.86517 -0.33516667 3 17.139 16.65707 0.48192857 4 16.916 16.65707 0.25892857 5 16.543 16.65707 -0.11407143 6 16.317 16.65707 -0.34007143 7 18.161 17.86517 0.29583333 8 19.144 18.86950 0.27450000 9 16.947 16.65707 0.28992857 10 16.491 16.65707 -0.16607143 11 16.428 16.65707 -0.22907143 12 16.639 16.65707 -0.01807143 13 16.821 16.65707 0.16392857 14 16.765 16.65707 0.10792857 15 16.533 16.65707 -0.12407143 16 16.554 16.65707 -0.10307143 17 16.494 16.65707 -0.16307143 18 16.612 16.65707 -0.04507143 19 17.933 17.86517 0.06783333 20 19.070 18.86950 0.20050000 21 18.179 17.86517 0.31383333 22 17.830 17.86517 -0.03516667 23 17.349 17.86517 -0.51616667 24 17.919 17.86517 0.05383333 25 18.269 18.86950 -0.60050000 26 18.385 18.86950 -0.48450000 27 18.260 17.86517 0.39483333 28 17.905 17.86517 0.03983333 29 17.730 17.86517 -0.13516667 30 17.827 17.86517 -0.03816667 31 19.978 20.16244 -0.18444444 32 20.315 20.16244 0.15255556 33 18.931 18.86950 0.06150000 34 18.732 18.86950 -0.13750000 35 19.155 18.86950 0.28550000 36 19.270 18.86950 0.40050000 37 19.754 20.16244 -0.40844444 38 19.845 20.16244 -0.31744444 39 19.937 20.16244 -0.22544444 40 20.097 20.16244 -0.06544444 41 19.981 20.16244 -0.18144444 42 20.502 20.16244 0.33955556 43 22.712 22.12300 0.58900000 44 23.101 22.12300 0.97800000 45 21.381 22.12300 -0.74200000 46 21.255 22.12300 -0.86800000 47 21.053 20.16244 0.89055556 48 21.561 22.12300 -0.56200000 49 21.923 22.12300 -0.20000000 50 22.001 22.12300 -0.12200000 51 22.369 22.12300 0.24600000 52 22.320 22.12300 0.19700000 53 22.149 22.12300 0.02600000 54 22.581 22.12300 0.45800000 55 24.896 26.62733 -1.73133333 56 26.610 26.62733 -0.01733333 57 25.417 26.62733 -1.21033333 58 26.484 26.62733 -0.14333333 59 26.329 26.62733 -0.29833333 60 26.989 26.62733 0.36166667 61 27.180 26.62733 0.55266667 62 27.284 26.62733 0.65666667 63 27.436 26.62733 0.80866667 64 27.082 26.62733 0.45466667 65 26.818 26.62733 0.19066667 66 27.003 26.62733 0.37566667 67 29.344 28.49493 0.84907407 68 29.777 28.49493 1.28207407 69 28.070 28.49493 -0.42492593 70 27.993 28.49493 -0.50192593 71 27.672 28.49493 -0.82292593 72 27.802 28.49493 -0.69292593 73 27.328 28.49493 -1.16692593 74 27.666 28.49493 -0.82892593 75 27.456 28.49493 -1.03892593 76 27.796 28.49493 -0.69892593 77 27.642 28.49493 -0.85292593 78 27.651 28.49493 -0.84392593 79 29.604 28.49493 1.10907407 80 29.196 28.49493 0.70107407 81 28.328 28.49493 -0.16692593 82 27.986 27.45437 0.53162500 83 27.738 27.45437 0.28362500 84 27.867 27.45437 0.41262500 85 27.580 28.49493 -0.91492593 86 27.381 28.49493 -1.11392593 87 27.292 27.45437 -0.16237500 88 26.944 27.45437 -0.51037500 89 26.329 27.45437 -1.12537500 90 29.023 28.49493 0.52807407 91 28.705 28.49493 0.21007407 92 27.213 27.45437 -0.24137500 93 27.063 27.45437 -0.39137500 94 27.010 27.45437 -0.44437500 95 27.709 27.45437 0.25462500 96 27.802 27.45437 0.34762500 97 27.687 27.45437 0.23262500 98 27.719 27.45437 0.26462500 99 27.961 27.45437 0.50662500 100 27.203 27.45437 -0.25137500 101 27.747 27.45437 0.29262500 102 30.713 28.49493 2.21807407 103 30.395 28.49493 1.90007407 104 28.895 28.49493 0.40007407 105 28.460 28.49493 -0.03492593 106 28.286 28.49493 -0.20892593 107 28.984 28.49493 0.48907407 108 29.624 28.49493 1.12907407 109 29.734 29.96080 -0.22680000 110 30.603 29.96080 0.64220000 111 30.427 29.96080 0.46620000 112 30.269 29.96080 0.30820000 113 30.798 29.96080 0.83720000 114 32.676 31.37357 1.30242857 115 32.680 31.37357 1.30642857 116 30.737 29.96080 0.77620000 117 30.300 29.96080 0.33920000 118 30.321 29.96080 0.36020000 119 31.282 31.37357 -0.09157143 120 30.868 31.37357 -0.50557143 121 30.749 31.37357 -0.62457143 122 30.236 29.96080 0.27520000 123 29.990 29.96080 0.02920000 124 29.427 29.96080 -0.53380000 125 29.376 29.96080 -0.58480000 126 30.828 31.37357 -0.54557143 127 30.532 31.37357 -0.84157143 128 29.166 29.96080 -0.79480000 129 29.124 29.96080 -0.83680000 130 28.904 29.96080 -1.05680000 131 27.992 28.49493 -0.50292593 > 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/4nmvu1292855864.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/www/html/rcomp/tmp/5jeb31292855864.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/6t5a61292855864.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/7fo9u1292855864.tab") + } > > try(system("convert tmp/2ude91292855864.ps tmp/2ude91292855864.png",intern=TRUE)) character(0) > try(system("convert tmp/3ude91292855864.ps tmp/3ude91292855864.png",intern=TRUE)) character(0) > try(system("convert tmp/4nmvu1292855864.ps tmp/4nmvu1292855864.png",intern=TRUE)) character(0) > > > proc.time() user system elapsed 3.114 0.659 12.772