Send output to:
Browser Blue - Charts White
Browser Black/White
CSV
Data X:
146455 1 22 68 128 95556 84944 4 20 72 89 54565 113337 9 24 37 68 63016 128655 2 21 70 108 79774 74398 1 15 30 51 31258 35523 2 16 53 33 52491 293403 0 20 74 119 91256 32750 0 18 22 5 22807 106539 5 19 68 63 77411 130539 0 20 47 66 48821 154991 0 25 87 98 52295 126683 7 37 123 71 63262 100672 6 23 69 55 50466 179562 3 28 89 116 62932 125971 4 25 45 71 38439 234509 0 35 122 120 70817 158980 4 20 75 122 105965 184217 3 22 45 74 73795 107342 0 19 53 111 82043 141371 5 26 96 103 74349 154730 0 27 82 98 82204 264020 1 22 76 100 55709 90938 3 15 51 42 37137 101324 5 26 104 100 70780 130232 0 24 83 105 55027 137793 0 22 78 77 56699 161678 4 21 59 83 65911 151503 0 23 83 98 56316 105324 0 21 71 46 26982 175914 0 25 81 95 54628 181853 3 25 93 91 96750 114928 4 28 72 91 53009 190410 1 30 107 94 64664 61499 4 20 75 15 36990 223004 1 23 84 137 85224 167131 0 25 69 56 37048 233482 0 26 90 78 59635 121185 2 20 51 68 42051 78776 1 8 18 34 26998 188967 2 20 75 94 63717 199512 8 21 59 82 55071 102531 5 25 63 63 40001 118958 3 20 68 58 54506 68948 4 18 47 43 35838 93125 1 21 29 36 50838 277108 2 22 69 64 86997 78800 2 26 66 21 33032 157250 0 30 106 104 61704 210554 6 24 73 124 117986 127324 3 26 87 101 56733 114397 0 18 65 85 55064 24188 0 4 7 7 5950 246209 6 31 111 124 84607 65029 5 18 61 21 32551 98030 3 14 41 35 31701 173587 1 20 70 95 71170 172684 5 30 112 102 101773 191381 5 20 71 212 101653 191276 0 26 90 141 81493 134043 9 20 69 54 55901 233406 6 27 85 117 109104 195304 6 18 47 145 114425 127619 5 27 50 50 36311 162810 6 22 76 80 70027 129100 2 19 60 87 73713 108715 0 15 35 78 40671 106469 3 19 72 86 89041 142069 8 28 88 82 57231 143937 2 20 66 139 78792 84256 5 17 58 75 59155 118807 11 25 81 70 55827 69471 6 20 63 25 22618 122433 5 25 91 66 58425 131122 1 20 50 89 65724 94763 0 22 75 99 56979 188780 3 25 85 98 72369 191467 3 20 75 104 79194 105615 6 23 70 48 202316 89318 1 22 78 81 44970 107335 0 21 61 64 49319 98599 1 18 55 44 36252 260646 0 25 60 104 75741 131876 5 22 83 36 38417 119291 2 25 38 120 64102 80953 0 8 27 58 56622 99768 0 21 62 27 15430 84572 5 22 82 84 72571 202373 1 21 79 56 67271 166790 0 30 59 46 43460 99946 1 23 80 119 99501 116900 1 20 36 57 28340 142146 2 24 88 139 76013 99246 4 21 63 51 37361 156833 1 20 73 85 48204 175078 4 20 71 91 76168 130533 0 20 76 79 85168 142339 2 20 67 142 125410 176789 0 23 66 149 123328 181379 7 33 123 96 83038 228548 7 19 65 198 120087 142141 6 27 87 61 91939 167845 0 25 77 145 103646 103012 0 20 37 26 29467 43287 4 19 64 49 43750 125366 4 15 22 68 34497 118372 0 21 35 145 66477 135171 0 22 61 82 71181 175568 0 24 80 102 74482 74112 0 19 54 52 174949 88817 0 20 60 56 46765 164767 4 23 87 80 90257 141933 0 27 75 99 51370 22938 0 1 0 11 1168 115199 0 20 54 87 51360 61857 4 11 30 28 25162 91185 0 27 66 67 21067 213765 1 22 56 150 58233 21054 0 0 0 4 855 167105 5 17 32 71 85903 31414 0 8 9 39 14116 178863 1 23 78 87 57637 126681 7 26 90 66 94137 64320 5 20 56 23 62147 67746 2 16 35 56 62832 38214 0 8 21 16 8773 90961 1 22 78 49 63785 181510 0 33 118 108 65196 116775 0 28 83 112 73087 223914 2 26 89 110 72631 185139 0 27 83 126 86281 242879 2 35 124 155 162365 139144 0 21 76 75 56530 75812 0 20 57 30 35606 178218 4 24 91 78 70111 246834 4 26 89 135 92046 50999 8 20 66 8 63989 223842 0 22 82 114 104911 93577 4 24 63 60 43448 155383 0 23 75 99 60029 111664 1 22 59 98 38650 75426 0 12 19 33 47261 243551 9 21 57 93 73586 136548 0 21 62 157 83042 173260 3 21 78 15 37238 185039 7 25 73 98 63958 67507 5 32 112 49 78956 139350 2 24 79 88 99518 172964 1 28 96 151 111436 0 9 0 0 0 0 14688 0 0 0 5 6023 98 0 0 0 0 0 455 0 0 0 0 0 0 1 0 0 0 0 0 0 0 0 0 0 128066 2 20 48 80 42564 176460 1 27 55 122 38885 0 0 0 0 0 0 203 0 0 0 0 0 7199 0 0 0 6 1644 46660 0 5 13 13 6179 17547 0 1 4 3 3926 73567 0 23 31 18 23238 969 0 0 0 0 0 101060 2 16 29 48 49288
Names of X columns:
Time_in_RFC Shared_compendiums Reviewed_compendiums Long_feedback Blogs 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