Send output to:
Browser Blue - Charts White
Browser Black/White
CSV
Data X:
1801 159261 91 48 67 1717 189672 59 53 56 192 7215 18 0 0 2295 129098 95 51 63 3450 230632 136 76 116 6861 515038 263 136 138 1795 180745 56 62 71 1681 185559 59 83 107 1897 154581 44 55 50 2974 298001 96 67 79 1946 121844 75 50 58 2330 200907 70 87 91 1839 101647 100 46 41 3183 220269 119 79 100 1486 170952 61 56 61 1567 154647 88 54 74 1756 142018 57 81 131 1247 79030 61 6 45 2779 167047 87 74 110 726 27997 24 13 41 1048 73019 59 22 37 2805 241082 100 99 84 1760 195820 72 38 67 2266 142001 54 59 69 1848 145433 86 50 58 1665 183744 32 50 60 2114 206521 164 63 88 1448 201385 94 90 75 2741 354924 118 60 98 2112 192399 44 52 67 1684 182286 44 61 84 1616 181590 45 60 62 2227 133801 105 53 35 3088 233686 123 76 74 2389 219428 53 63 89 1 0 1 0 0 2099 223044 63 54 79 1669 100129 51 44 39 2137 145864 49 42 101 2153 249965 64 83 135 2390 242379 71 105 76 1701 145794 59 37 118 1049 103623 33 25 76 2161 195891 78 64 65 1276 117156 50 55 97 1190 157787 95 41 67 745 81293 32 23 63 2374 243273 103 77 96 2289 233155 89 59 112 2639 160344 59 68 75 658 48188 28 12 39 1917 161922 69 99 63 2557 307432 74 78 93 2026 235223 79 56 76 1911 195583 59 67 117 1716 146061 56 40 30 1852 208834 67 53 65 981 93764 24 26 78 1177 151985 66 67 87 2849 195506 97 36 85 1688 148922 60 50 115 2162 142670 81 51 62 1331 129561 61 46 60 1307 122204 38 57 67 1256 160930 35 27 90 1294 99184 41 38 100 2311 192811 71 72 135 2897 138708 65 93 71 1103 114408 38 59 75 340 31970 15 5 42 2791 225558 112 53 42 1338 139220 72 40 8 1441 113612 68 72 86 1681 119537 72 53 41 2650 162203 67 81 118 1499 100098 44 27 91 2302 174768 60 94 102 2540 158459 97 71 89 1000 80934 30 20 46 1234 84971 71 34 60 927 80545 68 54 69 2176 287191 64 49 95 957 62974 28 26 17 1551 134091 40 48 61 1014 75555 46 35 55 1772 162154 55 32 55 2630 227638 229 55 124 1205 115367 112 58 73 1392 115603 63 44 73 1524 155537 52 45 67 1829 153133 41 49 66 2229 165618 78 72 75 1233 151517 57 39 83 1365 133686 58 28 55 950 61342 40 24 27 2319 245196 117 52 115 1857 195576 70 96 76 223 19349 12 13 0 2390 225371 105 38 83 1985 153213 78 41 90 700 59117 29 24 4 1062 91762 24 54 60 1311 136769 54 68 63 1157 114798 61 28 52 823 85338 40 36 24 596 27676 22 2 17 1545 153535 48 91 105 1130 122417 37 29 20 0 0 0 0 0 1082 91529 32 46 51 1135 107205 67 25 76 1367 144664 45 51 59 1506 146445 63 60 70 870 76656 60 36 38 78 3616 5 0 0 0 0 0 0 0 1130 183088 44 40 81 1582 144677 84 68 78 2034 159104 98 28 73 970 128944 39 41 89 778 43410 19 7 3 1752 175774 73 70 87 957 95401 42 30 51 2098 134837 55 69 73 731 60493 40 3 32 285 19764 12 10 4 1834 164062 56 46 70 1148 132696 33 34 102 1646 155367 54 54 91 256 11796 9 1 1 98 10674 9 0 0 1404 142261 57 39 39 41 6836 3 0 0 1824 162563 63 48 45 42 5118 3 5 0 528 40248 16 8 7 0 0 0 0 0 1073 122641 47 38 75 1305 88837 38 21 52 81 7131 4 0 0 261 9056 14 0 1 934 76611 24 15 49 1180 132697 51 50 69 1148 100681 20 17 56
Names of X columns:
Pageviews Time_in_RFC Logins Blogged_Computations Peer_Reviews
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