Send output to:
Browser Blue - Charts White
Browser Black/White
CSV
Data X:
1418 210907 56 396 81 3 79 30 115 94 112285 869 120982 56 297 55 4 58 28 109 103 84786 1530 176508 54 559 50 12 60 38 146 93 83123 2172 179321 89 967 125 2 108 30 116 103 101193 901 123185 40 270 40 1 49 22 68 51 38361 463 52746 25 143 37 3 0 26 101 70 68504 3201 385534 92 1562 63 0 121 25 96 91 119182 371 33170 18 109 44 0 1 18 67 22 22807 1192 101645 63 371 88 0 20 11 44 38 17140 1583 149061 44 656 66 5 43 26 100 93 116174 1439 165446 33 511 57 0 69 25 93 60 57635 1764 237213 84 655 74 0 78 38 140 123 66198 1495 173326 88 465 49 7 86 44 166 148 71701 1373 133131 55 525 52 7 44 30 99 90 57793 2187 258873 60 885 88 3 104 40 139 124 80444 1491 180083 66 497 36 9 63 34 130 70 53855 4041 324799 154 1436 108 0 158 47 181 168 97668 1706 230964 53 612 43 4 102 30 116 115 133824 2152 236785 119 865 75 3 77 31 116 71 101481 1036 135473 41 385 32 0 82 23 88 66 99645 1882 202925 61 567 44 7 115 36 139 134 114789 1929 215147 58 639 85 0 101 36 135 117 99052 2242 344297 75 963 86 1 80 30 108 108 67654 1220 153935 33 398 56 5 50 25 89 84 65553 1289 132943 40 410 50 7 83 39 156 156 97500 2515 174724 92 966 135 0 123 34 129 120 69112 2147 174415 100 801 63 0 73 31 118 114 82753 2352 225548 112 892 81 5 81 31 118 94 85323 1638 223632 73 513 52 0 105 33 125 120 72654 1222 124817 40 469 44 0 47 25 95 81 30727 1812 221698 45 683 113 0 105 33 126 110 77873 1677 210767 60 643 39 3 94 35 135 133 117478 1579 170266 62 535 73 4 44 42 154 122 74007 1731 260561 75 625 48 1 114 43 165 158 90183 807 84853 31 264 33 4 38 30 113 109 61542 2452 294424 77 992 59 2 107 33 127 124 101494 829 101011 34 238 41 0 30 13 52 39 27570 1940 215641 46 818 69 0 71 32 121 92 55813 2662 325107 99 937 64 0 84 36 136 126 79215 186 7176 17 70 1 0 0 0 0 0 1423 1499 167542 66 507 59 2 59 28 108 70 55461 865 106408 30 260 32 1 33 14 46 37 31081 1793 96560 76 503 129 0 42 17 54 38 22996 2527 265769 146 927 37 2 96 32 124 120 83122 2747 269651 67 1269 31 10 106 30 115 93 70106 1324 149112 56 537 65 6 56 35 128 95 60578 2702 175824 107 910 107 0 57 20 80 77 39992 1383 152871 58 532 74 5 59 28 97 90 79892 1179 111665 34 345 54 4 39 28 104 80 49810 2099 116408 61 918 76 1 34 39 59 31 71570 4308 362301 119 1635 715 2 76 34 125 110 100708 918 78800 42 330 57 2 20 26 82 66 33032 1831 183167 66 557 66 0 91 39 149 138 82875 3373 277965 89 1178 106 8 115 39 149 133 139077 1713 150629 44 740 54 3 85 33 122 113 71595 1438 168809 66 452 32 0 76 28 118 100 72260 496 24188 24 218 20 0 8 4 12 7 5950 2253 329267 259 764 71 8 79 39 144 140 115762 744 65029 17 255 21 5 21 18 67 61 32551 1161 101097 64 454 70 3 30 14 52 41 31701 2352 218946 41 866 112 1 76 29 108 96 80670 2144 244052 68 574 66 5 101 44 166 164 143558 4691 341570 168 1276 190 1 94 21 80 78 117105 1112 103597 43 379 66 1 27 16 60 49 23789 2694 233328 132 825 165 5 92 28 107 102 120733 1973 256462 105 798 56 0 123 35 127 124 105195 1769 206161 71 663 61 12 75 28 107 99 73107 3148 311473 112 1069 53 8 128 38 146 129 132068 2474 235800 94 921 127 8 105 23 84 62 149193 2084 177939 82 858 63 8 55 36 141 73 46821 1954 207176 70 711 38 8 56 32 123 114 87011 1226 196553 57 503 50 2 41 29 111 99 95260 1389 174184 53 382 52 0 72 25 98 70 55183 1496 143246 103 464 42 5 67 27 105 104 106671 2269 187559 121 717 76 8 75 36 135 116 73511 1833 187681 62 690 67 2 114 28 107 91 92945 1268 119016 52 462 50 5 118 23 85 74 78664 1943 182192 52 657 53 12 77 40 155 138 70054 893 73566 32 385 39 6 22 23 88 67 22618 1762 194979 62 577 50 7 66 40 155 151 74011 1403 167488 45 619 77 2 69 28 104 72 83737 1425 143756 46 479 57 0 105 34 132 120 69094 1857 275541 63 817 73 4 116 33 127 115 93133 1840 243199 75 752 34 3 88 28 108 105 95536 1502 182999 88 430 39 6 73 34 129 104 225920 1441 135649 46 451 46 2 99 30 116 108 62133 1420 152299 53 537 63 0 62 33 122 98 61370 1416 120221 37 519 35 1 53 22 85 69 43836 2970 346485 90 1000 106 0 118 38 147 111 106117 1317 145790 63 637 43 5 30 26 99 99 38692 1644 193339 78 465 47 2 100 35 87 71 84651 870 80953 25 437 31 0 49 8 28 27 56622 1654 122774 45 711 162 0 24 24 90 69 15986 1054 130585 46 299 57 5 67 29 109 107 95364 937 112611 41 248 36 0 46 20 78 73 26706 3004 286468 144 1162 263 1 57 29 111 107 89691 2008 241066 82 714 78 0 75 45 158 93 67267
Names of X columns:
pageviews time_in_rfc logins compendium_views_info compendium_views_pr shared_compendiums blogged_computations compendiums_reviewed feedback_messages_p1 feedback_messages_p120 totsize
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