Send output to:
Browser Blue - Charts White
Browser Black/White
CSV
Data X:
1772 158258 89 576 110 0 48 18 20465 1679 186739 57 510 74 1 53 20 33629 192 7215 18 72 1 0 0 0 1423 2198 122689 93 625 154 0 49 26 25629 3423 226968 133 1153 125 0 76 31 54002 6733 494047 258 1913 278 1 125 36 151036 1709 171007 56 568 89 1 59 23 33287 1624 174432 57 464 59 0 76 30 31172 1882 149604 43 606 87 0 55 30 28113 2828 275778 94 925 129 1 67 26 57803 1946 121844 75 634 158 2 50 24 49830 2125 178322 68 671 120 0 73 30 52143 1782 95108 98 647 87 0 43 22 21055 3049 209143 113 1040 256 4 79 25 47007 1409 157095 56 400 51 4 51 18 28735 1549 152774 82 464 85 3 54 22 59147 1642 134175 54 393 92 0 75 33 78950 1189 69082 56 347 72 5 1 15 13497 2628 149618 86 816 142 0 73 34 46154 726 27997 24 221 49 0 13 18 53249 1026 69866 57 361 40 0 19 15 10726 2733 231687 97 832 99 0 92 30 83700 1729 190182 72 632 127 0 37 25 40400 2162 127994 50 670 164 1 48 34 33797 1824 144028 85 572 41 1 50 21 36205 1573 165288 30 584 160 0 45 21 30165 2043 191300 158 662 92 0 59 25 58534 1360 178833 87 342 59 0 79 31 44663 2708 351374 116 894 89 0 60 31 92556 2111 192399 43 882 90 0 52 20 40078 1593 165257 43 463 76 0 50 28 34711 1568 173687 44 538 111 2 60 20 31076 2187 126725 104 704 92 4 53 17 74608 3032 224762 121 903 331 0 76 25 58092 2388 219428 52 787 84 1 63 24 42009 1 0 1 0 0 0 0 0 0 2033 208669 62 955 58 0 53 27 36022 1654 99706 50 533 138 3 44 14 23333 2094 136733 47 505 270 9 36 35 53349 2152 249965 63 795 64 0 83 34 92596 2320 232951 69 704 96 2 105 22 49598 1659 143748 58 617 62 0 37 34 44093 958 94332 30 350 35 2 25 23 84205 2142 189893 78 800 59 1 63 24 63369 1243 114811 47 384 54 2 55 26 60132 1182 156861 92 319 40 2 41 22 37403 744 81293 31 212 49 1 23 35 24460 2027 208024 94 684 120 0 63 23 46456 2239 223771 85 727 113 1 54 31 66616 2629 160254 58 936 172 8 68 26 41554 658 48188 28 205 37 0 12 22 22346 1790 143776 66 462 51 0 84 21 30874 2410 286674 72 799 89 0 66 27 68701 2018 234829 78 678 73 0 56 30 35728 1911 195583 59 691 49 1 67 33 29010 1714 145942 54 534 74 8 40 11 23110 1823 206054 65 483 58 0 53 26 38844 980 93764 23 301 72 1 26 26 27084 1171 151913 66 419 32 0 67 23 35139 2801 190487 94 938 59 10 36 38 57476 1641 143389 56 483 65 6 50 29 33277 2026 124825 77 770 81 0 48 19 31141 1300 124234 58 352 84 11 46 19 61281 1237 111501 36 427 48 3 53 26 25820 1216 153813 33 406 56 0 27 26 23284 1267 97548 39 403 39 0 38 31 35378 2227 178613 68 483 86 8 68 36 74990 2897 138708 65 887 152 2 93 25 29653 1089 111869 38 265 48 0 57 24 64622 340 31970 15 101 40 0 5 21 4157 2775 224494 110 994 135 3 53 19 29245 1284 123254 67 397 83 1 36 12 50008 1428 113504 64 480 62 2 72 30 52338 1554 105932 68 448 89 1 49 21 13310 2620 159167 66 666 91 0 74 34 92901 1454 95485 43 406 82 2 18 32 10956 2220 170629 59 651 112 1 87 28 34241 2517 156752 94 814 69 0 71 28 75043 975 76427 29 310 78 0 18 21 21152 1234 84971 71 395 105 0 34 31 42249 920 80506 67 215 49 0 54 26 42005 2064 267448 61 782 60 0 43 29 41152 956 62974 27 292 49 1 26 23 14399 1442 119802 35 482 132 0 44 25 28263 992 75132 45 341 49 0 35 22 17215 1695 156084 51 545 71 0 32 26 48140 2578 222914 221 636 100 0 55 33 62897 1201 115019 108 284 74 0 58 24 22883 1250 99114 58 396 49 7 44 24 41622 1443 149326 51 575 72 0 39 21 40715 1759 144425 40 638 59 5 48 28 65897 2199 159599 75 641 90 1 72 27 76542 1229 151465 57 413 68 0 39 25 37477 1365 133686 58 505 81 0 28 15 53216 897 58059 38 363 30 0 24 13 40911 2264 234131 113 715 166 0 49 36 57021 1813 193233 69 550 94 0 95 24 73116 223 19349 12 67 15 0 13 1 3895 2335 206298 104 788 104 3 32 24 46609 1959 151538 75 805 61 0 41 31 29351 699 59117 28 281 11 0 24 4 2325 805 58280 23 240 44 0 41 20 31747 1233 126653 49 396 84 0 57 23 32665 1145 112265 58 294 66 1 28 23 19249 799 83829 40 218 27 1 34 12 15292 596 27676 22 194 59 0 2 16 5842 1395 134235 46 316 127 0 80 29 33994 1128 122405 36 268 48 0 29 26 13018 0 0 0 0 0 0 0 0 0 1030 85610 31 306 58 0 46 25 98177 1134 107205 66 371 57 0 25 21 37941 1366 144664 44 465 59 0 51 23 31032 1451 136540 61 429 76 0 59 21 32683 849 71894 57 287 71 0 36 21 34545 78 3616 5 14 5 0 0 0 0 0 0 0 0 0 0 0 0 0 1092 172534 42 379 70 0 36 23 27525 1530 138499 80 547 72 0 68 29 66856 1981 152826 95 552 119 2 28 28 28549 914 113245 37 287 56 0 36 23 38610 778 43410 19 292 63 0 7 1 2781 1748 175762 71 529 92 1 70 29 41211 918 90591 41 245 46 0 30 17 22698 1778 114942 53 519 61 8 55 30 41194 731 60493 40 174 29 3 3 12 32689 285 19764 12 75 19 1 10 2 5752 1833 164062 55 565 64 3 46 21 26757 1073 125970 29 359 66 0 34 25 22527 1589 151495 47 529 97 0 50 29 44810 256 11796 9 79 22 0 1 2 0 98 10674 9 33 7 0 0 0 0 1383 138547 55 475 37 0 35 18 100674 41 6836 3 11 5 0 0 1 0 1773 154121 60 606 48 6 48 21 57786 42 5118 3 6 1 0 5 0 0 528 40248 16 183 34 1 8 4 5444 0 0 0 0 0 0 0 0 0 1036 117954 46 325 49 0 35 25 28470 1305 88837 38 269 44 0 21 26 61849 81 7131 4 27 0 1 0 0 0 258 8812 14 97 18 0 0 4 2179 914 68916 23 251 48 1 15 17 8019 1179 132697 50 290 54 0 50 21 39644 1147 100681 19 414 50 1 17 22 23494
Names of X columns:
Pageviews Time Logins Views Views(PR) Shared Blogged Reviewed characters
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
2 seconds
R Server
Big Analytics Cloud Computing Center
Click here to blog (archive) this computation