Send output to:
Browser Blue - Charts White
Browser Black/White
CSV
Data X:
112285 24188 146283 144 84786 18273 98364 103 83123 14130 86146 98 101193 32287 96933 135 38361 8654 79234 61 68504 9245 42551 39 119182 33251 195663 150 22807 1271 6853 5 17140 5279 21529 28 116174 27101 95757 84 57635 16373 85584 80 66198 19716 143983 130 71701 17753 75851 82 57793 9028 59238 60 80444 18653 93163 131 53855 8828 96037 84 97668 29498 151511 140 133824 27563 136368 151 101481 18293 112642 91 99645 22530 94728 138 114789 15977 105499 150 99052 35082 121527 124 67654 16116 127766 119 65553 15849 98958 73 97500 16026 77900 110 69112 26569 85646 123 82753 24785 98579 90 85323 17569 130767 116 72654 23825 131741 113 30727 7869 53907 56 77873 14975 178812 115 117478 37791 146761 119 74007 9605 82036 129 90183 27295 163253 127 61542 2746 27032 27 101494 34461 171975 175 27570 8098 65990 35 55813 4787 86572 64 79215 24919 159676 96 1423 603 1929 0 55461 16329 85371 84 31081 12558 58391 41 22996 7784 31580 47 83122 28522 136815 126 70106 22265 120642 105 60578 14459 69107 80 39992 14526 50495 70 79892 22240 108016 73 49810 11802 46341 57 71570 7623 78348 40 100708 11912 79336 68 33032 7935 56968 21 82875 18220 93176 127 139077 19199 161632 154 71595 19918 87850 116 72260 21884 127969 102 5950 2694 15049 7 115762 15808 155135 148 32551 3597 25109 21 31701 5296 45824 35 80670 25239 102996 112 143558 29801 160604 137 117105 18450 158051 135 23789 7132 44547 26 120733 34861 162647 230 105195 35940 174141 181 73107 16688 60622 71 132068 24683 179566 147 149193 46230 184301 190 46821 10387 75661 64 87011 21436 96144 105 95260 30546 129847 107 55183 19746 117286 94 106671 15977 71180 116 73511 22583 109377 106 92945 17274 85298 143 78664 16469 73631 81 70054 14251 86767 89 22618 3007 23824 26 74011 16851 93487 84 83737 21113 82981 113 69094 17401 73815 120 93133 23958 94552 110 95536 23567 132190 134 225920 13065 128754 54 62133 15358 66363 96 61370 14587 67808 78 43836 12770 61724 51 106117 24021 131722 121 38692 9648 68580 38 84651 20537 106175 145 56622 7905 55792 59 15986 4527 25157 27 95364 30495 76669 91 26706 7117 57283 48 89691 17719 105805 68 67267 27056 129484 58 126846 33473 72413 150 41140 9758 87831 74 102860 21115 96971 181 51715 7236 71299 65 55801 13790 77494 97 111813 32902 120336 121 120293 25131 93913 99 138599 30910 136048 152 161647 35947 181248 188 115929 29848 146123 138 24266 6943 32036 40 162901 42705 186646 254 109825 31808 102255 87 129838 26675 168237 178 37510 8435 64219 51 43750 7409 19630 49 40652 14993 76825 73 87771 36867 115338 176 85872 33835 109427 94 89275 24164 118168 120 44418 12607 84845 66 192565 22609 153197 56 35232 5892 29877 39 40909 17014 63506 66 13294 5394 22445 27 32387 9178 47695 65 140867 6440 68370 58 120662 21916 146304 98 21233 4011 38233 25 44332 5818 42071 26 61056 18647 50517 77 101338 20556 103950 130 1168 238 5841 11 13497 70 2341 2 65567 22392 84396 101 25162 3913 24610 31 32334 12237 35753 36 40735 8388 55515 120 91413 22120 209056 195 855 338 6622 4 97068 11727 115814 89 44339 3704 11609 24 14116 3988 13155 39 10288 3030 18274 14 65622 13520 72875 78 16563 1421 10112 15 76643 20923 142775 106 110681 20237 68847 83 29011 3219 17659 24 92696 3769 20112 37 94785 12252 61023 77 8773 1888 13983 16 83209 14497 65176 56 93815 28864 132432 132 86687 21721 112494 144 34553 4821 45109 40 105547 33644 170875 153 103487 15923 180759 143 213688 42935 214921 220 71220 18864 100226 79 23517 4977 32043 50 56926 7785 54454 39 91721 17939 78876 95 115168 23436 170745 169 111194 325 6940 12 51009 13539 49025 63 135777 34538 122037 134 51513 12198 53782 69 74163 26924 127748 119 51633 12716 86839 119 75345 8172 44830 75 33416 10855 77395 63 83305 11932 89324 55 98952 14300 103300 103 102372 25515 112283 197 37238 2805 10901 16 103772 29402 120691 140 123969 16440 58106 89 27142 11221 57140 40 135400 28732 122422 125 21399 5250 25899 21 130115 28608 139296 167 24874 8092 52678 32 34988 4473 23853 36 45549 1572 17306 13 6023 2065 7953 5 64466 14817 89455 96 54990 16714 147866 151 1644 556 4245 6 6179 2089 21509 13 3926 2658 7670 3 32755 10695 66675 57 34777 1669 14336 23 73224 16267 53608 61 27114 7768 30059 21 20760 7252 29668 43 37636 6387 22097 20 65461 18715 96841 82 30080 7936 41907 90 24094 8643 27080 25 69008 7294 35885 60 54968 4570 41247 61 46090 7185 28313 85 27507 10058 36845 43 10672 2342 16548 25 34029 8509 36134 41 46300 13275 55764 26 24760 6816 28910 38 18779 1930 13339 12 21280 8086 25319 29 40662 10737 66956 49 28987 8033 47487 46 22827 7058 52785 41 18513 6782 44683 31 30594 5401 35619 41 24006 6521 21920 26 27913 10856 45608 23 42744 2154 7721 14 12934 6117 20634 16 22574 5238 29788 25 41385 4820 31931 21 18653 5615 37754 32 18472 4272 32505 9 30976 8702 40557 35 63339 15340 94238 42 25568 8030 44197 68 33747 9526 43228 32 4154 1278 4103 6 19474 4236 44144 68 35130 3023 32868 33 39067 7196 27640 84 13310 3394 14063 46 65892 6371 28990 30 4143 1574 4694 0 28579 9620 42648 36 51776 6978 64329 47 21152 4911 21928 20 38084 8645 25836 50 27717 8987 22779 30 32928 5544 40820 30 11342 3083 27530 34 19499 6909 32378 33 16380 3189 10824 34 36874 6745 39613 37 48259 16724 60865 83 16734 4850 19787 32 28207 7025 20107 30 30143 6047 36605 43 41369 7377 40961 41 45833 9078 48231 51 29156 4605 39725 19 35944 3238 21455 37 36278 8100 23430 33 45588 9653 62991 41 45097 8914 49363 54 3895 786 9604 14 28394 6700 24552 25 18632 5788 31493 25 2325 593 3439 8 25139 4506 19555 26 27975 6382 21228 20 14483 5621 23177 11 13127 3997 22094 14 5839 520 2342 3 24069 8891 38798 40 3738 999 3255 5 18625 7067 24261 38 36341 4639 18511 32 24548 5654 40798 41 21792 6928 28893 46 26263 1514 21425 47 23686 9238 50276 37 49303 8204 37643 51 25659 5926 30377 49 28904 5785 27126 21 2781 4 13 1 29236 5930 42097 44 19546 3710 24451 26 22818 705 14335 21 32689 443 5084 4 5752 2416 9927 10 22197 7747 43527 43 20055 5432 27184 34 25272 4913 21610 32 82206 2650 20484 20 32073 2370 20156 34 5444 775 6012 6 20154 5576 18475 12 36944 1352 12645 24 8019 3080 11017 16 30884 10205 37623 72 19540 6095 35873 27
Names of X columns:
totsize totrevisions totseconds tothyperlinks
Endogenous Variable (Column Number)
Categorization
none
quantiles
hclust
equal
Number of categories (only if categorization<>none)
Cross-Validation? (only if categorization<>none)
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