Send output to:
Browser Blue - Charts White
Browser Black/White
CSV
Data X:
1683 150596 84 37 18 63 20465 23975 0 1323 154801 50 42 20 56 33629 85634 1 192 7215 18 0 0 0 1423 1929 0 2172 122139 91 49 26 60 25629 36294 0 3335 221399 129 76 30 112 54002 72255 0 6310 441870 237 118 34 130 151036 189748 1 1478 134379 52 42 23 71 33287 61834 1 1324 140428 53 57 30 107 31172 68167 0 1488 103255 40 45 30 50 28113 38462 0 2756 271630 91 67 26 79 57803 101219 1 1931 121593 71 50 24 58 49830 43270 2 1966 172071 63 71 30 91 52143 76183 0 1575 83707 94 41 19 36 21055 31476 0 2855 197412 98 66 25 91 47007 62157 4 1263 134398 48 42 17 58 28735 46261 4 1479 139224 73 54 19 65 59147 50063 3 1636 134153 52 75 33 131 78950 64483 0 1076 64149 52 0 15 45 13497 2341 5 2376 122294 82 54 34 110 46154 48149 0 678 24889 22 13 15 33 53249 12743 0 902 52197 52 16 15 37 10726 18743 0 2308 188915 89 77 27 78 83700 97057 0 1590 163147 66 34 25 67 40400 17675 0 1863 98575 48 38 34 69 33797 33106 1 1799 143546 80 50 21 58 36205 53311 1 1385 139780 25 39 21 60 30165 42754 0 1870 163784 146 54 25 88 58534 59056 0 1161 152479 75 67 28 71 44663 101621 0 2417 304108 109 55 26 85 92556 118120 0 1952 184024 40 52 20 67 40078 79572 0 1514 151621 41 50 28 84 34711 42744 0 1487 164516 41 54 20 58 31076 65931 2 2051 120179 94 53 17 35 74608 38575 4 2843 214701 116 76 25 74 58092 28795 0 2216 196865 48 52 24 89 42009 94440 1 1 0 1 0 0 0 0 0 0 1830 181527 57 46 27 75 36022 38229 0 1563 93107 49 44 14 39 23333 31972 3 2046 129352 45 35 32 93 53349 40071 9 2005 229143 58 82 31 123 92596 132480 0 1934 177063 67 70 21 73 49598 62797 2 1572 126602 53 31 34 118 44093 40429 0 950 93742 29 25 23 76 84205 45545 2 1877 152153 72 48 24 65 63369 57568 1 1036 95704 42 44 22 82 60132 39019 2 1097 139793 84 40 22 67 37403 53866 2 730 76348 30 23 35 63 24460 38345 1 1918 188980 86 63 21 84 46456 50210 0 1826 172100 79 43 31 112 66616 80947 1 2444 146552 54 62 26 75 41554 43461 7 658 48188 28 12 22 39 22346 14812 0 1425 109185 60 63 21 63 30874 37819 0 2246 263652 68 60 27 93 68701 102738 0 1899 215609 75 53 26 69 35728 54509 0 1630 174876 54 53 33 117 29010 62956 1 1496 115124 49 35 11 30 23110 55411 6 1681 179712 60 49 26 65 38844 50611 0 816 70369 20 25 26 78 27084 26692 0 902 109215 58 47 21 80 35139 60056 0 2606 166096 85 30 38 85 57476 25155 10 1557 130414 51 50 29 107 33277 42840 6 1780 102057 71 36 19 60 31141 39358 0 1265 115310 56 43 19 53 61281 47241 11 1117 101181 32 44 24 62 25820 49611 3 1069 135228 31 14 26 90 23284 41833 0 1229 94982 37 38 29 89 35378 48930 0 2155 166919 67 58 34 127 74990 110600 8 2500 118169 64 68 25 71 29653 52235 2 1003 102361 36 48 24 75 64622 53986 0 340 31970 15 5 21 42 4157 4105 0 2586 200413 107 53 19 42 29245 59331 3 1119 103381 58 36 12 8 50008 47796 1 1251 94940 61 62 28 82 52338 38302 2 1516 101560 65 46 21 41 13310 14063 1 2473 144176 60 67 34 118 92901 54414 0 1288 71921 37 2 32 91 10956 9903 2 1911 126905 54 64 27 96 34241 53987 1 2279 131184 87 59 26 81 75043 88937 0 816 60138 23 16 21 46 21152 21928 0 1234 84971 71 34 31 60 42249 29487 0 907 80420 64 54 26 69 42005 35334 0 1827 233569 57 39 26 85 41152 57596 0 841 56252 25 26 23 17 14399 29750 0 1309 97181 32 37 25 61 28263 41029 0 764 50800 41 17 22 55 17215 12416 0 1439 125941 45 32 26 55 48140 51158 0 2500 211032 210 55 33 124 62897 79935 0 974 71960 92 39 22 65 22883 26552 0 1152 90379 53 39 24 73 41622 25807 6 1261 125650 47 28 21 67 40715 50620 0 1508 115572 36 45 28 66 65897 61467 5 2005 136266 67 66 22 61 76542 65292 1 1191 146715 55 39 22 74 37477 55516 0 1265 124626 57 27 15 55 53216 42006 0 761 49176 33 22 13 27 40911 26273 0 2156 212926 102 43 36 115 57021 90248 0 1689 173884 55 88 24 76 73116 61476 0 223 19349 12 13 1 0 3895 9604 0 2074 181141 95 23 24 83 46609 45108 3 1879 145502 70 40 31 90 29351 47232 0 566 45448 26 8 4 4 2325 3439 0 802 58280 20 41 20 56 31747 30553 0 1131 115944 44 51 23 63 32665 24751 0 981 94341 52 24 23 52 19249 34458 1 591 59090 37 23 12 24 15292 24649 0 596 27676 22 2 16 17 5842 2342 0 1261 120586 41 78 28 101 33994 52739 0 861 88011 31 12 10 20 13018 6245 0 0 0 0 0 0 0 0 0 0 1030 85610 31 46 25 51 98177 35381 0 991 84193 58 22 21 76 37941 19595 0 1178 117769 39 49 21 55 31032 50848 0 1200 107653 56 52 21 70 32683 39443 0 849 71894 57 36 21 38 34545 27023 0 78 3616 5 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 924 154806 38 35 23 81 27525 61022 0 1480 136061 73 68 29 64 66856 63528 0 1870 141822 89 26 27 66 28549 34835 1 861 106515 37 32 23 89 38610 37172 0 778 43410 19 7 1 3 2781 13 0 1533 146920 64 67 25 76 41211 62548 1 889 88874 38 30 17 48 22698 31334 0 1705 111924 49 55 29 62 41194 20839 8 700 60373 39 3 12 32 32689 5084 3 285 19764 12 10 2 4 5752 9927 1 1490 121665 46 46 18 61 26757 53229 2 981 108685 26 23 25 90 22527 29877 0 1368 124493 37 43 29 91 44810 37310 0 256 11796 9 1 2 1 0 0 0 98 10674 9 0 0 0 0 0 0 1317 131263 52 33 18 39 100674 50067 0 41 6836 3 0 1 0 0 0 0 1768 153278 55 48 21 45 57786 47708 5 42 5118 3 5 0 0 0 0 0 528 40248 16 8 4 7 5444 6012 1 0 0 0 0 0 0 0 0 0 938 100728 42 25 25 75 28470 27749 0 1245 84267 36 21 26 52 61849 47555 0 81 7131 4 0 0 0 0 0 1 257 8812 13 0 4 1 2179 1336 0 891 63952 22 15 17 49 8019 11017 1 1114 120111 47 47 21 69 39644 55184 0 1079 94127 18 17 22 56 23494 43485 1
Names of X columns:
Pageviews Time_in_RFC #Logins blogs reviews Submits_+120 Characters CW_time Shared
Endogenous Variable (Column Number)
Categorization
equal
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