R version 2.12.0 (2010-10-15) Copyright (C) 2010 The R Foundation for Statistical Computing ISBN 3-900051-07-0 Platform: i486-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(9/06/2002 + ,169498 + ,2.47 + ,0.97 + ,0.80 + ,5.06 + ,16/06/2002 + ,125451 + ,2.51 + ,0.95 + ,0.80 + ,5.07 + ,23/06/2002 + ,140449 + ,2.51 + ,0.96 + ,0.80 + ,5.04 + ,30/06/2002 + ,141653 + ,2.51 + ,0.97 + ,0.81 + ,5.08 + ,7/07/2002 + ,136394 + ,2.49 + ,0.96 + ,0.81 + ,5.15 + ,14/07/2002 + ,167588 + ,2.52 + ,0.96 + ,0.83 + ,5.16 + ,21/07/2002 + ,191807 + ,2.51 + ,0.94 + ,0.79 + ,5.09 + ,28/07/2002 + ,149736 + ,2.54 + ,0.95 + ,0.80 + ,5.14 + ,4/08/2002 + ,196066 + ,2.53 + ,0.95 + ,0.81 + ,5.17 + ,11/08/2002 + ,239155 + ,2.55 + ,0.95 + ,0.80 + ,5.13 + ,18/08/2002 + ,178421 + ,2.50 + ,0.95 + ,0.81 + ,5.19 + ,25/08/2002 + ,139871 + ,2.59 + ,0.97 + ,0.81 + ,5.17 + ,1/09/2002 + ,118159 + ,2.56 + ,0.97 + ,0.82 + ,5.17 + ,8/09/2002 + ,109763 + ,2.59 + ,0.95 + ,0.81 + ,5.21 + ,15/09/2002 + ,97415 + ,2.58 + ,0.96 + ,0.82 + ,5.21 + ,22/09/2002 + ,119190 + ,2.62 + ,0.96 + ,0.82 + ,5.23 + ,29/09/2002 + ,97903 + ,2.59 + ,0.94 + ,0.80 + ,5.17 + ,6/10/2002 + ,96953 + ,2.58 + ,0.96 + ,0.79 + ,5.16 + ,13/10/2002 + ,87888 + ,2.57 + ,0.98 + ,0.79 + ,5.15 + ,20/10/2002 + ,84637 + ,2.57 + ,0.97 + ,0.80 + ,5.12 + ,27/10/2002 + ,90549 + ,2.55 + ,0.96 + ,0.80 + ,5.12 + ,3/11/2002 + ,95680 + ,2.51 + ,0.95 + ,0.80 + ,5.10 + ,10/11/2002 + ,99371 + ,2.50 + ,0.96 + ,0.80 + ,5.13 + ,17/11/2002 + ,79984 + ,2.59 + ,0.96 + ,0.80 + ,5.14 + ,24/11/2002 + ,86752 + ,2.63 + ,0.97 + ,0.80 + ,5.16 + ,1/12/2002 + ,85733 + ,2.63 + ,0.96 + ,0.80 + ,5.17 + ,8/12/2002 + ,84906 + ,2.61 + ,0.95 + ,0.78 + ,5.15 + ,15/12/2002 + ,78356 + ,2.64 + ,0.95 + ,0.78 + ,5.12 + ,22/12/2002 + ,108895 + ,2.67 + ,0.94 + ,0.76 + ,5.08 + ,29/12/2002 + ,101768 + ,2.63 + ,0.94 + ,0.77 + ,5.07 + ,5/01/2003 + ,73285 + ,2.58 + ,0.98 + ,0.82 + ,5.16 + ,12/01/2003 + ,65724 + ,2.56 + ,0.93 + ,0.81 + ,5.14 + ,19/01/2003 + ,67457 + ,2.57 + ,0.93 + ,0.81 + ,5.13 + ,26/01/2003 + ,67203 + ,2.55 + ,0.96 + ,0.80 + ,5.11 + ,2/02/2003 + ,69273 + ,2.58 + ,0.97 + ,0.79 + ,5.12 + ,9/02/2003 + ,80807 + ,2.50 + ,0.97 + ,0.81 + ,5.09 + ,16/02/2003 + ,75129 + ,2.56 + ,0.95 + ,0.81 + ,5.10 + ,23/02/2003 + ,74991 + ,2.62 + ,0.95 + ,0.81 + ,4.95 + ,2/03/2003 + ,68157 + ,2.71 + ,0.96 + ,0.81 + ,5.11 + ,9/03/2003 + ,73858 + ,2.74 + ,0.98 + ,0.82 + ,5.11 + ,16/03/2003 + ,71349 + ,2.76 + ,0.98 + ,0.81 + ,5.10 + ,23/03/2003 + ,85634 + ,2.66 + ,0.97 + ,0.80 + ,5.11 + ,30/03/2003 + ,91624 + ,2.61 + ,0.98 + ,0.83 + ,5.12 + ,6/04/2003 + ,116014 + ,2.68 + ,0.98 + ,0.81 + ,5.09 + ,13/04/2003 + ,120033 + ,2.70 + ,0.99 + ,0.83 + ,5.10 + ,20/04/2003 + ,108651 + ,2.70 + ,0.99 + ,0.84 + ,5.06 + ,27/04/2003 + ,105378 + ,2.72 + ,0.97 + ,0.84 + ,5.03 + ,4/05/2003 + ,138939 + ,2.77 + ,0.98 + ,0.85 + ,5.05 + ,11/05/2003 + ,132974 + ,2.76 + ,0.97 + ,0.85 + ,5.04 + ,18/05/2003 + ,135277 + ,2.72 + ,0.97 + ,0.86 + ,5.02 + ,25/05/2003 + ,152741 + ,2.69 + ,0.97 + ,0.85 + ,4.97 + ,1/06/2003 + ,158417 + ,2.70 + ,0.98 + ,0.87 + ,4.91 + ,8/06/2003 + ,157460 + ,2.69 + ,0.97 + ,0.86 + ,4.91 + ,15/06/2003 + ,193997 + ,2.66 + ,0.97 + ,0.87 + ,4.98 + ,22/06/2003 + ,154089 + ,2.74 + ,0.98 + ,0.87 + ,4.98 + ,29/06/2003 + ,147570 + ,2.76 + ,0.98 + ,0.86 + ,4.97 + ,6/07/2003 + ,162924 + ,2.79 + ,0.95 + ,0.87 + ,4.97 + ,13/07/2003 + ,153629 + ,2.78 + ,0.97 + ,0.88 + ,4.90 + ,20/07/2003 + ,155907 + ,2.80 + ,0.97 + ,0.87 + ,4.91 + ,27/07/2003 + ,197675 + ,2.78 + ,0.97 + ,0.87 + ,4.88 + ,3/08/2003 + ,250708 + ,2.76 + ,0.97 + ,0.86 + ,4.86 + ,10/08/2003 + ,266652 + ,2.73 + ,0.98 + ,0.86 + ,4.87 + ,17/08/2003 + ,209842 + ,2.72 + ,0.98 + ,0.88 + ,4.86 + ,24/08/2003 + ,165826 + ,2.73 + ,0.98 + ,0.88 + ,4.89 + ,31/08/2003 + ,137152 + ,2.74 + ,0.96 + ,0.87 + ,4.90 + ,7/09/2003 + ,150581 + ,2.72 + ,0.98 + ,0.88 + ,4.88 + ,14/09/2003 + ,145973 + ,2.71 + ,1.00 + ,0.89 + ,4.85 + ,21/09/2003 + ,126532 + ,2.66 + ,1.01 + ,0.89 + ,4.85 + ,28/09/2003 + ,115437 + ,2.68 + ,1.02 + ,0.88 + ,4.84 + ,5/10/2003 + ,119526 + ,2.67 + ,1.01 + ,0.88 + ,4.91 + ,12/10/2003 + ,110856 + ,2.68 + ,1.01 + ,0.88 + ,4.94 + ,19/10/2003 + ,97243 + ,2.67 + ,1.02 + ,0.88 + ,4.92 + ,26/10/2003 + ,103876 + ,2.71 + ,1.01 + ,0.87 + ,4.93 + ,2/11/2003 + ,116370 + ,2.69 + ,1.01 + ,0.87 + ,4.97 + ,9/11/2003 + ,109616 + ,2.64 + ,1.01 + ,0.86 + ,4.89 + ,16/11/2003 + ,98365 + ,2.66 + ,1.02 + ,0.88 + ,4.88 + ,23/11/2003 + ,90440 + ,2.70 + ,1.02 + ,0.87 + ,4.93 + ,30/11/2003 + ,88899 + ,2.69 + ,1.02 + ,0.86 + ,4.94 + ,7/12/2003 + ,92358 + ,2.71 + ,1.01 + ,0.85 + ,4.99 + ,14/12/2003 + ,88394 + ,2.74 + ,1.01 + ,0.86 + ,5.00 + ,21/12/2003 + ,98219 + ,2.78 + ,0.99 + ,0.84 + ,5.02 + ,28/12/2003 + ,113546 + ,2.79 + ,1.00 + ,0.85 + ,5.06 + ,4/01/2004 + ,107168 + ,2.75 + ,1.01 + ,0.88 + ,5.01 + ,11/01/2004 + ,77540 + ,2.69 + ,0.99 + ,0.88 + ,5.02 + ,18/01/2004 + ,74944 + ,2.69 + ,1.00 + ,0.89 + ,4.97 + ,25/01/2004 + ,75641 + ,2.69 + ,1.02 + ,0.88 + ,4.96 + ,1/02/2004 + ,75910 + ,2.72 + ,1.01 + ,0.88 + ,4.95 + ,8/02/2004 + ,87384 + ,2.69 + ,1.01 + ,0.88 + ,4.92 + ,15/02/2004 + ,84615 + ,2.70 + ,1.01 + ,0.89 + ,4.88 + ,22/02/2004 + ,80420 + ,2.68 + ,1.03 + ,0.89 + ,4.86 + ,29/02/2004 + ,80784 + ,2.70 + ,1.02 + ,0.89 + ,4.94 + ,7/03/2004 + ,79933 + ,2.72 + ,1.02 + ,0.88 + ,4.83 + ,14/03/2004 + ,82118 + ,2.70 + ,1.03 + ,0.89 + ,4.95 + ,21/03/2004 + ,91420 + ,2.66 + ,1.03 + ,0.89 + ,4.95 + ,28/03/2004 + ,112426 + ,2.68 + ,1.02 + ,0.89 + ,4.94 + ,4/04/2004 + ,114528 + ,2.65 + ,1.02 + ,0.89 + ,4.93 + ,11/04/2004 + ,131025 + ,2.69 + ,1.02 + ,0.90 + ,4.97 + ,18/04/2004 + ,116460 + ,2.66 + ,1.02 + ,0.88 + ,4.95 + ,25/04/2004 + ,111258 + ,2.69 + ,1.03 + ,0.90 + ,4.92 + ,2/05/2004 + ,155318 + ,2.69 + ,1.02 + ,0.88 + ,4.82 + ,9/05/2004 + ,155078 + ,2.65 + ,1.02 + ,0.90 + ,4.82 + ,16/05/2004 + ,134794 + ,2.66 + ,1.02 + ,0.89 + ,4.84 + ,23/05/2004 + ,139985 + ,2.63 + ,1.03 + ,0.89 + ,4.83 + ,30/05/2004 + ,198778 + ,2.65 + ,1.02 + ,0.88 + ,4.79 + ,6/06/2004 + ,172436 + ,2.60 + ,1.02 + ,0.89 + ,4.81 + ,13/06/2004 + ,169585 + ,2.57 + ,1.02 + ,0.91 + ,4.85 + ,20/06/2004 + ,203702 + ,2.65 + ,1.02 + ,0.91 + ,4.84 + ,27/06/2004 + ,282392 + ,2.69 + ,1.02 + ,0.90 + ,4.82 + ,4/07/2004 + ,220658 + ,2.71 + ,1.00 + ,0.93 + ,4.92 + ,11/07/2004 + ,194472 + ,2.72 + ,1.04 + ,0.94 + ,4.92 + ,18/07/2004 + ,269246 + ,2.73 + ,1.04 + ,0.95 + ,4.90 + ,25/07/2004 + ,215340 + ,2.72 + ,1.03 + ,0.95 + ,4.91 + ,1/08/2004 + ,218319 + ,2.73 + ,1.02 + ,0.93 + ,4.85 + ,8/08/2004 + ,195724 + ,2.72 + ,1.04 + ,0.95 + ,4.86 + ,15/08/2004 + ,174614 + ,2.70 + ,1.05 + ,0.95 + ,4.88 + ,22/08/2004 + ,172085 + ,2.72 + ,1.03 + ,0.94 + ,4.85 + ,29/08/2004 + ,152347 + ,2.70 + ,0.99 + ,0.92 + ,4.91 + ,5/09/2004 + ,189615 + ,2.72 + ,1.03 + ,0.94 + ,4.89 + ,12/09/2004 + ,173804 + ,2.70 + ,1.08 + ,0.95 + ,4.92 + ,19/09/2004 + ,145683 + ,2.65 + ,1.09 + ,0.97 + ,4.82 + ,26/09/2004 + ,133550 + ,2.66 + ,1.08 + ,0.96 + ,4.82 + ,3/10/2004 + ,121156 + ,2.69 + ,1.05 + ,0.92 + ,4.87 + ,10/10/2004 + ,112040 + ,2.70 + ,1.06 + ,0.94 + ,4.88 + ,17/10/2004 + ,120767 + ,2.71 + ,1.04 + ,0.94 + ,4.90 + ,24/10/2004 + ,127019 + ,2.69 + ,1.06 + ,0.92 + ,4.88 + ,31/10/2004 + ,136295 + ,2.72 + ,1.06 + ,0.91 + ,4.89 + ,7/11/2004 + ,113425 + ,2.71 + ,1.07 + ,0.93 + ,4.88 + ,14/11/2004 + ,107815 + ,2.71 + ,1.08 + ,0.93 + ,4.87 + ,21/11/2004 + ,100298 + ,2.74 + ,1.08 + ,0.94 + ,4.85 + ,28/11/2004 + ,97048 + ,2.82 + ,1.05 + ,0.92 + ,4.87 + ,5/12/2004 + ,98750 + ,2.76 + ,1.04 + ,0.91 + ,4.88 + ,12/12/2004 + ,98235 + ,2.77 + ,1.04 + ,0.91 + ,4.87 + ,19/12/2004 + ,101254 + ,2.77 + ,1.04 + ,0.90 + ,4.93 + ,26/12/2004 + ,139589 + ,2.81 + ,1.04 + ,0.89 + ,4.93 + ,2/01/2005 + ,134921 + ,2.77 + ,1.06 + ,0.91 + ,4.74 + ,9/01/2005 + ,80355 + ,2.76 + ,1.08 + ,0.93 + ,4.77 + ,16/01/2005 + ,80396 + ,2.73 + ,1.08 + ,0.94 + ,4.81 + ,23/01/2005 + ,82183 + ,2.72 + ,1.08 + ,0.93 + ,4.82 + ,30/01/2005 + ,79709 + ,2.73 + ,1.07 + ,0.91 + ,4.79 + ,6/02/2005 + ,90781 + ,2.71 + ,1.06 + ,0.92 + ,4.75) + ,dim=c(6 + ,140) + ,dimnames=list(c('Tijd' + ,'QBEFRU' + ,'PBEFRU' + ,'PSOCOLA' + ,'PSOORA' + ,'PSTIM') + ,1:140)) > y <- array(NA,dim=c(6,140),dimnames=list(c('Tijd','QBEFRU','PBEFRU','PSOCOLA','PSOORA','PSTIM'),1:140)) > 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 = '1' > 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 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] "Tijd" > x[,par1] [1] 7.492507e-04 1.332001e-03 1.914752e-03 2.497502e-03 4.995005e-04 [6] 9.990010e-04 1.498501e-03 1.998002e-03 2.497502e-04 6.868132e-04 [11] 1.123876e-03 1.560939e-03 5.550006e-05 4.440004e-04 8.325008e-04 [16] 1.221001e-03 1.609502e-03 2.997003e-04 6.493506e-04 9.990010e-04 [21] 1.348651e-03 1.362274e-04 4.540914e-04 7.719553e-04 1.089819e-03 [26] 4.162504e-05 3.330003e-04 6.243756e-04 9.157509e-04 1.207126e-03 [31] 2.496256e-03 5.991013e-03 9.485771e-03 1.298053e-02 4.992511e-04 [36] 2.246630e-03 3.994009e-03 5.741388e-03 3.328341e-04 1.497753e-03 [41] 2.662673e-03 3.827592e-03 4.992511e-03 7.488767e-04 1.622566e-03 [46] 2.496256e-03 3.369945e-03 3.994009e-04 1.098352e-03 1.797304e-03 [51] 2.496256e-03 8.320852e-05 6.656682e-04 1.248128e-03 1.830587e-03 [56] 2.413047e-03 4.279295e-04 9.271807e-04 1.426432e-03 1.925683e-03 [61] 1.872192e-04 6.240639e-04 1.060909e-03 1.497753e-03 1.934598e-03 [66] 3.883064e-04 7.766129e-04 1.164919e-03 1.553226e-03 2.496256e-04 [71] 5.991013e-04 9.485771e-04 1.298053e-03 9.077293e-05 4.084782e-04 [76] 7.261835e-04 1.043889e-03 1.361594e-03 2.912298e-04 5.824596e-04 [81] 8.736895e-04 1.164919e-03 1.996008e-03 5.489022e-03 8.982036e-03 [86] 1.247505e-02 2.495010e-04 1.996008e-03 3.742515e-03 5.489022e-03 [91] 7.235529e-03 1.164338e-03 2.328676e-03 3.493014e-03 4.657352e-03 [96] 4.990020e-04 1.372255e-03 2.245509e-03 3.118762e-03 1.996008e-04 [101] 8.982036e-04 1.596806e-03 2.295409e-03 2.994012e-03 4.990020e-04 [106] 1.081171e-03 1.663340e-03 2.245509e-03 2.851440e-04 7.841460e-04 [111] 1.283148e-03 1.782150e-03 6.237525e-05 4.990020e-04 9.356287e-04 [116] 1.372255e-03 1.808882e-03 2.772233e-04 6.653360e-04 1.053449e-03 [121] 1.441561e-03 1.497006e-04 4.990020e-04 8.483034e-04 1.197605e-03 [126] 1.546906e-03 3.175467e-04 6.350934e-04 9.526402e-04 1.270187e-03 [131] 2.079175e-04 4.990020e-04 7.900865e-04 1.081171e-03 9.975062e-04 [136] 4.488778e-03 7.980050e-03 1.147132e-02 1.496259e-02 1.496259e-03 > 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]) 4.16250416250416e-05 5.55000555000555e-05 6.2375249500998e-05 1 1 1 8.32085205525046e-05 9.07729315118232e-05 0.000136227408954682 1 1 1 0.000149700598802395 0.000187219171243135 0.000199600798403194 1 1 1 0.00020791749833666 0.000249500998003992 0.000249625561657514 1 1 1 0.00024975024975025 0.000277223331115547 0.000285143997718848 1 1 1 0.000291229821933766 0.0002997002997003 0.000317546724732353 1 1 1 0.000332834082210018 0.000333000333000333 0.000388306429245021 1 1 1 0.000399400898652022 0.000408478191803204 0.000427929534270024 1 1 1 0.000444000444000444 0.000454091363182272 0.000499001996007984 1 1 5 0.000499251123315027 0.0004995004995005 0.000582459643867532 1 1 1 0.000599101347978033 0.000624063904143784 0.000624375624375624 1 1 1 0.000635093449464707 0.000649350649350649 0.000665335994677312 1 1 1 0.000665668164420037 0.000686813186813187 0.000726183452094585 1 1 1 0.000748876684972541 0.000749250749250749 0.000771955317409863 1 1 1 0.000776612858490043 0.000784145993726832 0.000790086493679308 1 1 1 0.000832500832500833 0.000848303393213573 0.000873689465801298 1 1 1 0.000898203592814371 0.000915750915750916 0.000927180657585051 1 1 1 0.00093562874251497 0.000948577134298552 0.00095264017419706 1 1 1 0.000997506234413965 0.000999000999001 0.00104388871238597 1 2 1 0.00105344865823908 0.00106090863704443 0.00108117099135063 1 1 2 0.00108981927163745 0.00109835247129306 0.00112387612387612 1 1 1 0.0011643379906853 0.00116491928773506 0.00119760479041916 1 2 1 0.00120712620712621 0.00122100122100122 0.00124812780828757 1 1 1 0.00127018689892941 0.00128314798973482 0.00129805292061907 1 1 1 0.00133200133200133 0.00134865134865135 0.00136159397267735 1 1 1 0.00137225548902196 0.00142643178090008 0.00144156132180084 2 1 1 0.00149625935162095 0.00149775336994508 0.0014985014985015 1 2 1 0.00154690618762475 0.00155322571698009 0.00156093906093906 1 1 1 0.00159680638722555 0.00160950160950161 0.00162256615077384 1 1 1 0.00166333998669328 0.0017821499857428 0.0017973040439341 1 1 1 0.00180888223552894 0.0018305874521551 0.00191475191475191 1 1 1 0.00192568290421511 0.00193459810284573 0.00199600798403194 1 1 2 0.001998001998002 0.00224550898203593 0.00224663005491762 1 2 1 0.00229540918163673 0.00232867598137059 0.00241304709602263 1 1 1 0.00249625561657514 0.0024975024975025 0.00266267265768015 3 1 1 0.0029940119760479 0.0031187624750499 0.00336994508237644 1 1 1 0.00349301397205589 0.00374251497005988 0.00382759194541521 1 1 1 0.00399400898652022 0.00448877805486284 0.00465735196274118 1 1 1 0.00499251123315027 0.00548902195608782 0.00574138791812282 1 2 1 0.00599101347978033 0.00723552894211577 0.00798004987531172 1 1 1 0.00898203592814371 0.00948577134298552 0.0114713216957606 1 1 1 0.0124750499001996 0.0129805292061907 0.0149625935162095 1 1 1 > colnames(x) [1] "Tijd" "QBEFRU" "PBEFRU" "PSOCOLA" "PSOORA" "PSTIM" > colnames(x)[par1] [1] "Tijd" > x[,par1] [1] 7.492507e-04 1.332001e-03 1.914752e-03 2.497502e-03 4.995005e-04 [6] 9.990010e-04 1.498501e-03 1.998002e-03 2.497502e-04 6.868132e-04 [11] 1.123876e-03 1.560939e-03 5.550006e-05 4.440004e-04 8.325008e-04 [16] 1.221001e-03 1.609502e-03 2.997003e-04 6.493506e-04 9.990010e-04 [21] 1.348651e-03 1.362274e-04 4.540914e-04 7.719553e-04 1.089819e-03 [26] 4.162504e-05 3.330003e-04 6.243756e-04 9.157509e-04 1.207126e-03 [31] 2.496256e-03 5.991013e-03 9.485771e-03 1.298053e-02 4.992511e-04 [36] 2.246630e-03 3.994009e-03 5.741388e-03 3.328341e-04 1.497753e-03 [41] 2.662673e-03 3.827592e-03 4.992511e-03 7.488767e-04 1.622566e-03 [46] 2.496256e-03 3.369945e-03 3.994009e-04 1.098352e-03 1.797304e-03 [51] 2.496256e-03 8.320852e-05 6.656682e-04 1.248128e-03 1.830587e-03 [56] 2.413047e-03 4.279295e-04 9.271807e-04 1.426432e-03 1.925683e-03 [61] 1.872192e-04 6.240639e-04 1.060909e-03 1.497753e-03 1.934598e-03 [66] 3.883064e-04 7.766129e-04 1.164919e-03 1.553226e-03 2.496256e-04 [71] 5.991013e-04 9.485771e-04 1.298053e-03 9.077293e-05 4.084782e-04 [76] 7.261835e-04 1.043889e-03 1.361594e-03 2.912298e-04 5.824596e-04 [81] 8.736895e-04 1.164919e-03 1.996008e-03 5.489022e-03 8.982036e-03 [86] 1.247505e-02 2.495010e-04 1.996008e-03 3.742515e-03 5.489022e-03 [91] 7.235529e-03 1.164338e-03 2.328676e-03 3.493014e-03 4.657352e-03 [96] 4.990020e-04 1.372255e-03 2.245509e-03 3.118762e-03 1.996008e-04 [101] 8.982036e-04 1.596806e-03 2.295409e-03 2.994012e-03 4.990020e-04 [106] 1.081171e-03 1.663340e-03 2.245509e-03 2.851440e-04 7.841460e-04 [111] 1.283148e-03 1.782150e-03 6.237525e-05 4.990020e-04 9.356287e-04 [116] 1.372255e-03 1.808882e-03 2.772233e-04 6.653360e-04 1.053449e-03 [121] 1.441561e-03 1.497006e-04 4.990020e-04 8.483034e-04 1.197605e-03 [126] 1.546906e-03 3.175467e-04 6.350934e-04 9.526402e-04 1.270187e-03 [131] 2.079175e-04 4.990020e-04 7.900865e-04 1.081171e-03 9.975062e-04 [136] 4.488778e-03 7.980050e-03 1.147132e-02 1.496259e-02 1.496259e-03 > if (par2 == 'none') { + m <- ctree(as.formula(paste(colnames(x)[par1],' ~ .',sep='')),data = x) + } > > #Note: the /var/www/rcomp/createtable file can be downloaded at http://www.wessa.net/cretab > load(file="/var/www/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/rcomp/tmp/1oszg1324665506.tab") + } + } > m Conditional inference tree with 2 terminal nodes Response: Tijd Inputs: QBEFRU, PBEFRU, PSOCOLA, PSOORA, PSTIM Number of observations: 140 1) QBEFRU <= 84615; criterion = 1, statistic = 16.062 2)* weights = 26 1) QBEFRU > 84615 3)* weights = 114 > postscript(file="/var/www/rcomp/tmp/2hvaf1324665506.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/rcomp/tmp/30n5f1324665506.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 7.492507e-04 0.001201404 -4.521531e-04 2 1.332001e-03 0.001201404 1.305975e-04 3 1.914752e-03 0.001201404 7.133481e-04 4 2.497502e-03 0.001201404 1.296099e-03 5 4.995005e-04 0.001201404 -7.019033e-04 6 9.990010e-04 0.001201404 -2.024028e-04 7 1.498501e-03 0.001201404 2.970977e-04 8 1.998002e-03 0.001201404 7.965982e-04 9 2.497502e-04 0.001201404 -9.516536e-04 10 6.868132e-04 0.001201404 -5.145906e-04 11 1.123876e-03 0.001201404 -7.752768e-05 12 1.560939e-03 0.001201404 3.595353e-04 13 5.550006e-05 0.001201404 -1.145904e-03 14 4.440004e-04 0.001201404 -7.574034e-04 15 8.325008e-04 0.001201404 -3.689030e-04 16 1.221001e-03 0.001201404 1.959741e-05 17 1.609502e-03 0.001201404 4.080978e-04 18 2.997003e-04 0.001201404 -9.017035e-04 19 6.493506e-04 0.001201404 -5.520532e-04 20 9.990010e-04 0.001201404 -2.024028e-04 21 1.348651e-03 0.001201404 1.472475e-04 22 1.362274e-04 0.001201404 -1.065176e-03 23 4.540914e-04 0.001201404 -7.473124e-04 24 7.719553e-04 0.005207033 -4.435078e-03 25 1.089819e-03 0.001201404 -1.115845e-04 26 4.162504e-05 0.001201404 -1.159779e-03 27 3.330003e-04 0.001201404 -8.684035e-04 28 6.243756e-04 0.005207033 -4.582658e-03 29 9.157509e-04 0.001201404 -2.856529e-04 30 1.207126e-03 0.001201404 5.722398e-06 31 2.496256e-03 0.005207033 -2.710778e-03 32 5.991013e-03 0.005207033 7.839800e-04 33 9.485771e-03 0.005207033 4.278738e-03 34 1.298053e-02 0.005207033 7.773496e-03 35 4.992511e-04 0.005207033 -4.707782e-03 36 2.246630e-03 0.005207033 -2.960403e-03 37 3.994009e-03 0.005207033 -1.213024e-03 38 5.741388e-03 0.005207033 5.343544e-04 39 3.328341e-04 0.005207033 -4.874199e-03 40 1.497753e-03 0.005207033 -3.709280e-03 41 2.662673e-03 0.005207033 -2.544361e-03 42 3.827592e-03 0.001201404 2.626188e-03 43 4.992511e-03 0.001201404 3.791107e-03 44 7.488767e-04 0.001201404 -4.525271e-04 45 1.622566e-03 0.001201404 4.211623e-04 46 2.496256e-03 0.001201404 1.294852e-03 47 3.369945e-03 0.001201404 2.168541e-03 48 3.994009e-04 0.001201404 -8.020029e-04 49 1.098352e-03 0.001201404 -1.030513e-04 50 1.797304e-03 0.001201404 5.959002e-04 51 2.496256e-03 0.001201404 1.294852e-03 52 8.320852e-05 0.001201404 -1.118195e-03 53 6.656682e-04 0.001201404 -5.357356e-04 54 1.248128e-03 0.001201404 4.672400e-05 55 1.830587e-03 0.001201404 6.291836e-04 56 2.413047e-03 0.001201404 1.211643e-03 57 4.279295e-04 0.001201404 -7.734743e-04 58 9.271807e-04 0.001201404 -2.742232e-04 59 1.426432e-03 0.001201404 2.250280e-04 60 1.925683e-03 0.001201404 7.242791e-04 61 1.872192e-04 0.001201404 -1.014185e-03 62 6.240639e-04 0.001201404 -5.773399e-04 63 1.060909e-03 0.001201404 -1.404952e-04 64 1.497753e-03 0.001201404 2.963496e-04 65 1.934598e-03 0.001201404 7.331943e-04 66 3.883064e-04 0.001201404 -8.130974e-04 67 7.766129e-04 0.001201404 -4.247910e-04 68 1.164919e-03 0.001201404 -3.648452e-05 69 1.553226e-03 0.001201404 3.518219e-04 70 2.496256e-04 0.001201404 -9.517782e-04 71 5.991013e-04 0.001201404 -6.023025e-04 72 9.485771e-04 0.001201404 -2.528267e-04 73 1.298053e-03 0.001201404 9.664911e-05 74 9.077293e-05 0.001201404 -1.110631e-03 75 4.084782e-04 0.001201404 -7.929256e-04 76 7.261835e-04 0.001201404 -4.752204e-04 77 1.043889e-03 0.001201404 -1.575151e-04 78 1.361594e-03 0.001201404 1.601902e-04 79 2.912298e-04 0.001201404 -9.101740e-04 80 5.824596e-04 0.001201404 -6.189442e-04 81 8.736895e-04 0.001201404 -3.277143e-04 82 1.164919e-03 0.001201404 -3.648452e-05 83 1.996008e-03 0.001201404 7.946042e-04 84 5.489022e-03 0.005207033 2.819885e-04 85 8.982036e-03 0.005207033 3.775002e-03 86 1.247505e-02 0.005207033 7.268016e-03 87 2.495010e-04 0.005207033 -4.957532e-03 88 1.996008e-03 0.001201404 7.946042e-04 89 3.742515e-03 0.005207033 -1.464519e-03 90 5.489022e-03 0.005207033 2.819885e-04 91 7.235529e-03 0.005207033 2.028495e-03 92 1.164338e-03 0.005207033 -4.042695e-03 93 2.328676e-03 0.005207033 -2.878358e-03 94 3.493014e-03 0.001201404 2.291610e-03 95 4.657352e-03 0.001201404 3.455948e-03 96 4.990020e-04 0.001201404 -7.024018e-04 97 1.372255e-03 0.001201404 1.708517e-04 98 2.245509e-03 0.001201404 1.044105e-03 99 3.118762e-03 0.001201404 1.917359e-03 100 1.996008e-04 0.001201404 -1.001803e-03 101 8.982036e-04 0.001201404 -3.032002e-04 102 1.596806e-03 0.001201404 3.954026e-04 103 2.295409e-03 0.001201404 1.094005e-03 104 2.994012e-03 0.001201404 1.792608e-03 105 4.990020e-04 0.001201404 -7.024018e-04 106 1.081171e-03 0.001201404 -1.202328e-04 107 1.663340e-03 0.001201404 4.619362e-04 108 2.245509e-03 0.001201404 1.044105e-03 109 2.851440e-04 0.001201404 -9.162598e-04 110 7.841460e-04 0.001201404 -4.172578e-04 111 1.283148e-03 0.001201404 8.174418e-05 112 1.782150e-03 0.001201404 5.807462e-04 113 6.237525e-05 0.001201404 -1.139029e-03 114 4.990020e-04 0.001201404 -7.024018e-04 115 9.356287e-04 0.001201404 -2.657751e-04 116 1.372255e-03 0.001201404 1.708517e-04 117 1.808882e-03 0.001201404 6.074784e-04 118 2.772233e-04 0.001201404 -9.241805e-04 119 6.653360e-04 0.001201404 -5.360678e-04 120 1.053449e-03 0.001201404 -1.479552e-04 121 1.441561e-03 0.001201404 2.401575e-04 122 1.497006e-04 0.001201404 -1.051703e-03 123 4.990020e-04 0.001201404 -7.024018e-04 124 8.483034e-04 0.001201404 -3.531004e-04 125 1.197605e-03 0.001201404 -3.799018e-06 126 1.546906e-03 0.001201404 3.455024e-04 127 3.175467e-04 0.001201404 -8.838571e-04 128 6.350934e-04 0.001201404 -5.663104e-04 129 9.526402e-04 0.001201404 -2.487636e-04 130 1.270187e-03 0.001201404 6.878309e-05 131 2.079175e-04 0.001201404 -9.934863e-04 132 4.990020e-04 0.001201404 -7.024018e-04 133 7.900865e-04 0.001201404 -4.113173e-04 134 1.081171e-03 0.001201404 -1.202328e-04 135 9.975062e-04 0.001201404 -2.038976e-04 136 4.488778e-03 0.005207033 -7.182554e-04 137 7.980050e-03 0.005207033 2.773016e-03 138 1.147132e-02 0.005207033 6.264288e-03 139 1.496259e-02 0.005207033 9.755560e-03 140 1.496259e-03 0.001201404 2.948555e-04 > 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/rcomp/tmp/4nq5c1324665506.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/rcomp/tmp/5mop71324665506.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/rcomp/tmp/6wr9p1324665506.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/rcomp/tmp/7qmme1324665506.tab") + } > > try(system("convert tmp/2hvaf1324665506.ps tmp/2hvaf1324665506.png",intern=TRUE)) character(0) > try(system("convert tmp/30n5f1324665506.ps tmp/30n5f1324665506.png",intern=TRUE)) character(0) > try(system("convert tmp/4nq5c1324665506.ps tmp/4nq5c1324665506.png",intern=TRUE)) character(0) > > > proc.time() user system elapsed 2.940 0.110 3.034