R version 2.13.0 (2011-04-13) Copyright (C) 2011 The R Foundation for Statistical Computing ISBN 3-900051-07-0 Platform: i486-pc-linux-gnu (32-bit) R is free software and comes with ABSOLUTELY NO WARRANTY. You are welcome to redistribute it under certain conditions. Type 'license()' or 'licence()' for distribution details. R is a collaborative project with many contributors. Type 'contributors()' for more information and 'citation()' on how to cite R or R packages in publications. Type 'demo()' for some demos, 'help()' for on-line help, or 'help.start()' for an HTML browser interface to help. Type 'q()' to quit R. > x <- array(list(1801 + ,159261 + ,91 + ,586 + ,111 + ,0 + ,74 + ,1717 + ,189672 + ,59 + ,520 + ,76 + ,1 + ,80 + ,192 + ,7215 + ,18 + ,72 + ,1 + ,0 + ,0 + ,2295 + ,129098 + ,95 + ,645 + ,155 + ,0 + ,84 + ,3450 + ,230632 + ,136 + ,1163 + ,125 + ,0 + ,124 + ,6861 + ,515038 + ,263 + ,1945 + ,278 + ,1 + ,140 + ,1795 + ,180745 + ,56 + ,585 + ,89 + ,1 + ,88 + ,1681 + ,185559 + ,59 + ,470 + ,59 + ,0 + ,115 + ,1897 + ,154581 + ,44 + ,612 + ,87 + ,0 + ,109 + ,2974 + ,298001 + ,96 + ,992 + ,129 + ,1 + ,104 + ,1946 + ,121844 + ,75 + ,634 + ,158 + ,2 + ,63 + ,2148 + ,184039 + ,69 + ,677 + ,120 + ,0 + ,118 + ,1832 + ,100324 + ,98 + ,665 + ,87 + ,0 + ,71 + ,3183 + ,220269 + ,119 + ,1079 + ,264 + ,4 + ,112 + ,1476 + ,168265 + ,58 + ,413 + ,51 + ,4 + ,63 + ,1567 + ,154647 + ,88 + ,469 + ,85 + ,3 + ,86 + ,1756 + ,142018 + ,57 + ,431 + ,96 + ,0 + ,132 + ,1247 + ,79030 + ,61 + ,361 + ,72 + ,5 + ,54 + ,2779 + ,167047 + ,87 + ,877 + ,147 + ,0 + ,134 + ,726 + ,27997 + ,24 + ,221 + ,49 + ,0 + ,57 + ,1048 + ,73019 + ,59 + ,366 + ,40 + ,0 + ,59 + ,2805 + ,241082 + ,100 + ,846 + ,99 + ,0 + ,113 + ,1760 + ,195820 + ,72 + ,642 + ,127 + ,0 + ,96 + ,2266 + ,142001 + ,54 + ,689 + ,164 + ,1 + ,96 + ,1848 + ,145433 + ,86 + ,576 + ,41 + ,1 + ,78 + ,1665 + ,183744 + ,32 + ,610 + ,160 + ,0 + ,80 + ,2084 + ,202357 + ,163 + ,673 + ,92 + ,0 + ,93 + ,1440 + ,199532 + ,93 + ,361 + ,59 + ,0 + ,109 + ,2741 + ,354924 + ,118 + ,907 + ,89 + ,0 + ,115 + ,2112 + ,192399 + ,44 + ,882 + ,90 + ,0 + ,79 + ,1684 + ,182286 + ,44 + ,490 + ,76 + ,0 + ,103 + ,1616 + ,181590 + ,45 + ,548 + ,116 + ,2 + ,71 + ,2227 + ,133801 + ,105 + ,723 + ,92 + ,4 + ,66 + ,3088 + ,233686 + ,123 + ,918 + ,344 + ,0 + ,100 + ,2389 + ,219428 + ,53 + ,787 + ,84 + ,1 + ,96 + ,1 + ,0 + ,1 + ,0 + ,0 + ,0 + ,0 + ,2099 + ,223044 + ,63 + ,983 + ,61 + ,0 + ,109 + ,1669 + ,100129 + ,51 + ,539 + ,138 + ,3 + ,51 + ,2137 + ,145864 + ,49 + ,515 + ,270 + ,9 + ,119 + ,2153 + ,249965 + ,64 + ,795 + ,64 + ,0 + ,136 + ,2390 + ,242379 + ,71 + ,753 + ,96 + ,2 + ,84 + ,1701 + ,145794 + ,59 + ,635 + ,62 + ,0 + ,136 + ,983 + ,96404 + ,32 + ,361 + ,35 + ,2 + ,84 + ,2161 + ,195891 + ,78 + ,804 + ,59 + ,1 + ,92 + ,1276 + ,117156 + ,50 + ,394 + ,56 + ,2 + ,103 + ,1190 + ,157787 + ,95 + ,320 + ,40 + ,2 + ,82 + ,745 + ,81293 + ,32 + ,212 + ,49 + ,1 + ,106 + ,2330 + ,237435 + ,101 + ,772 + ,121 + ,0 + ,96 + ,2289 + ,233155 + ,89 + ,740 + ,113 + ,1 + ,124 + ,2639 + ,160344 + ,59 + ,938 + ,172 + ,8 + ,97 + ,658 + ,48188 + ,28 + ,205 + ,37 + ,0 + ,82 + ,1917 + ,161922 + ,69 + ,492 + ,51 + ,0 + ,79 + ,2557 + ,307432 + ,74 + ,818 + ,89 + ,0 + ,97 + ,2026 + ,235223 + ,79 + ,680 + ,73 + ,0 + ,107 + ,1911 + ,195583 + ,59 + ,691 + ,49 + ,1 + ,126 + ,1716 + ,146061 + ,56 + ,534 + ,74 + ,8 + ,40 + ,1852 + ,208834 + ,67 + ,487 + ,58 + ,0 + ,96 + ,981 + ,93764 + ,24 + ,301 + ,72 + ,1 + ,100 + ,1177 + ,151985 + ,66 + ,421 + ,32 + ,0 + ,91 + ,2833 + ,193222 + ,96 + ,947 + ,59 + ,10 + ,136 + ,1688 + ,148922 + ,60 + ,492 + ,70 + ,6 + ,124 + ,2097 + ,132856 + ,80 + ,790 + ,85 + ,0 + ,79 + ,1331 + ,129561 + ,61 + ,362 + ,87 + ,11 + ,74 + ,1244 + ,112718 + ,37 + ,430 + ,48 + ,3 + ,96 + ,1256 + ,160930 + ,35 + ,416 + ,56 + ,0 + ,97 + ,1294 + ,99184 + ,41 + ,409 + ,41 + ,0 + ,122 + ,2303 + ,192535 + ,70 + ,498 + ,86 + ,8 + ,144 + ,2897 + ,138708 + ,65 + ,887 + ,152 + ,2 + ,90 + ,1103 + ,114408 + ,38 + ,267 + ,48 + ,0 + ,93 + ,340 + ,31970 + ,15 + ,101 + ,40 + ,0 + ,78 + ,2791 + ,225558 + ,112 + ,1000 + ,135 + ,3 + ,72 + ,1338 + ,139220 + ,72 + ,416 + ,83 + ,1 + ,45 + ,1441 + ,113612 + ,68 + ,480 + ,62 + ,2 + ,120 + ,1623 + ,108641 + ,71 + ,454 + ,91 + ,1 + ,59 + ,2650 + ,162203 + ,67 + ,671 + ,91 + ,0 + ,133 + ,1499 + ,100098 + ,44 + ,413 + ,82 + ,2 + ,117 + ,2302 + ,174768 + ,60 + ,677 + ,112 + ,1 + ,123 + ,2540 + ,158459 + ,97 + ,820 + ,69 + ,0 + ,110 + ,1000 + ,80934 + ,30 + ,316 + ,78 + ,0 + ,75 + ,1234 + ,84971 + ,71 + ,395 + ,105 + ,0 + ,114 + ,927 + ,80545 + ,68 + ,217 + ,49 + ,0 + ,94 + ,2176 + ,287191 + ,64 + ,818 + ,60 + ,0 + ,116 + ,957 + ,62974 + ,28 + ,292 + ,49 + ,1 + ,86 + ,1551 + ,134091 + ,40 + ,513 + ,132 + ,0 + ,90 + ,1014 + ,75555 + ,46 + ,345 + ,49 + ,0 + ,87 + ,1771 + ,162154 + ,54 + ,557 + ,71 + ,0 + ,99 + ,2613 + ,226638 + ,227 + ,645 + ,100 + ,0 + ,132 + ,1205 + ,115367 + ,112 + ,284 + ,74 + ,0 + ,96 + ,1337 + ,108749 + ,62 + ,424 + ,49 + ,7 + ,91 + ,1524 + ,155537 + ,52 + ,614 + ,72 + ,0 + ,77 + ,1829 + ,153133 + ,41 + ,672 + ,59 + ,5 + ,104 + ,2229 + ,165618 + ,78 + ,649 + ,90 + ,1 + ,97 + ,1233 + ,151517 + ,57 + ,415 + ,68 + ,0 + ,94 + ,1365 + ,133686 + ,58 + ,505 + ,81 + ,0 + ,60 + ,950 + ,61342 + ,40 + ,387 + ,33 + ,0 + ,46 + ,2319 + ,245196 + ,117 + ,730 + ,166 + ,0 + ,135 + ,1857 + ,195576 + ,70 + ,563 + ,94 + ,0 + ,90 + ,223 + ,19349 + ,12 + ,67 + ,15 + ,0 + ,2 + ,2390 + ,225371 + ,105 + ,812 + ,104 + ,3 + ,96 + ,1985 + ,153213 + ,78 + ,811 + ,61 + ,0 + ,109 + ,700 + ,59117 + ,29 + ,281 + ,11 + ,0 + ,15 + ,1062 + ,91762 + ,24 + ,338 + ,45 + ,0 + ,68 + ,1311 + ,136769 + ,54 + ,413 + ,84 + ,0 + ,88 + ,1157 + ,114798 + ,61 + ,298 + ,66 + ,1 + ,84 + ,823 + ,85338 + ,40 + ,223 + ,27 + ,1 + ,46 + ,596 + ,27676 + ,22 + ,194 + ,59 + ,0 + ,59 + ,1545 + ,153535 + ,48 + ,371 + ,127 + ,0 + ,116 + ,1130 + ,122417 + ,37 + ,268 + ,48 + ,0 + ,29 + ,0 + ,0 + ,0 + ,0 + ,0 + ,0 + ,0 + ,1082 + ,91529 + ,32 + ,332 + ,58 + ,0 + ,91 + ,1135 + ,107205 + ,67 + ,371 + ,57 + ,0 + ,76 + ,1367 + ,144664 + ,45 + ,465 + ,59 + ,0 + ,83 + ,1506 + ,146445 + ,63 + ,447 + ,76 + ,1 + ,84 + ,870 + ,76656 + ,60 + ,295 + ,71 + ,0 + ,65 + ,78 + ,3616 + ,5 + ,14 + ,5 + ,0 + ,0 + ,0 + ,0 + ,0 + ,0 + ,0 + ,0 + ,0 + ,1130 + ,183088 + ,44 + ,388 + ,70 + ,0 + ,84 + ,1582 + ,144677 + ,84 + ,564 + ,76 + ,0 + ,114 + ,2034 + ,159104 + ,98 + ,562 + ,122 + ,2 + ,124 + ,919 + ,113273 + ,38 + ,288 + ,56 + ,0 + ,92 + ,778 + ,43410 + ,19 + ,292 + ,63 + ,0 + ,3 + ,1752 + ,175774 + ,73 + ,530 + ,92 + ,1 + ,109 + ,957 + ,95401 + ,42 + ,256 + ,54 + ,0 + ,74 + ,2098 + ,134837 + ,55 + ,602 + ,64 + ,8 + ,121 + ,731 + ,60493 + ,40 + ,174 + ,29 + ,3 + ,48 + ,285 + ,19764 + ,12 + ,75 + ,19 + ,1 + ,8 + ,1834 + ,164062 + ,56 + ,565 + ,64 + ,3 + ,80 + ,1148 + ,132696 + ,33 + ,377 + ,79 + ,0 + ,107 + ,1646 + ,155367 + ,54 + ,544 + ,97 + ,0 + ,116 + ,256 + ,11796 + ,9 + ,79 + ,22 + ,0 + ,8 + ,98 + ,10674 + ,9 + ,33 + ,7 + ,0 + ,0 + ,1404 + ,142261 + ,57 + ,479 + ,37 + ,0 + ,56 + ,41 + ,6836 + ,3 + ,11 + ,5 + ,0 + ,4 + ,1824 + ,162563 + ,63 + ,626 + ,48 + ,6 + ,70 + ,42 + ,5118 + ,3 + ,6 + ,1 + ,0 + ,0 + ,528 + ,40248 + ,16 + ,183 + ,34 + ,1 + ,14 + ,0 + ,0 + ,0 + ,0 + ,0 + ,0 + ,0 + ,1073 + ,122641 + ,47 + ,334 + ,49 + ,0 + ,91 + ,1305 + ,88837 + ,38 + ,269 + ,44 + ,0 + ,89 + ,81 + ,7131 + ,4 + ,27 + ,0 + ,1 + ,0 + ,261 + ,9056 + ,14 + ,99 + ,18 + ,0 + ,12 + ,934 + ,76611 + ,24 + ,260 + ,48 + ,1 + ,60 + ,1180 + ,132697 + ,51 + ,290 + ,54 + ,0 + ,80 + ,1147 + ,100681 + ,19 + ,414 + ,50 + ,1 + ,88) + ,dim=c(7 + ,144) + ,dimnames=list(c('page_views' + ,'time_spent_seconds' + ,'number_logins' + ,'number_course_compenium_views' + ,'number_compendium_views' + ,'number_compediums_shared' + ,'number_feedbackmessage_PR') + ,1:144)) > y <- array(NA,dim=c(7,144),dimnames=list(c('page_views','time_spent_seconds','number_logins','number_course_compenium_views','number_compendium_views','number_compediums_shared','number_feedbackmessage_PR'),1:144)) > for (i in 1:dim(x)[1]) + { + for (j in 1:dim(x)[2]) + { + y[i,j] <- as.numeric(x[i,j]) + } + } > par4 = 'no' > par3 = '' > par2 = 'none' > par1 = '2' > #'GNU S' R Code compiled by R2WASP v. 1.0.44 () > #Author: Dr. Ian E. Holliday > #To cite this work: Ian E. Holliday, 2009, YOUR SOFTWARE TITLE (vNUMBER) in Free Statistics Software (v$_version), Office for Research Development and Education, URL http://www.wessa.net/rwasp_YOURPAGE.wasp/ > #Source of accompanying publication: > #Technical description: > library(party) Loading required package: survival Loading required package: splines Loading required package: grid Loading required package: modeltools Loading required package: stats4 Loading required package: coin Loading required package: mvtnorm Loading required package: zoo Loading required package: sandwich Loading required package: strucchange Loading required package: vcd Loading required package: MASS Loading required package: colorspace > library(Hmisc) Attaching package: 'Hmisc' The following object(s) are masked from 'package:survival': untangle.specials The following object(s) are masked from 'package:base': format.pval, round.POSIXt, trunc.POSIXt, units > par1 <- as.numeric(par1) > par3 <- as.numeric(par3) > x <- data.frame(t(y)) > is.data.frame(x) [1] TRUE > x <- x[!is.na(x[,par1]),] > k <- length(x[1,]) > n <- length(x[,1]) > colnames(x)[par1] [1] "time_spent_seconds" > x[,par1] [1] 159261 189672 7215 129098 230632 515038 180745 185559 154581 298001 [11] 121844 184039 100324 220269 168265 154647 142018 79030 167047 27997 [21] 73019 241082 195820 142001 145433 183744 202357 199532 354924 192399 [31] 182286 181590 133801 233686 219428 0 223044 100129 145864 249965 [41] 242379 145794 96404 195891 117156 157787 81293 237435 233155 160344 [51] 48188 161922 307432 235223 195583 146061 208834 93764 151985 193222 [61] 148922 132856 129561 112718 160930 99184 192535 138708 114408 31970 [71] 225558 139220 113612 108641 162203 100098 174768 158459 80934 84971 [81] 80545 287191 62974 134091 75555 162154 226638 115367 108749 155537 [91] 153133 165618 151517 133686 61342 245196 195576 19349 225371 153213 [101] 59117 91762 136769 114798 85338 27676 153535 122417 0 91529 [111] 107205 144664 146445 76656 3616 0 183088 144677 159104 113273 [121] 43410 175774 95401 134837 60493 19764 164062 132696 155367 11796 [131] 10674 142261 6836 162563 5118 40248 0 122641 88837 7131 [141] 9056 76611 132697 100681 > 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]) 0 3616 5118 6836 7131 7215 9056 10674 11796 19349 19764 4 1 1 1 1 1 1 1 1 1 1 27676 27997 31970 40248 43410 48188 59117 60493 61342 62974 73019 1 1 1 1 1 1 1 1 1 1 1 75555 76611 76656 79030 80545 80934 81293 84971 85338 88837 91529 1 1 1 1 1 1 1 1 1 1 1 91762 93764 95401 96404 99184 100098 100129 100324 100681 107205 108641 1 1 1 1 1 1 1 1 1 1 1 108749 112718 113273 113612 114408 114798 115367 117156 121844 122417 122641 1 1 1 1 1 1 1 1 1 1 1 129098 129561 132696 132697 132856 133686 133801 134091 134837 136769 138708 1 1 1 1 1 1 1 1 1 1 1 139220 142001 142018 142261 144664 144677 145433 145794 145864 146061 146445 1 1 1 1 1 1 1 1 1 1 1 148922 151517 151985 153133 153213 153535 154581 154647 155367 155537 157787 1 1 1 1 1 1 1 1 1 1 1 158459 159104 159261 160344 160930 161922 162154 162203 162563 164062 165618 1 1 1 1 1 1 1 1 1 1 1 167047 168265 174768 175774 180745 181590 182286 183088 183744 184039 185559 1 1 1 1 1 1 1 1 1 1 1 189672 192399 192535 193222 195576 195583 195820 195891 199532 202357 208834 1 1 1 1 1 1 1 1 1 1 1 219428 220269 223044 225371 225558 226638 230632 233155 233686 235223 237435 1 1 1 1 1 1 1 1 1 1 1 241082 242379 245196 249965 287191 298001 307432 354924 515038 1 1 1 1 1 1 1 1 1 > colnames(x) [1] "page_views" "time_spent_seconds" [3] "number_logins" "number_course_compenium_views" [5] "number_compendium_views" "number_compediums_shared" [7] "number_feedbackmessage_PR" > colnames(x)[par1] [1] "time_spent_seconds" > x[,par1] [1] 159261 189672 7215 129098 230632 515038 180745 185559 154581 298001 [11] 121844 184039 100324 220269 168265 154647 142018 79030 167047 27997 [21] 73019 241082 195820 142001 145433 183744 202357 199532 354924 192399 [31] 182286 181590 133801 233686 219428 0 223044 100129 145864 249965 [41] 242379 145794 96404 195891 117156 157787 81293 237435 233155 160344 [51] 48188 161922 307432 235223 195583 146061 208834 93764 151985 193222 [61] 148922 132856 129561 112718 160930 99184 192535 138708 114408 31970 [71] 225558 139220 113612 108641 162203 100098 174768 158459 80934 84971 [81] 80545 287191 62974 134091 75555 162154 226638 115367 108749 155537 [91] 153133 165618 151517 133686 61342 245196 195576 19349 225371 153213 [101] 59117 91762 136769 114798 85338 27676 153535 122417 0 91529 [111] 107205 144664 146445 76656 3616 0 183088 144677 159104 113273 [121] 43410 175774 95401 134837 60493 19764 164062 132696 155367 11796 [131] 10674 142261 6836 162563 5118 40248 0 122641 88837 7131 [141] 9056 76611 132697 100681 > if (par2 == 'none') { + m <- ctree(as.formula(paste(colnames(x)[par1],' ~ .',sep='')),data = x) + } > > #Note: the /var/wessaorg/rcomp/createtable file can be downloaded at http://www.wessa.net/cretab > load(file="/var/wessaorg/rcomp/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="/var/wessaorg/rcomp/tmp/1dtmf1324640759.tab") + } + } > m Conditional inference tree with 8 terminal nodes Response: time_spent_seconds Inputs: page_views, number_logins, number_course_compenium_views, number_compendium_views, number_compediums_shared, number_feedbackmessage_PR Number of observations: 144 1) page_views <= 1082; criterion = 1, statistic = 113.587 2) page_views <= 726; criterion = 1, statistic = 33.107 3) number_course_compenium_views <= 79; criterion = 1, statistic = 16.153 4)* weights = 13 3) number_course_compenium_views > 79 5)* weights = 7 2) page_views > 726 6)* weights = 19 1) page_views > 1082 7) page_views <= 2098; criterion = 1, statistic = 63.056 8) page_views <= 1365; criterion = 1, statistic = 17.348 9)* weights = 24 8) page_views > 1365 10)* weights = 46 7) page_views > 2098 11) number_course_compenium_views <= 723; criterion = 1, statistic = 17.482 12)* weights = 10 11) number_course_compenium_views > 723 13) number_logins <= 105; criterion = 0.997, statistic = 12.364 14)* weights = 18 13) number_logins > 105 15)* weights = 7 > postscript(file="/var/wessaorg/rcomp/tmp/2j5nr1324640759.ps",horizontal=F,onefile=F,pagecentre=F,paper="special",width=8.3333333333333,height=5.5555555555556) > plot(m) > dev.off() null device 1 > postscript(file="/var/wessaorg/rcomp/tmp/3zeov1324640759.ps",horizontal=F,onefile=F,pagecentre=F,paper="special",width=8.3333333333333,height=5.5555555555556) > plot(x[,par1] ~ as.factor(where(m)),main='Response by Terminal Node',xlab='Terminal Node',ylab='Response') > dev.off() null device 1 > 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) + } Actuals Forecasts Residuals 1 159261 158311.870 949.13043 2 189672 158311.870 31360.13043 3 7215 7038.385 176.61538 4 129098 165656.500 -36558.50000 5 230632 289329.000 -58697.00000 6 515038 289329.000 225709.00000 7 180745 158311.870 22433.13043 8 185559 158311.870 27247.13043 9 154581 158311.870 -3730.86957 10 298001 220586.278 77414.72222 11 121844 158311.870 -36467.86957 12 184039 165656.500 18382.50000 13 100324 158311.870 -57987.86957 14 220269 289329.000 -69060.00000 15 168265 158311.870 9953.13043 16 154647 158311.870 -3664.86957 17 142018 158311.870 -16293.86957 18 79030 123977.375 -44947.37500 19 167047 220586.278 -53539.27778 20 27997 34893.143 -6896.14286 21 73019 82260.211 -9241.21053 22 241082 220586.278 20495.72222 23 195820 158311.870 37508.13043 24 142001 165656.500 -23655.50000 25 145433 158311.870 -12878.86957 26 183744 158311.870 25432.13043 27 202357 158311.870 44045.13043 28 199532 158311.870 41220.13043 29 354924 289329.000 65595.00000 30 192399 220586.278 -28187.27778 31 182286 158311.870 23974.13043 32 181590 158311.870 23278.13043 33 133801 165656.500 -31855.50000 34 233686 289329.000 -55643.00000 35 219428 220586.278 -1158.27778 36 0 7038.385 -7038.38462 37 223044 220586.278 2457.72222 38 100129 158311.870 -58182.86957 39 145864 165656.500 -19792.50000 40 249965 220586.278 29378.72222 41 242379 220586.278 21792.72222 42 145794 158311.870 -12517.86957 43 96404 82260.211 14143.78947 44 195891 220586.278 -24695.27778 45 117156 123977.375 -6821.37500 46 157787 123977.375 33809.62500 47 81293 82260.211 -967.21053 48 237435 220586.278 16848.72222 49 233155 220586.278 12568.72222 50 160344 220586.278 -60242.27778 51 48188 34893.143 13294.85714 52 161922 158311.870 3610.13043 53 307432 220586.278 86845.72222 54 235223 158311.870 76911.13043 55 195583 158311.870 37271.13043 56 146061 158311.870 -12250.86957 57 208834 158311.870 50522.13043 58 93764 82260.211 11503.78947 59 151985 123977.375 28007.62500 60 193222 220586.278 -27364.27778 61 148922 158311.870 -9389.86957 62 132856 158311.870 -25455.86957 63 129561 123977.375 5583.62500 64 112718 123977.375 -11259.37500 65 160930 123977.375 36952.62500 66 99184 123977.375 -24793.37500 67 192535 165656.500 26878.50000 68 138708 220586.278 -81878.27778 69 114408 123977.375 -9569.37500 70 31970 34893.143 -2923.14286 71 225558 289329.000 -63771.00000 72 139220 123977.375 15242.62500 73 113612 158311.870 -44699.86957 74 108641 158311.870 -49670.86957 75 162203 165656.500 -3453.50000 76 100098 158311.870 -58213.86957 77 174768 165656.500 9111.50000 78 158459 220586.278 -62127.27778 79 80934 82260.211 -1326.21053 80 84971 123977.375 -39006.37500 81 80545 82260.211 -1715.21053 82 287191 220586.278 66604.72222 83 62974 82260.211 -19286.21053 84 134091 158311.870 -24220.86957 85 75555 82260.211 -6705.21053 86 162154 158311.870 3842.13043 87 226638 165656.500 60981.50000 88 115367 123977.375 -8610.37500 89 108749 123977.375 -15228.37500 90 155537 158311.870 -2774.86957 91 153133 158311.870 -5178.86957 92 165618 165656.500 -38.50000 93 151517 123977.375 27539.62500 94 133686 123977.375 9708.62500 95 61342 82260.211 -20918.21053 96 245196 289329.000 -44133.00000 97 195576 158311.870 37264.13043 98 19349 7038.385 12310.61538 99 225371 220586.278 4784.72222 100 153213 158311.870 -5098.86957 101 59117 34893.143 24223.85714 102 91762 82260.211 9501.78947 103 136769 123977.375 12791.62500 104 114798 123977.375 -9179.37500 105 85338 82260.211 3077.78947 106 27676 34893.143 -7217.14286 107 153535 158311.870 -4776.86957 108 122417 123977.375 -1560.37500 109 0 7038.385 -7038.38462 110 91529 82260.211 9268.78947 111 107205 123977.375 -16772.37500 112 144664 158311.870 -13647.86957 113 146445 158311.870 -11866.86957 114 76656 82260.211 -5604.21053 115 3616 7038.385 -3422.38462 116 0 7038.385 -7038.38462 117 183088 123977.375 59110.62500 118 144677 158311.870 -13634.86957 119 159104 158311.870 792.13043 120 113273 82260.211 31012.78947 121 43410 82260.211 -38850.21053 122 175774 158311.870 17462.13043 123 95401 82260.211 13140.78947 124 134837 158311.870 -23474.86957 125 60493 82260.211 -21767.21053 126 19764 7038.385 12725.61538 127 164062 158311.870 5750.13043 128 132696 123977.375 8718.62500 129 155367 158311.870 -2944.86957 130 11796 7038.385 4757.61538 131 10674 7038.385 3635.61538 132 142261 158311.870 -16050.86957 133 6836 7038.385 -202.38462 134 162563 158311.870 4251.13043 135 5118 7038.385 -1920.38462 136 40248 34893.143 5354.85714 137 0 7038.385 -7038.38462 138 122641 82260.211 40380.78947 139 88837 123977.375 -35140.37500 140 7131 7038.385 92.61538 141 9056 34893.143 -25837.14286 142 76611 82260.211 -5649.21053 143 132697 123977.375 8719.62500 144 100681 123977.375 -23296.37500 > if (par2 != 'none') { + print(cbind(as.factor(x[,par1]),predict(m))) + myt <- table(as.factor(x[,par1]),predict(m)) + print(myt) + } > postscript(file="/var/wessaorg/rcomp/tmp/431jc1324640759.ps",horizontal=F,onefile=F,pagecentre=F,paper="special",width=8.3333333333333,height=5.5555555555556) > 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() null device 1 > 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="/var/wessaorg/rcomp/tmp/55oyv1324640759.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="/var/wessaorg/rcomp/tmp/6jsp01324640759.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="/var/wessaorg/rcomp/tmp/7ha4h1324640759.tab") + } > > try(system("convert tmp/2j5nr1324640759.ps tmp/2j5nr1324640759.png",intern=TRUE)) character(0) > try(system("convert tmp/3zeov1324640759.ps tmp/3zeov1324640759.png",intern=TRUE)) character(0) > try(system("convert tmp/431jc1324640759.ps tmp/431jc1324640759.png",intern=TRUE)) character(0) > > > proc.time() user system elapsed 3.559 0.383 3.961