Send output to:
Browser Blue - Charts White
Browser Black/White
CSV
Data X:
1683 150596 84 535 109 0 37 18 1323 154801 50 396 73 1 42 20 192 7215 18 72 1 0 0 0 2172 122139 91 617 154 0 49 26 3335 221399 129 1118 124 0 76 30 6310 441870 237 1755 276 1 118 34 1478 134379 52 498 89 1 42 23 1324 140428 53 355 54 0 57 30 1488 103255 40 413 87 0 45 30 2756 271630 91 891 129 1 67 26 1931 121593 71 629 158 2 50 24 1966 172071 63 611 113 0 71 30 1575 83707 94 564 75 0 41 19 2855 197412 98 964 255 4 66 25 1263 134398 48 362 50 4 42 17 1479 139224 73 442 81 3 54 19 1636 134153 52 391 92 0 75 33 1076 64149 52 305 72 5 0 15 2376 122294 82 721 142 0 54 34 678 24889 22 206 47 0 13 15 902 52197 52 310 40 0 16 15 2308 188915 89 686 94 0 77 27 1590 163147 66 572 127 0 34 25 1863 98575 48 558 164 1 38 34 1799 143546 80 569 41 1 50 21 1385 139780 25 513 160 0 39 21 1870 163784 146 602 90 0 54 25 1161 152479 75 276 55 0 67 28 2417 304108 109 791 78 0 55 26 1952 184024 40 815 90 0 52 20 1514 151621 41 427 76 0 50 28 1487 164516 41 496 111 2 54 20 2051 120179 94 653 87 4 53 17 2843 214701 116 857 302 0 76 25 2216 196865 48 736 84 1 52 24 1 0 1 0 0 0 0 0 1830 181527 57 862 58 0 46 27 1563 93107 49 483 137 3 44 14 2046 129352 45 495 267 9 35 32 2005 229143 58 749 56 0 82 31 1934 177063 67 627 94 2 70 21 1572 126602 53 597 62 0 31 34 950 93742 29 348 35 2 25 23 1877 152153 72 711 59 1 48 24 1036 95704 42 322 46 2 44 22 1097 139793 84 280 40 2 40 22 730 76348 30 205 49 1 23 35 1918 188980 86 648 114 0 63 21 1826 172100 79 580 113 1 43 31 2444 146552 54 875 171 7 62 26 658 48188 28 205 37 0 12 22 1425 109185 60 363 51 0 63 21 2246 263652 68 757 89 0 60 27 1899 215609 75 647 67 0 53 26 1630 174876 54 584 49 1 53 33 1496 115124 49 457 74 6 35 11 1681 179712 60 438 58 0 49 26 816 70369 20 235 72 0 25 26 902 109215 58 312 30 0 47 21 2606 166096 85 877 59 10 30 38 1557 130414 51 454 65 6 50 29 1780 102057 71 668 81 0 36 19 1265 115310 56 346 84 11 43 19 1117 101181 32 377 46 3 44 24 1069 135228 31 365 56 0 14 26 1229 94982 37 391 36 0 38 29 2155 166919 67 476 84 8 58 34 2500 118169 64 747 152 2 68 25 1003 102361 36 246 48 0 48 24 340 31970 15 101 40 0 5 21 2586 200413 107 901 135 3 53 19 1119 103381 58 334 80 1 36 12 1251 94940 61 404 60 2 62 28 1516 101560 65 442 89 1 46 21 2473 144176 60 627 89 0 67 34 1288 71921 37 345 79 2 2 32 1911 126905 54 538 111 1 64 27 2279 131184 87 741 67 0 59 26 816 60138 23 253 76 0 16 21 1234 84971 71 395 105 0 34 31 907 80420 64 211 49 0 54 26 1827 233569 57 670 57 0 39 26 841 56252 25 244 49 0 26 23 1309 97181 32 438 132 0 37 25 764 50800 41 255 49 0 17 22 1439 125941 45 434 71 0 32 26 2500 211032 210 613 100 0 55 33 974 71960 92 233 71 0 39 22 1152 90379 53 360 49 6 39 24 1261 125650 47 486 72 0 28 21 1508 115572 36 535 59 5 45 28 2005 136266 67 585 86 1 66 22 1191 146715 55 402 65 0 39 22 1265 124626 57 466 81 0 27 15 761 49176 33 291 30 0 22 13 2156 212926 102 691 166 0 43 36 1689 173884 55 515 89 0 88 24 223 19349 12 67 15 0 13 1 2074 181141 95 712 104 3 23 24 1879 145502 70 770 61 0 40 31 566 45448 26 247 11 0 8 4 802 58280 20 240 44 0 41 20 1131 115944 44 360 84 0 51 23 981 94341 52 249 66 1 24 23 591 59090 37 138 27 0 23 12 596 27676 22 194 59 0 2 16 1261 120586 41 285 126 0 78 28 861 88011 31 227 32 0 12 10 0 0 0 0 0 0 0 0 1030 85610 31 306 58 0 46 25 991 84193 58 328 52 0 22 21 1178 117769 39 397 49 0 49 21 1200 107653 56 369 64 0 52 21 849 71894 57 287 71 0 36 21 78 3616 5 14 5 0 0 0 0 0 0 0 0 0 0 0 924 154806 38 301 70 0 35 23 1480 136061 73 535 72 0 68 29 1870 141822 89 530 118 1 26 27 861 106515 37 272 56 0 32 23 778 43410 19 292 63 0 7 1 1533 146920 64 458 88 1 67 25 889 88874 38 241 46 0 30 17 1705 111924 49 497 60 8 55 29 700 60373 39 165 29 3 3 12 285 19764 12 75 19 1 10 2 1490 121665 46 461 58 2 46 18 981 108685 26 341 66 0 23 25 1368 124493 37 446 97 0 43 29 256 11796 9 79 22 0 1 2 98 10674 9 33 7 0 0 0 1317 131263 52 449 37 0 33 18 41 6836 3 11 5 0 0 1 1768 153278 55 606 48 5 48 21 42 5118 3 6 1 0 5 0 528 40248 16 183 34 1 8 4 0 0 0 0 0 0 0 0 938 100728 42 310 49 0 25 25 1245 84267 36 245 44 0 21 26 81 7131 4 27 0 1 0 0 257 8812 13 97 18 0 0 4 891 63952 22 247 48 1 15 17 1114 120111 47 273 54 0 47 21 1079 94127 18 386 50 1 17 22
Names of X columns:
pageviews timeRFC logins CCV CV Cauthors bloggedC reviewedC
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