Send output to:
Browser Blue - Charts White
Browser Black/White
CSV
Data X:
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
Names of X columns:
Tijd QBEFRU PBEFRU PSOCOLA PSOORA PSTIM
Endogenous Variable (Column Number)
Categorization
none
none
quantiles
hclust
equal
Number of categories (only if categorization<>none)
Cross-Validation? (only if categorization<>none)
no
no
yes
Chart options
R Code
library(party) library(Hmisc) par1 <- as.numeric(par1) par3 <- as.numeric(par3) x <- data.frame(t(y)) is.data.frame(x) x <- x[!is.na(x[,par1]),] k <- length(x[1,]) n <- length(x[,1]) colnames(x)[par1] x[,par1] 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]) colnames(x) colnames(x)[par1] x[,par1] if (par2 == 'none') { m <- ctree(as.formula(paste(colnames(x)[par1],' ~ .',sep='')),data = x) } load(file='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='mytable3.tab') } } m bitmap(file='test1.png') plot(m) dev.off() bitmap(file='test1a.png') plot(x[,par1] ~ as.factor(where(m)),main='Response by Terminal Node',xlab='Terminal Node',ylab='Response') dev.off() 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) } if (par2 != 'none') { print(cbind(as.factor(x[,par1]),predict(m))) myt <- table(as.factor(x[,par1]),predict(m)) print(myt) } bitmap(file='test2.png') 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() 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='mytable1.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='mytable.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='mytable2.tab') }
Compute
Summary of computational transaction
Raw Input
view raw input (R code)
Raw Output
view raw output of R engine
Computing time
1 seconds
R Server
Big Analytics Cloud Computing Center
Click here to blog (archive) this computation