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. > par9 = 'Learning Activities' > par8 = 'Learning Activities' > par7 = 'all' > par6 = 'all' > par5 = 'all' > par4 = 'no' > par3 = '3' > par2 = 'none' > par1 = '0' > par9 <- 'Learning Activities' > par8 <- 'Learning Activities' > par7 <- 'all' > par6 <- 'all' > par5 <- 'all' > par4 <- 'no' > par3 <- '3' > par2 <- 'none' > par1 <- '0' > #'GNU S' R Code compiled by R2WASP v. 1.2.291 () > #Author: root > #To cite this work: Wessa P., 2012, Recursive Partitioning (Regression Trees) in Information Management (v1.0.8) in Free Statistics Software (v$_version), Office for Research Development and Education, URL http://www.wessa.net/rwasp_regression_trees.wasp/ > #Source of accompanying publication: > # > 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 <- as.data.frame(read.table(file='http://www.wessa.net/download/utaut.csv',sep=',',header=T)) > x$U25 <- 6-x$U25 > if(par5 == 'female') x <- x[x$Gender==0,] > if(par5 == 'male') x <- x[x$Gender==1,] > if(par6 == 'prep') x <- x[x$Pop==1,] > if(par6 == 'bachelor') x <- x[x$Pop==0,] > if(par7 != 'all') { + x <- x[x$Year==as.numeric(par7),] + } > cAc <- with(x,cbind( A1, A2, A3, A4, A5, A6, A7, A8, A9,A10)) > cAs <- with(x,cbind(A11,A12,A13,A14,A15,A16,A17,A18,A19,A20)) > cA <- cbind(cAc,cAs) > cCa <- with(x,cbind(C1,C3,C5,C7, C9,C11,C13,C15,C17,C19,C21,C23,C25,C27,C29,C31,C33,C35,C37,C39,C41,C43,C45,C47)) > cCp <- with(x,cbind(C2,C4,C6,C8,C10,C12,C14,C16,C18,C20,C22,C24,C26,C28,C30,C32,C34,C36,C38,C40,C42,C44,C46,C48)) > cC <- cbind(cCa,cCp) > cU <- with(x,cbind(U1,U2,U3,U4,U5,U6,U7,U8,U9,U10,U11,U12,U13,U14,U15,U16,U17,U18,U19,U20,U21,U22,U23,U24,U25,U26,U27,U28,U29,U30,U31,U32,U33)) > cE <- with(x,cbind(BC,NNZFG,MRT,AFL,LPM,LPC,W,WPA)) > cX <- with(x,cbind(X1,X2,X3,X4,X5,X6,X7,X8,X9,X10,X11,X12,X13,X14,X15,X16,X17,X18)) > if (par8=='ATTLES connected') x <- cAc > if (par8=='ATTLES separate') x <- cAs > if (par8=='ATTLES all') x <- cA > if (par8=='COLLES actuals') x <- cCa > if (par8=='COLLES preferred') x <- cCp > if (par8=='COLLES all') x <- cC > if (par8=='CSUQ') x <- cU > if (par8=='Learning Activities') x <- cE > if (par8=='Exam Items') x <- cX > if (par9=='ATTLES connected') y <- cAc > if (par9=='ATTLES separate') y <- cAs > if (par9=='ATTLES all') y <- cA > if (par9=='COLLES actuals') y <- cCa > if (par9=='COLLES preferred') y <- cCp > if (par9=='COLLES all') y <- cC > if (par9=='CSUQ') y <- cU > if (par9=='Learning Activities') y <- cE > if (par9=='Exam Items') y <- cX > if (par1==0) { + nr <- length(y[,1]) + nc <- length(y[1,]) + mysum <- array(0,dim=nr) + for(jjj in 1:nr) { + for(iii in 1:nc) { + mysum[jjj] = mysum[jjj] + y[jjj,iii] + } + } + y <- mysum + } else { + y <- y[,par1] + } > nx <- cbind(y,x) > colnames(nx) <- c('endo',colnames(x)) > x <- nx > par1=1 > ncol <- length(x[1,]) > for (jjj in 1:ncol) { + x <- x[!is.na(x[,jjj]),] + } > x <- as.data.frame(x) > k <- length(x[1,]) > n <- length(x[,1]) > colnames(x)[par1] [1] "endo" > x[,par1] [1] 12999.880 10628.070 11850.330 11657.030 9399.620 10206.050 8807.340 [8] 10195.340 9859.710 14035.060 7098.607 9098.800 8801.080 7366.237 [15] 12238.720 10065.460 7322.397 10073.380 7790.850 8967.410 10365.693 [22] 9269.420 13775.440 10297.370 8914.530 10481.360 12143.460 13140.560 [29] 13116.600 13269.690 10017.990 13943.580 12220.800 12925.830 7725.800 [36] 6719.810 13210.440 11290.560 15979.320 13148.720 12586.250 10571.643 [43] 9113.650 9459.963 9283.790 12962.260 6876.910 8625.920 12195.040 [50] 11199.900 13065.010 9125.103 8878.800 11981.920 13099.810 11012.170 [57] 12544.580 7462.030 12684.490 13609.250 9328.750 13535.140 8075.940 [64] 8530.760 12707.700 13289.540 3369.090 8611.970 13032.800 13561.740 [71] 10938.210 8556.140 6828.130 8162.550 9266.210 11010.320 9939.793 [78] 9455.210 9068.050 8418.690 10601.950 14218.250 9099.520 9548.620 [85] 9731.540 11031.500 10263.750 13712.330 13481.510 7375.380 8474.090 [92] 12258.490 10880.460 8426.290 9359.200 6566.420 5612.460 9902.150 [99] 13675.210 10124.610 9109.930 9922.730 6490.870 7402.250 14693.640 [106] 8364.270 10816.900 9453.040 9150.960 6392.320 7995.490 6378.650 [113] 8154.580 10001.770 9927.420 7749.290 8335.400 8633.020 9496.430 [120] 8705.190 5485.090 12899.680 8853.410 9319.500 9648.480 15259.560 [127] 7341.850 10623.540 11224.000 8495.300 11227.390 8649.580 10651.680 [134] 12959.450 10425.980 8437.090 6704.730 7365.200 9735.730 5123.100 [141] 11423.860 8446.730 5970.440 10441.130 8115.670 7707.260 7432.140 [148] 8028.263 8106.133 10489.060 7122.570 6550.880 12247.670 6713.040 [155] 7519.270 5721.450 7941.540 6734.700 9659.920 10472.940 9370.703 [162] 8335.453 8282.810 8756.093 7171.570 4366.980 6905.900 6411.900 [169] 12624.320 8866.343 4046.330 6063.610 7018.630 4520.670 8171.440 [176] 5517.950 9701.810 7045.030 9810.060 7446.070 7954.650 6300.700 [183] 7142.280 7138.500 9202.320 5867.790 4481.130 3540.170 13707.573 [190] 9927.510 12068.390 8741.737 6796.870 9300.490 7095.660 9186.730 [197] 8958.790 5701.560 6940.110 8452.860 13315.123 6301.370 8714.340 [204] 5614.490 10239.780 7072.100 5381.770 7139.600 10010.060 4844.830 [211] 9678.670 7982.600 10139.580 9533.680 9268.450 5769.620 5108.870 [218] 8956.813 8350.200 13201.790 5350.280 9521.070 6015.800 7660.520 [225] 7290.230 9404.760 6740.520 9303.930 11055.210 10406.840 6996.910 [232] 9820.990 6239.870 6184.580 7473.557 6982.560 11568.240 6696.290 [239] 8569.547 6068.490 11914.480 6086.440 9784.520 7368.020 8711.650 [246] 12749.660 5384.010 11344.700 7038.440 7137.820 8736.020 7297.280 [253] 12375.840 7294.080 9876.430 8047.740 9801.260 13022.310 11924.240 [260] 9815.300 13083.540 8057.830 6213.800 9314.640 11078.190 8829.977 [267] 9024.670 6959.310 9545.510 8963.523 4868.320 9288.220 8351.320 [274] 8579.560 8439.600 6591.210 6619.700 5469.090 8972.963 6410.880 [281] 8098.200 13804.410 7377.957 7727.837 6317.420 8735.850 13327.653 [288] 12560.830 6746.340 11056.590 9605.040 9115.560 8805.950 12362.590 [295] 9692.110 7445.250 10211.750 18789.550 11412.210 12557.850 13530.690 [302] 9906.740 9958.710 14131.190 10637.980 9859.070 14214.230 11619.050 [309] 2559.370 33644.960 10267.250 11146.330 11351.470 18802.430 5241.000 [316] 13003.970 18688.750 17945.880 10657.040 16213.120 9462.530 7472.780 [323] 7199.960 12839.240 6908.180 9877.230 10827.250 7794.090 9646.540 [330] 7485.870 13290.130 6696.470 18584.870 9530.230 18205.970 6135.080 [337] 393.120 4551.830 7490.620 29.000 13299.300 12630.980 10972.350 [344] 11.000 17193.020 13588.910 13512.240 17165.860 10009.170 6195.690 [351] 8309.260 24073.530 8792.230 7659.050 13109.340 13021.660 6454.770 [358] 6618.490 11773.480 32946.360 18620.940 10339.720 7921.970 11123.140 [365] 10573.350 12378.910 1455.680 11423.970 8271.050 12710.270 7217.300 [372] 11346.250 14125.540 9564.640 16131.850 6925.630 6136.460 7767.910 [379] 13043.980 12884.310 18401.780 17015.070 12370.820 9622.880 8248.460 [386] 11913.110 11662.120 25701.670 7601.090 11351.180 10341.690 12510.820 [393] 22073.740 10929.100 11205.420 16889.560 11089.440 12054.640 19061.320 [400] 13629.670 11753.200 7570.850 11334.080 12604.630 11378.530 7912.750 [407] 11526.610 9656.560 18940.150 6899.680 9994.280 8914.540 6238.010 [414] 0.000 12121.610 16230.960 10035.410 8083.750 9688.360 13803.760 [421] 18126.890 10129.260 13696.760 7444.320 14591.690 474.170 8870.340 [428] 9752.650 6179.840 7963.970 7683.230 10226.020 7141.960 0.000 [435] 17394.270 14159.910 8975.820 9635.520 7360.020 10485.310 9096.530 [442] 13043.260 17338.590 8228.390 7967.820 11613.870 11392.940 14565.620 [449] 6399.880 8761.830 7894.850 8315.490 4324.310 15474.530 15740.780 [456] 8821.300 9649.980 12950.090 11025.410 9762.970 10007.320 13029.740 [463] 14456.690 312.320 8000.230 12871.940 12670.050 10142.820 10443.820 [470] 7380.800 10070.770 12364.370 7685.110 16068.910 13917.620 11407.430 [477] 4260.960 4263.650 8652.820 9808.160 503.930 6106.860 9756.570 [484] 17509.510 7451.380 8114.970 8409.370 7559.880 9480.000 9447.650 [491] 17281.480 10012.880 14942.560 5679.410 10118.750 9826.740 11758.490 [498] 9503.110 3928.270 9389.230 20683.240 6783.190 2078.300 8665.670 [505] 5959.400 4008.600 14167.730 11099.220 12040.950 7242.240 19323.430 [512] 362.340 4380.050 14235.200 5643.240 8379.810 3626.590 14639.780 [519] 8517.400 906.040 4100.630 14625.770 6894.780 7148.200 12805.950 [526] 5945.520 7642.430 8562.890 8514.390 19226.290 5641.340 8592.500 [533] 13820.830 13625.030 8005.460 15285.880 10996.040 8228.670 7955.020 [540] 7690.870 0.000 8254.530 15101.560 7861.300 13953.020 13104.850 [547] 5915.810 5504.230 402.040 10692.690 6631.440 9730.570 12431.050 [554] 8687.310 1943.900 10350.380 8117.730 7404.660 > 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 11 29 312.32 3 1 1 1 362.34 393.12 402.04 474.17 1 1 1 1 503.93 906.04 1455.68 1943.9 1 1 1 1 2078.3 2559.37 3369.09 3540.17 1 1 1 1 3626.59 3928.27 4008.6 4046.33 1 1 1 1 4100.63 4260.96 4263.65 4324.31 1 1 1 1 4366.98 4380.05 4481.13 4520.67 1 1 1 1 4551.83 4844.83 4868.32 5108.87 1 1 1 1 5123.1 5241 5350.28 5381.77 1 1 1 1 5384.01 5469.09 5485.09 5504.23 1 1 1 1 5517.95 5612.46 5614.49 5641.34 1 1 1 1 5643.24 5679.41 5701.56 5721.45 1 1 1 1 5769.62 5867.79 5915.81 5945.52 1 1 1 1 5959.4 5970.44 6015.8 6063.61 1 1 1 1 6068.49 6086.44 6106.86 6135.08 1 1 1 1 6136.46 6179.84 6184.58 6195.69 1 1 1 1 6213.8 6238.01 6239.87 6300.7 1 1 1 1 6301.37 6317.42 6378.65 6392.32 1 1 1 1 6399.88 6410.88 6411.9 6454.77 1 1 1 1 6490.87 6550.88 6566.42 6591.21 1 1 1 1 6618.49 6619.7 6631.44 6696.29 1 1 1 1 6696.47 6704.73 6713.04 6719.81 1 1 1 1 6734.7 6740.52 6746.34 6783.19 1 1 1 1 6796.87 6828.13 6876.91 6894.78 1 1 1 1 6899.68 6905.9 6908.18 6925.63 1 1 1 1 6940.11 6959.31 6982.56 6996.91 1 1 1 1 7018.63 7038.44 7045.03 7072.1 1 1 1 1 7095.66 7098.6066666667 7122.57 7137.82 1 1 1 1 7138.5 7139.6 7141.96 7142.28 1 1 1 1 7148.2 7171.57 7199.96 7217.3 1 1 1 1 7242.24 7290.23 7294.08 7297.28 1 1 1 1 7322.3966666667 7341.85 7360.02 7365.2 1 1 1 1 7366.2366666667 7368.02 7375.38 7377.9566666667 1 1 1 1 7380.8 7402.25 7404.66 7432.14 1 1 1 1 7444.32 7445.25 7446.07 7451.38 1 1 1 1 7462.03 7472.78 7473.5566666667 7485.87 1 1 1 1 7490.62 7519.27 7559.88 7570.85 1 1 1 1 7601.09 7642.43 7659.05 7660.52 1 1 1 1 7683.23 7685.11 7690.87 7707.26 1 1 1 1 7725.8 7727.8366666667 7749.29 7767.91 1 1 1 1 7790.85 7794.09 7861.3 7894.85 1 1 1 1 7912.75 7921.97 7941.54 7954.65 1 1 1 1 7955.02 7963.97 7967.82 7982.6 1 1 1 1 7995.49 8000.23 8005.46 8028.2633333333 1 1 1 1 8047.74 8057.83 8075.94 8083.75 1 1 1 1 8098.2 8106.1333333333 8114.97 8115.67 1 1 1 1 8117.73 8154.58 8162.55 8171.44 1 1 1 1 8228.39 8228.67 8248.46 8254.53 1 1 1 1 8271.05 8282.81 8309.26 8315.49 1 1 1 1 8335.4 8335.4533333333 8350.2 8351.32 1 1 1 1 8364.27 8379.81 8409.37 8418.69 1 1 1 1 8426.29 8437.09 8439.6 8446.73 1 1 1 1 8452.86 8474.09 8495.3 8514.39 1 1 1 1 8517.4 8530.76 8556.14 8562.89 1 1 1 1 8569.5466666667 8579.56 8592.5 8611.97 1 1 1 1 8625.92 8633.02 8649.58 8652.82 1 1 1 1 8665.67 8687.31 8705.19 8711.65 1 1 1 1 8714.34 8735.85 8736.02 8741.7366666667 1 1 1 1 8756.0933333333 8761.83 8792.23 8801.08 1 1 1 1 8805.95 8807.34 8821.3 8829.9766666667 1 1 1 1 8853.41 8866.3433333333 8870.34 8878.8 1 1 1 1 8914.53 8914.54 8956.8133333333 8958.79 1 1 1 1 8963.5233333333 8967.41 8972.9633333333 8975.82 1 1 1 1 9024.67 9068.05 9096.53 9098.8 1 1 1 1 9099.52 9109.93 9113.65 9115.56 1 1 1 1 9125.1033333333 9150.96 9186.73 9202.32 1 1 1 1 9266.21 9268.45 9269.42 9283.79 1 1 1 1 9288.22 9300.49 9303.93 9314.64 1 1 1 1 9319.5 9328.75 9359.2 9370.7033333333 1 1 1 1 9389.23 9399.62 9404.76 9447.65 1 1 1 1 9453.04 9455.21 9459.9633333333 9462.53 1 1 1 1 9480 9496.43 9503.11 9521.07 1 1 1 1 9530.23 9533.68 9545.51 9548.62 1 1 1 1 9564.64 9605.04 9622.88 9635.52 1 1 1 1 9646.54 9648.48 9649.98 9656.56 1 1 1 1 9659.92 9678.67 9688.36 9692.11 1 1 1 1 9701.81 9730.57 9731.54 9735.73 1 1 1 1 9752.65 9756.57 9762.97 9784.52 1 1 1 1 9801.26 9808.16 9810.06 9815.3 1 1 1 1 9820.99 9826.74 9859.07 9859.71 1 1 1 1 9876.43 9877.23 9902.15 9906.74 1 1 1 1 9922.73 9927.42 9927.51 9939.7933333333 1 1 1 1 9958.71 9994.28 10001.77 10007.32 1 1 1 1 10009.17 10010.06 10012.88 10017.99 1 1 1 1 10035.41 10065.46 10070.77 10073.38 1 1 1 1 10118.75 10124.61 10129.26 10139.58 1 1 1 1 10142.82 10195.34 10206.05 10211.75 1 1 1 1 10226.02 10239.78 10263.75 10267.25 1 1 1 1 10297.37 10339.72 10341.69 10350.38 1 1 1 1 10365.6933333333 10406.84 10425.98 10441.13 1 1 1 1 10443.82 10472.94 10481.36 10485.31 1 1 1 1 10489.06 10571.6433333333 10573.35 10601.95 1 1 1 1 10623.54 10628.07 10637.98 10651.68 1 1 1 1 10657.04 10692.69 10816.9 10827.25 1 1 1 1 10880.46 10929.1 10938.21 10972.35 1 1 1 1 10996.04 11010.32 11012.17 11025.41 1 1 1 1 11031.5 11055.21 11056.59 11078.19 1 1 1 1 11089.44 11099.22 11123.14 11146.33 1 1 1 1 11199.9 11205.42 11224 11227.39 1 1 1 1 11290.56 11334.08 11344.7 11346.25 1 1 1 1 11351.18 11351.47 11378.53 11392.94 1 1 1 1 11407.43 11412.21 11423.86 11423.97 1 1 1 1 11526.61 11568.24 11613.87 11619.05 1 1 1 1 11657.03 11662.12 11753.2 11758.49 1 1 1 1 11773.48 11850.33 11913.11 11914.48 1 1 1 1 11924.24 11981.92 12040.95 12054.64 1 1 1 1 12068.39 12121.61 12143.46 12195.04 1 1 1 1 12220.8 12238.72 12247.67 12258.49 1 1 1 1 12362.59 12364.37 12370.82 12375.84 1 1 1 1 12378.91 12431.05 12510.82 12544.58 1 1 1 1 12557.85 12560.83 12586.25 12604.63 1 1 1 1 12624.32 12630.98 12670.05 12684.49 1 1 1 1 12707.7 12710.27 12749.66 12805.95 1 1 1 1 12839.24 12871.94 12884.31 12899.68 1 1 1 1 12925.83 12950.09 12959.45 12962.26 1 1 1 1 12999.88 13003.97 13021.66 13022.31 1 1 1 1 13029.74 13032.8 13043.26 13043.98 1 1 1 1 13065.01 13083.54 13099.81 13104.85 1 1 1 1 13109.34 13116.6 13140.56 13148.72 1 1 1 1 13201.79 13210.44 13269.69 13289.54 1 1 1 1 13290.13 13299.3 13315.1233333333 13327.6533333333 1 1 1 1 13481.51 13512.24 13530.69 13535.14 1 1 1 1 13561.74 13588.91 13609.25 13625.03 1 1 1 1 13629.67 13675.21 13696.76 13707.5733333333 1 1 1 1 13712.33 13775.44 13803.76 13804.41 1 1 1 1 13820.83 13917.62 13943.58 13953.02 1 1 1 1 14035.06 14125.54 14131.19 14159.91 1 1 1 1 14167.73 14214.23 14218.25 14235.2 1 1 1 1 14456.69 14565.62 14591.69 14625.77 1 1 1 1 14639.78 14693.64 14942.56 15101.56 1 1 1 1 15259.56 15285.88 15474.53 15740.78 1 1 1 1 15979.32 16068.91 16131.85 16213.12 1 1 1 1 16230.96 16889.56 17015.07 17165.86 1 1 1 1 17193.02 17281.48 17338.59 17394.27 1 1 1 1 17509.51 17945.88 18126.89 18205.97 1 1 1 1 18401.78 18584.87 18620.94 18688.75 1 1 1 1 18789.55 18802.43 18940.15 19061.32 1 1 1 1 19226.29 19323.43 20683.24 22073.74 1 1 1 1 24073.53 25701.67 32946.36 33644.96 1 1 1 1 > colnames(x) [1] "endo" "BC" "NNZFG" "MRT" "AFL" "LPM" "LPC" "W" "WPA" > colnames(x)[par1] [1] "endo" > x[,par1] [1] 12999.880 10628.070 11850.330 11657.030 9399.620 10206.050 8807.340 [8] 10195.340 9859.710 14035.060 7098.607 9098.800 8801.080 7366.237 [15] 12238.720 10065.460 7322.397 10073.380 7790.850 8967.410 10365.693 [22] 9269.420 13775.440 10297.370 8914.530 10481.360 12143.460 13140.560 [29] 13116.600 13269.690 10017.990 13943.580 12220.800 12925.830 7725.800 [36] 6719.810 13210.440 11290.560 15979.320 13148.720 12586.250 10571.643 [43] 9113.650 9459.963 9283.790 12962.260 6876.910 8625.920 12195.040 [50] 11199.900 13065.010 9125.103 8878.800 11981.920 13099.810 11012.170 [57] 12544.580 7462.030 12684.490 13609.250 9328.750 13535.140 8075.940 [64] 8530.760 12707.700 13289.540 3369.090 8611.970 13032.800 13561.740 [71] 10938.210 8556.140 6828.130 8162.550 9266.210 11010.320 9939.793 [78] 9455.210 9068.050 8418.690 10601.950 14218.250 9099.520 9548.620 [85] 9731.540 11031.500 10263.750 13712.330 13481.510 7375.380 8474.090 [92] 12258.490 10880.460 8426.290 9359.200 6566.420 5612.460 9902.150 [99] 13675.210 10124.610 9109.930 9922.730 6490.870 7402.250 14693.640 [106] 8364.270 10816.900 9453.040 9150.960 6392.320 7995.490 6378.650 [113] 8154.580 10001.770 9927.420 7749.290 8335.400 8633.020 9496.430 [120] 8705.190 5485.090 12899.680 8853.410 9319.500 9648.480 15259.560 [127] 7341.850 10623.540 11224.000 8495.300 11227.390 8649.580 10651.680 [134] 12959.450 10425.980 8437.090 6704.730 7365.200 9735.730 5123.100 [141] 11423.860 8446.730 5970.440 10441.130 8115.670 7707.260 7432.140 [148] 8028.263 8106.133 10489.060 7122.570 6550.880 12247.670 6713.040 [155] 7519.270 5721.450 7941.540 6734.700 9659.920 10472.940 9370.703 [162] 8335.453 8282.810 8756.093 7171.570 4366.980 6905.900 6411.900 [169] 12624.320 8866.343 4046.330 6063.610 7018.630 4520.670 8171.440 [176] 5517.950 9701.810 7045.030 9810.060 7446.070 7954.650 6300.700 [183] 7142.280 7138.500 9202.320 5867.790 4481.130 3540.170 13707.573 [190] 9927.510 12068.390 8741.737 6796.870 9300.490 7095.660 9186.730 [197] 8958.790 5701.560 6940.110 8452.860 13315.123 6301.370 8714.340 [204] 5614.490 10239.780 7072.100 5381.770 7139.600 10010.060 4844.830 [211] 9678.670 7982.600 10139.580 9533.680 9268.450 5769.620 5108.870 [218] 8956.813 8350.200 13201.790 5350.280 9521.070 6015.800 7660.520 [225] 7290.230 9404.760 6740.520 9303.930 11055.210 10406.840 6996.910 [232] 9820.990 6239.870 6184.580 7473.557 6982.560 11568.240 6696.290 [239] 8569.547 6068.490 11914.480 6086.440 9784.520 7368.020 8711.650 [246] 12749.660 5384.010 11344.700 7038.440 7137.820 8736.020 7297.280 [253] 12375.840 7294.080 9876.430 8047.740 9801.260 13022.310 11924.240 [260] 9815.300 13083.540 8057.830 6213.800 9314.640 11078.190 8829.977 [267] 9024.670 6959.310 9545.510 8963.523 4868.320 9288.220 8351.320 [274] 8579.560 8439.600 6591.210 6619.700 5469.090 8972.963 6410.880 [281] 8098.200 13804.410 7377.957 7727.837 6317.420 8735.850 13327.653 [288] 12560.830 6746.340 11056.590 9605.040 9115.560 8805.950 12362.590 [295] 9692.110 7445.250 10211.750 18789.550 11412.210 12557.850 13530.690 [302] 9906.740 9958.710 14131.190 10637.980 9859.070 14214.230 11619.050 [309] 2559.370 33644.960 10267.250 11146.330 11351.470 18802.430 5241.000 [316] 13003.970 18688.750 17945.880 10657.040 16213.120 9462.530 7472.780 [323] 7199.960 12839.240 6908.180 9877.230 10827.250 7794.090 9646.540 [330] 7485.870 13290.130 6696.470 18584.870 9530.230 18205.970 6135.080 [337] 393.120 4551.830 7490.620 29.000 13299.300 12630.980 10972.350 [344] 11.000 17193.020 13588.910 13512.240 17165.860 10009.170 6195.690 [351] 8309.260 24073.530 8792.230 7659.050 13109.340 13021.660 6454.770 [358] 6618.490 11773.480 32946.360 18620.940 10339.720 7921.970 11123.140 [365] 10573.350 12378.910 1455.680 11423.970 8271.050 12710.270 7217.300 [372] 11346.250 14125.540 9564.640 16131.850 6925.630 6136.460 7767.910 [379] 13043.980 12884.310 18401.780 17015.070 12370.820 9622.880 8248.460 [386] 11913.110 11662.120 25701.670 7601.090 11351.180 10341.690 12510.820 [393] 22073.740 10929.100 11205.420 16889.560 11089.440 12054.640 19061.320 [400] 13629.670 11753.200 7570.850 11334.080 12604.630 11378.530 7912.750 [407] 11526.610 9656.560 18940.150 6899.680 9994.280 8914.540 6238.010 [414] 0.000 12121.610 16230.960 10035.410 8083.750 9688.360 13803.760 [421] 18126.890 10129.260 13696.760 7444.320 14591.690 474.170 8870.340 [428] 9752.650 6179.840 7963.970 7683.230 10226.020 7141.960 0.000 [435] 17394.270 14159.910 8975.820 9635.520 7360.020 10485.310 9096.530 [442] 13043.260 17338.590 8228.390 7967.820 11613.870 11392.940 14565.620 [449] 6399.880 8761.830 7894.850 8315.490 4324.310 15474.530 15740.780 [456] 8821.300 9649.980 12950.090 11025.410 9762.970 10007.320 13029.740 [463] 14456.690 312.320 8000.230 12871.940 12670.050 10142.820 10443.820 [470] 7380.800 10070.770 12364.370 7685.110 16068.910 13917.620 11407.430 [477] 4260.960 4263.650 8652.820 9808.160 503.930 6106.860 9756.570 [484] 17509.510 7451.380 8114.970 8409.370 7559.880 9480.000 9447.650 [491] 17281.480 10012.880 14942.560 5679.410 10118.750 9826.740 11758.490 [498] 9503.110 3928.270 9389.230 20683.240 6783.190 2078.300 8665.670 [505] 5959.400 4008.600 14167.730 11099.220 12040.950 7242.240 19323.430 [512] 362.340 4380.050 14235.200 5643.240 8379.810 3626.590 14639.780 [519] 8517.400 906.040 4100.630 14625.770 6894.780 7148.200 12805.950 [526] 5945.520 7642.430 8562.890 8514.390 19226.290 5641.340 8592.500 [533] 13820.830 13625.030 8005.460 15285.880 10996.040 8228.670 7955.020 [540] 7690.870 0.000 8254.530 15101.560 7861.300 13953.020 13104.850 [547] 5915.810 5504.230 402.040 10692.690 6631.440 9730.570 12431.050 [554] 8687.310 1943.900 10350.380 8117.730 7404.660 > 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/12asd1337366499.tab") + } + } > m Conditional inference tree with 44 terminal nodes Response: endo Inputs: BC, NNZFG, MRT, AFL, LPM, LPC, W, WPA Number of observations: 558 1) W <= 4895; criterion = 1, statistic = 439.032 2) WPA <= 3433; criterion = 1, statistic = 213.764 3) W <= 1678; criterion = 1, statistic = 125.711 4)* weights = 18 3) W > 1678 5) W <= 2595; criterion = 1, statistic = 70.228 6) W <= 2093; criterion = 0.988, statistic = 10.011 7)* weights = 10 6) W > 2093 8)* weights = 11 5) W > 2595 9) W <= 3900; criterion = 1, statistic = 28.838 10) WPA <= 2775; criterion = 1, statistic = 42.061 11) WPA <= 1686; criterion = 0.989, statistic = 10.209 12)* weights = 14 11) WPA > 1686 13)* weights = 15 10) WPA > 2775 14) LPM <= 80.51; criterion = 1, statistic = 22.618 15)* weights = 10 14) LPM > 80.51 16) AFL <= 386.94; criterion = 1, statistic = 18.031 17) W <= 3125; criterion = 1, statistic = 20.752 18)* weights = 11 17) W > 3125 19)* weights = 15 16) AFL > 386.94 20)* weights = 7 9) W > 3900 21) WPA <= 2150; criterion = 1, statistic = 21.315 22) LPC <= 143.76; criterion = 0.976, statistic = 8.826 23) WPA <= 1170; criterion = 0.974, statistic = 8.632 24)* weights = 7 23) WPA > 1170 25)* weights = 14 22) LPC > 143.76 26)* weights = 10 21) WPA > 2150 27)* weights = 16 2) WPA > 3433 28) W <= 4122; criterion = 1, statistic = 97.692 29) W <= 3851; criterion = 1, statistic = 34.61 30) AFL <= 260.23; criterion = 0.99, statistic = 10.34 31) W <= 3717; criterion = 0.998, statistic = 13.313 32)* weights = 9 31) W > 3717 33)* weights = 11 30) AFL > 260.23 34)* weights = 11 29) W > 3851 35) AFL <= 237.89; criterion = 0.992, statistic = 10.887 36)* weights = 7 35) AFL > 237.89 37)* weights = 14 28) W > 4122 38) W <= 4621; criterion = 1, statistic = 36.148 39) AFL <= 359.75; criterion = 1, statistic = 18.56 40) W <= 4297; criterion = 1, statistic = 19.927 41)* weights = 8 40) W > 4297 42)* weights = 18 39) AFL > 359.75 43)* weights = 19 38) W > 4621 44)* weights = 14 1) W > 4895 45) WPA <= 7105; criterion = 1, statistic = 196.286 46) WPA <= 3055; criterion = 1, statistic = 149.555 47) W <= 6781; criterion = 1, statistic = 80.326 48) WPA <= 1997; criterion = 1, statistic = 50.1 49) W <= 5617; criterion = 1, statistic = 19.761 50)* weights = 12 49) W > 5617 51) LPM <= 123.15; criterion = 1, statistic = 17.669 52)* weights = 11 51) LPM > 123.15 53)* weights = 18 48) WPA > 1997 54) LPM <= 251.51; criterion = 1, statistic = 24.312 55) WPA <= 2670.5; criterion = 0.999, statistic = 15.498 56) W <= 6036; criterion = 0.997, statistic = 12.663 57)* weights = 12 56) W > 6036 58)* weights = 8 55) WPA > 2670.5 59) W <= 5855; criterion = 0.984, statistic = 9.555 60)* weights = 13 59) W > 5855 61)* weights = 12 54) LPM > 251.51 62)* weights = 7 47) W > 6781 63) W <= 7174; criterion = 1, statistic = 18.068 64)* weights = 11 63) W > 7174 65)* weights = 12 46) WPA > 3055 66) W <= 9439; criterion = 1, statistic = 100.31 67) W <= 5553; criterion = 1, statistic = 40.401 68) LPC <= 132.72; criterion = 1, statistic = 20.696 69) W <= 5183; criterion = 1, statistic = 22.342 70)* weights = 13 69) W > 5183 71)* weights = 13 68) LPC > 132.72 72)* weights = 15 67) W > 5553 73) WPA <= 6181; criterion = 1, statistic = 30.055 74) AFL <= 664.91; criterion = 1, statistic = 22.163 75) W <= 8342; criterion = 0.987, statistic = 9.99 76) WPA <= 3596.5; criterion = 1, statistic = 29.497 77)* weights = 8 76) WPA > 3596.5 78)* weights = 48 75) W > 8342 79)* weights = 7 74) AFL > 664.91 80)* weights = 12 73) WPA > 6181 81) W <= 6756; criterion = 0.999, statistic = 15.183 82)* weights = 17 81) W > 6756 83)* weights = 7 66) W > 9439 84)* weights = 10 45) WPA > 7105 85) W <= 9123; criterion = 1, statistic = 21.035 86)* weights = 16 85) W > 9123 87)* weights = 7 > postscript(file="/var/wessaorg/rcomp/tmp/2ocyv1337366499.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/3mtn01337366499.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 12999.880 12762.303 237.5772917 2 10628.070 10304.040 324.0295238 3 11850.330 11877.073 -26.7433333 4 11657.030 11465.712 191.3184615 5 9399.620 8811.931 587.6891667 6 10206.050 10006.884 199.1657895 7 8807.340 8811.931 -4.5908333 8 10195.340 10006.884 188.4557895 9 9859.710 10304.040 -444.3304762 10 14035.060 13750.842 284.2183333 11 7098.607 6968.398 130.2090476 12 9098.800 8961.220 137.5800000 13 8801.080 8811.931 -10.8508333 14 7366.237 7322.737 43.4993333 15 12238.720 12762.303 -523.5827083 16 10065.460 10006.884 58.5757895 17 7322.397 7322.737 -0.3406667 18 10073.380 10304.040 -230.6604762 19 7790.850 7720.668 70.1822222 20 8967.410 8811.931 155.4791667 21 10365.693 10519.197 -153.5036364 22 9269.420 8811.931 457.4891667 23 13775.440 13848.715 -73.2752941 24 10297.370 10519.197 -221.8269697 25 8914.530 8809.197 105.3325926 26 10481.360 10732.801 -251.4407143 27 12143.460 11877.073 266.3866667 28 13140.560 12762.303 378.2572917 29 13116.600 12762.303 354.2972917 30 13269.690 12762.303 507.3872917 31 10017.990 10006.884 11.1057895 32 13943.580 13848.715 94.8647059 33 12220.800 12762.303 -541.5027083 34 12925.830 12762.303 163.5272917 35 7725.800 7720.668 5.1322222 36 6719.810 6607.587 112.2228571 37 13210.440 12762.303 448.1372917 38 11290.560 11465.712 -175.1515385 39 15979.320 13750.842 2228.4783333 40 13148.720 13750.842 -602.1216667 41 12586.250 12762.303 -176.0527083 42 10571.643 10519.197 52.4463636 43 9113.650 8961.220 152.4300000 44 9459.963 9328.565 131.3987500 45 9283.790 8809.197 474.5925926 46 12962.260 12762.303 199.9572917 47 6876.910 6607.587 269.3228571 48 8625.920 7785.126 840.7937500 49 12195.040 11465.712 729.3284615 50 11199.900 10732.801 467.0992857 51 13065.010 12762.303 302.7072917 52 9125.103 9328.565 -203.4612500 53 8878.800 8961.220 -82.4200000 54 11981.920 11877.073 104.8466667 55 13099.810 13750.842 -651.0316667 56 11012.170 10732.801 279.3692857 57 12544.580 12762.303 -217.7227083 58 7462.030 7785.126 -323.0962500 59 12684.490 13750.842 -1066.3516667 60 13609.250 13750.842 -141.5916667 61 9328.750 9455.689 -126.9392308 62 13535.140 13848.715 -313.5752941 63 8075.940 7785.126 290.8137500 64 8530.760 8285.195 245.5645455 65 12707.700 12762.303 -54.6027083 66 13289.540 12762.303 527.2372917 67 3369.090 1023.716 2345.3738889 68 8611.970 8809.197 -197.2274074 69 13032.800 12762.303 270.4972917 70 13561.740 13750.842 -189.1016667 71 10938.210 10800.840 137.3700000 72 8556.140 8809.197 -253.0574074 73 6828.130 6607.587 220.5428571 74 8162.550 7785.126 377.4237500 75 9266.210 9209.440 56.7700000 76 11010.320 10800.840 209.4800000 77 9939.793 10304.040 -364.2471429 78 9455.210 9455.689 -0.4792308 79 9068.050 8809.197 258.8525926 80 8418.690 8285.195 133.4945455 81 10601.950 10006.884 595.0657895 82 14218.250 13750.842 467.4083333 83 9099.520 9455.689 -356.1692308 84 9548.620 9455.689 92.9307692 85 9731.540 8809.197 922.3425926 86 11031.500 11877.073 -845.5733333 87 10263.750 10304.040 -40.2904762 88 13712.330 13750.842 -38.5116667 89 13481.510 13750.842 -269.3316667 90 7375.380 7785.126 -409.7462500 91 8474.090 7785.126 688.9637500 92 12258.490 11877.073 381.4166667 93 10880.460 10800.840 79.6200000 94 8426.290 8284.675 141.6148485 95 9359.200 9209.440 149.7600000 96 6566.420 6607.587 -41.1671429 97 5612.460 5507.752 104.7078571 98 9902.150 9650.822 251.3283333 99 13675.210 13750.842 -75.6316667 100 10124.610 10732.801 -608.1907143 101 9109.930 8961.220 148.7100000 102 9922.730 10006.884 -84.1542105 103 6490.870 6607.587 -116.7171429 104 7402.250 7505.517 -103.2671429 105 14693.640 13848.715 844.9247059 106 8364.270 8284.675 79.5948485 107 10816.900 10800.840 16.0600000 108 9453.040 10006.884 -553.8442105 109 9150.960 8809.197 341.7625926 110 6392.320 6607.587 -215.2671429 111 7995.490 8809.197 -813.7074074 112 6378.650 6607.587 -228.9371429 113 8154.580 8285.195 -130.6154545 114 10001.770 9796.893 204.8766667 115 9927.420 9796.893 130.5266667 116 7749.290 7785.126 -35.8362500 117 8335.400 8809.197 -473.7974074 118 8633.020 8961.220 -328.2000000 119 9496.430 9650.822 -154.3916667 120 8705.190 8809.197 -104.0074074 121 5485.090 5507.752 -22.6621429 122 12899.680 12762.303 137.3772917 123 8853.410 7505.517 1347.8928571 124 9319.500 8961.220 358.2800000 125 9648.480 9650.822 -2.3416667 126 15259.560 14912.379 347.1814286 127 7341.850 7785.126 -443.2762500 128 10623.540 10732.801 -109.2607143 129 11224.000 10304.040 919.9595238 130 8495.300 8811.931 -316.6308333 131 11227.390 10732.801 494.5892857 132 8649.580 8811.931 -162.3508333 133 10651.680 10519.197 132.4830303 134 12959.450 12762.303 197.1472917 135 10425.980 10519.197 -93.2169697 136 8437.090 8285.195 151.8945455 137 6704.730 6670.528 34.2018182 138 7365.200 7261.522 103.6780000 139 9735.730 9796.893 -61.1633333 140 5123.100 5207.879 -84.7790909 141 11423.860 11465.712 -41.8515385 142 8446.730 8532.009 -85.2785714 143 5970.440 6143.407 -172.9666667 144 10441.130 10006.884 434.2457895 145 8115.670 7785.126 330.5437500 146 7707.260 7785.126 -77.8662500 147 7432.140 7788.192 -356.0525000 148 8028.263 7788.192 240.0708333 149 8106.133 7788.192 317.9408333 150 10489.060 10519.197 -30.1369697 151 7122.570 6968.398 154.1723810 152 6550.880 6670.528 -119.6481818 153 12247.670 11877.073 370.5966667 154 6713.040 6670.528 42.5118182 155 7519.270 7788.192 -268.9225000 156 5721.450 5507.752 213.6978571 157 7941.540 7788.192 153.3475000 158 6734.700 6968.398 -233.6976190 159 9659.920 9650.822 9.0983333 160 10472.940 10519.197 -46.2569697 161 9370.703 9328.565 42.1387500 162 8335.453 7788.192 547.2608333 163 8282.810 7505.517 777.2928571 164 8756.093 9328.565 -572.4712500 165 7171.570 6968.398 203.1723810 166 4366.980 5207.879 -840.8990909 167 6905.900 6968.398 -62.4976190 168 6411.900 6446.439 -34.5390000 169 12624.320 11877.073 747.2466667 170 8866.343 8809.197 57.1459259 171 4046.330 4140.480 -94.1500000 172 6063.610 5507.752 555.8578571 173 7018.630 6968.398 50.2323810 174 4520.670 5207.879 -687.2090909 175 8171.440 8112.571 58.8690909 176 5517.950 5507.752 10.1978571 177 9701.810 9796.893 -95.0833333 178 7045.030 7261.522 -216.4920000 179 9810.060 9650.822 159.2383333 180 7446.070 7322.737 123.3326667 181 7954.650 8284.675 -330.0251515 182 6300.700 5507.752 792.9478571 183 7142.280 7261.522 -119.2420000 184 7138.500 6968.398 170.1023810 185 9202.320 9209.440 -7.1200000 186 5867.790 6143.407 -275.6166667 187 4481.130 5207.879 -726.7490909 188 3540.170 4140.480 -600.3100000 189 13707.573 13975.417 -267.8438095 190 9927.510 9796.893 130.6166667 191 12068.390 12762.303 -693.9127083 192 8741.737 8809.197 -67.4607407 193 6796.870 7505.517 -708.6471429 194 9300.490 9209.440 91.0500000 195 7095.660 7322.737 -227.0773333 196 9186.730 9209.440 -22.7100000 197 8958.790 8961.220 -2.4300000 198 5701.560 5207.879 493.6809091 199 6940.110 6968.398 -28.2876190 200 8452.860 8285.195 167.6645455 201 13315.123 13975.417 -660.2938095 202 6301.370 6670.528 -369.1581818 203 8714.340 8811.931 -97.5908333 204 5614.490 5507.752 106.7378571 205 10239.780 10006.884 232.8957895 206 7072.100 6968.398 103.7023810 207 5381.770 5507.752 -125.9821429 208 7139.600 6446.439 693.1610000 209 10010.060 10006.884 3.1757895 210 4844.830 5507.752 -662.9221429 211 9678.670 9650.822 27.8483333 212 7982.600 8284.675 -302.0751515 213 10139.580 10304.040 -164.4604762 214 9533.680 9455.689 77.9907692 215 9268.450 9455.689 -187.2392308 216 5769.620 5507.752 261.8678571 217 5108.870 5507.752 -398.8821429 218 8956.813 8809.197 147.6159259 219 8350.200 8112.571 237.6290909 220 13201.790 12762.303 439.4872917 221 5350.280 5507.752 -157.4721429 222 9521.070 9455.689 65.3807692 223 6015.800 6446.439 -430.6390000 224 7660.520 7720.668 -60.1477778 225 7290.230 7261.522 28.7080000 226 9404.760 9455.689 -50.9292308 227 6740.520 6968.398 -227.8776190 228 9303.930 9455.689 -151.7592308 229 11055.210 10800.840 254.3700000 230 10406.840 10732.801 -325.9607143 231 6996.910 6968.398 28.5123810 232 9820.990 10519.197 -698.2069697 233 6239.870 6143.407 96.4633333 234 6184.580 6143.407 41.1733333 235 7473.557 7322.737 150.8193333 236 6982.560 7322.737 -340.1773333 237 11568.240 10732.801 835.4392857 238 6696.290 6143.407 552.8833333 239 8569.547 8284.675 284.8715152 240 6068.490 6446.439 -377.9490000 241 11914.480 11877.073 37.4066667 242 6086.440 6143.407 -56.9666667 243 9784.520 9455.689 328.8307692 244 7368.020 7261.522 106.4980000 245 8711.650 8809.197 -97.5474074 246 12749.660 12762.303 -12.6427083 247 5384.010 5207.879 176.1309091 248 11344.700 11465.712 -121.0115385 249 7038.440 6968.398 70.0423810 250 7137.820 7322.737 -184.9173333 251 8736.020 8811.931 -75.9108333 252 7297.280 7322.737 -25.4573333 253 12375.840 12762.303 -386.4627083 254 7294.080 7261.522 32.5580000 255 9876.430 9650.822 225.6083333 256 8047.740 8284.675 -236.9351515 257 9801.260 9796.893 4.3666667 258 13022.310 12762.303 260.0072917 259 11924.240 11877.073 47.1666667 260 9815.300 9455.689 359.6107692 261 13083.540 12762.303 321.2372917 262 8057.830 8112.571 -54.7409091 263 6213.800 6446.439 -232.6390000 264 9314.640 9455.689 -141.0492308 265 11078.190 10800.840 277.3500000 266 8829.977 8809.197 20.7792593 267 9024.670 8961.220 63.4500000 268 6959.310 6968.398 -9.0876190 269 9545.510 9455.689 89.8207692 270 8963.523 8809.197 154.3259259 271 4868.320 5507.752 -639.4321429 272 9288.220 9209.440 78.7800000 273 8351.320 8284.675 66.6448485 274 8579.560 8809.197 -229.6374074 275 8439.600 8284.675 154.9248485 276 6591.210 6670.528 -79.3181818 277 6619.700 6968.398 -348.6976190 278 5469.090 5507.752 -38.6621429 279 8972.963 9328.565 -355.6012500 280 6410.880 6446.439 -35.5590000 281 8098.200 8284.675 -186.4751515 282 13804.410 13750.842 53.5683333 283 7377.957 7322.737 55.2193333 284 7727.837 7322.737 405.0993333 285 6317.420 6446.439 -129.0190000 286 8735.850 8811.931 -76.0808333 287 13327.653 13975.417 -647.7638095 288 12560.830 12762.303 -201.4727083 289 6746.340 6670.528 75.8118182 290 11056.590 11005.685 50.9050000 291 9605.040 9328.565 276.4754167 292 9115.560 8961.220 154.3400000 293 8805.950 8961.220 -155.2700000 294 12362.590 12762.303 -399.7127083 295 9692.110 9328.565 363.5454167 296 7445.250 7261.522 183.7280000 297 10211.750 11564.487 -1352.7375000 298 18789.550 18168.167 621.3830000 299 11412.210 11005.685 406.5250000 300 12557.850 12762.303 -204.4527083 301 13530.690 11564.487 1966.2025000 302 9906.740 10006.884 -100.1442105 303 9958.710 9796.893 161.8166667 304 14131.190 13848.715 282.4747059 305 10637.980 10800.840 -162.8600000 306 9859.070 9650.822 208.2483333 307 14214.230 13848.715 365.5147059 308 11619.050 10519.197 1099.8530303 309 2559.370 1023.716 1535.6538889 310 33644.960 25492.419 8152.5414286 311 10267.250 11564.487 -1297.2375000 312 11146.330 11465.712 -319.3815385 313 11351.470 11564.487 -213.0175000 314 18802.430 17210.041 1592.3887500 315 5241.000 5207.879 33.1209091 316 13003.970 12762.303 241.6672917 317 18688.750 18168.167 520.5830000 318 17945.880 18168.167 -222.2870000 319 10657.040 10519.197 137.8430303 320 16213.120 17210.041 -996.9212500 321 9462.530 9650.822 -188.2916667 322 7472.780 7788.192 -315.4125000 323 7199.960 7261.522 -61.5620000 324 12839.240 12762.303 76.9372917 325 6908.180 6670.528 237.6518182 326 9877.230 9650.822 226.4083333 327 10827.250 11005.685 -178.4350000 328 7794.090 7720.668 73.4222222 329 9646.540 9328.565 317.9754167 330 7485.870 7788.192 -302.3225000 331 13290.130 13848.715 -558.5852941 332 6696.470 6670.528 25.9418182 333 18584.870 17210.041 1374.8287500 334 9530.230 10006.884 -476.6542105 335 18205.970 18168.167 37.8030000 336 6135.080 6143.407 -8.3266667 337 393.120 1023.716 -630.5961111 338 4551.830 4140.480 411.3500000 339 7490.620 7785.126 -294.5062500 340 29.000 1023.716 -994.7161111 341 13299.300 11564.487 1734.8125000 342 12630.980 12762.303 -131.3227083 343 10972.350 11564.487 -592.1375000 344 11.000 1023.716 -1012.7161111 345 17193.020 17210.041 -17.0212500 346 13588.910 11564.487 2024.4225000 347 13512.240 11564.487 1947.7525000 348 17165.860 17210.041 -44.1812500 349 10009.170 10006.884 2.2857895 350 6195.690 6143.407 52.2833333 351 8309.260 8112.571 196.6890909 352 24073.530 25492.419 -1418.8885714 353 8792.230 8961.220 -168.9900000 354 7659.050 7788.192 -129.1425000 355 13109.340 12762.303 347.0372917 356 13021.660 12762.303 259.3572917 357 6454.770 6670.528 -215.7581818 358 6618.490 7505.517 -887.0271429 359 11773.480 11877.073 -103.5933333 360 32946.360 25492.419 7453.9414286 361 18620.940 18168.167 452.7730000 362 10339.720 10519.197 -179.4769697 363 7921.970 8112.571 -190.6009091 364 11123.140 10732.801 390.3392857 365 10573.350 11564.487 -991.1375000 366 12378.910 12762.303 -383.3927083 367 1455.680 1023.716 431.9638889 368 11423.970 10732.801 691.1692857 369 8271.050 8285.195 -14.1454545 370 12710.270 12762.303 -52.0327083 371 7217.300 7261.522 -44.2220000 372 11346.250 11465.712 -119.4615385 373 14125.540 13848.715 276.8247059 374 9564.640 9650.822 -86.1816667 375 16131.850 17210.041 -1078.1912500 376 6925.630 6670.528 255.1018182 377 6136.460 6143.407 -6.9466667 378 7767.910 7720.668 47.2422222 379 13043.980 12762.303 281.6772917 380 12884.310 12762.303 122.0072917 381 18401.780 17210.041 1191.7387500 382 17015.070 17210.041 -194.9712500 383 12370.820 12762.303 -391.4827083 384 9622.880 9796.893 -174.0133333 385 8248.460 8112.571 135.8890909 386 11913.110 11877.073 36.0366667 387 11662.120 11005.685 656.4350000 388 25701.670 25492.419 209.2514286 389 7601.090 7788.192 -187.1025000 390 11351.180 11877.073 -525.8933333 391 10341.690 11564.487 -1222.7975000 392 12510.820 12762.303 -251.4827083 393 22073.740 25492.419 -3418.6785714 394 10929.100 10732.801 196.2992857 395 11205.420 11005.685 199.7350000 396 16889.560 17210.041 -320.4812500 397 11089.440 11564.487 -475.0475000 398 12054.640 11877.073 177.5666667 399 19061.320 18168.167 893.1530000 400 13629.670 13848.715 -219.0452941 401 11753.200 11877.073 -123.8733333 402 7570.850 7785.126 -214.2762500 403 11334.080 11877.073 -542.9933333 404 12604.630 12762.303 -157.6727083 405 11378.530 11465.712 -87.1815385 406 7912.750 7788.192 124.5575000 407 11526.610 11005.685 520.9250000 408 9656.560 9650.822 5.7383333 409 18940.150 17210.041 1730.1087500 410 6899.680 7505.517 -605.8371429 411 9994.280 10006.884 -12.6042105 412 8914.540 8961.220 -46.6800000 413 6238.010 6143.407 94.6033333 414 0.000 1023.716 -1023.7161111 415 12121.610 12762.303 -640.6927083 416 16230.960 17210.041 -979.0812500 417 10035.410 11564.487 -1529.0775000 418 8083.750 8112.571 -28.8209091 419 9688.360 10006.884 -318.5242105 420 13803.760 13848.715 -44.9552941 421 18126.890 18168.167 -41.2770000 422 10129.260 11005.685 -876.4250000 423 13696.760 13848.715 -151.9552941 424 7444.320 7261.522 182.7980000 425 14591.690 14912.379 -320.6885714 426 474.170 1023.716 -549.5461111 427 8870.340 8961.220 -90.8800000 428 9752.650 9650.822 101.8283333 429 6179.840 6143.407 36.4333333 430 7963.970 7788.192 175.7775000 431 7683.230 7720.668 -37.4377778 432 10226.020 11005.685 -779.6650000 433 7141.960 7261.522 -119.5620000 434 0.000 1023.716 -1023.7161111 435 17394.270 18168.167 -773.8970000 436 14159.910 13975.417 184.4928571 437 8975.820 9209.440 -233.6200000 438 9635.520 9796.893 -161.3733333 439 7360.020 7785.126 -425.1062500 440 10485.310 10800.840 -315.5300000 441 9096.530 9209.440 -112.9100000 442 13043.260 12762.303 280.9572917 443 17338.590 18168.167 -829.5770000 444 8228.390 8285.195 -56.8054545 445 7967.820 8112.571 -144.7509091 446 11613.870 11465.712 148.1584615 447 11392.940 11465.712 -72.7715385 448 14565.620 14912.379 -346.7585714 449 6399.880 6143.407 256.4733333 450 8761.830 8532.009 229.8214286 451 7894.850 8112.571 -217.7209091 452 8315.490 8532.009 -216.5185714 453 4324.310 4140.480 183.8300000 454 15474.530 17210.041 -1735.5112500 455 15740.780 17210.041 -1469.2612500 456 8821.300 8961.220 -139.9200000 457 9649.980 9650.822 -0.8416667 458 12950.090 12762.303 187.7872917 459 11025.410 10800.840 224.5700000 460 9762.970 9796.893 -33.9233333 461 10007.320 10732.801 -725.4807143 462 13029.740 12762.303 267.4372917 463 14456.690 13975.417 481.2728571 464 312.320 1023.716 -711.3961111 465 8000.230 8285.195 -284.9654545 466 12871.940 12762.303 109.6372917 467 12670.050 12762.303 -92.2527083 468 10142.820 10006.884 135.9357895 469 10443.820 10800.840 -357.0200000 470 7380.800 7261.522 119.2780000 471 10070.770 10006.884 63.8857895 472 12364.370 12762.303 -397.9327083 473 7685.110 7505.517 179.5928571 474 16068.910 17210.041 -1141.1312500 475 13917.620 13848.715 68.9047059 476 11407.430 11465.712 -58.2815385 477 4260.960 4140.480 120.4800000 478 4263.650 4140.480 123.1700000 479 8652.820 8811.931 -159.1108333 480 9808.160 10006.884 -198.7242105 481 503.930 1023.716 -519.7861111 482 6106.860 6446.439 -339.5790000 483 9756.570 9796.893 -40.3233333 484 17509.510 18168.167 -658.6570000 485 7451.380 7261.522 189.8580000 486 8114.970 8112.571 2.3990909 487 8409.370 8285.195 124.1745455 488 7559.880 7720.668 -160.7877778 489 9480.000 9650.822 -170.8216667 490 9447.650 9650.822 -203.1716667 491 17281.480 17210.041 71.4387500 492 10012.880 10732.801 -719.9207143 493 14942.560 14912.379 30.1814286 494 5679.410 5207.879 471.5309091 495 10118.750 10732.801 -614.0507143 496 9826.740 10006.884 -180.1442105 497 11758.490 11465.712 292.7784615 498 9503.110 9650.822 -147.7116667 499 3928.270 4140.480 -212.2100000 500 9389.230 9650.822 -261.5916667 501 20683.240 25492.419 -4809.1785714 502 6783.190 6670.528 112.6618182 503 2078.300 1023.716 1054.5838889 504 8665.670 8532.009 133.6614286 505 5959.400 6143.407 -184.0066667 506 4008.600 4140.480 -131.8800000 507 14167.730 13848.715 319.0147059 508 11099.220 11465.712 -366.4915385 509 12040.950 12762.303 -721.3527083 510 7242.240 7261.522 -19.2820000 511 19323.430 25492.419 -6168.9885714 512 362.340 1023.716 -661.3761111 513 4380.050 4140.480 239.5700000 514 14235.200 13975.417 259.7828571 515 5643.240 5207.879 435.3609091 516 8379.810 8284.675 95.1348485 517 3626.590 1023.716 2602.8738889 518 14639.780 14912.379 -272.5985714 519 8517.400 8284.675 232.7248485 520 906.040 1023.716 -117.6761111 521 4100.630 4140.480 -39.8500000 522 14625.770 13975.417 650.3528571 523 6894.780 7261.522 -366.7420000 524 7148.200 6446.439 701.7610000 525 12805.950 12762.303 43.6472917 526 5945.520 6143.407 -197.8866667 527 7642.430 7720.668 -78.2377778 528 8562.890 8809.197 -246.3074074 529 8514.390 8811.931 -297.5408333 530 19226.290 17210.041 2016.2487500 531 5641.340 5207.879 433.4609091 532 8592.500 8532.009 60.4914286 533 13820.830 13848.715 -27.8852941 534 13625.030 13848.715 -223.6852941 535 8005.460 8285.195 -279.7354545 536 15285.880 14912.379 373.5014286 537 10996.040 10800.840 195.2000000 538 8228.670 8285.195 -56.5254545 539 7955.020 7785.126 169.8937500 540 7690.870 7785.126 -94.2562500 541 0.000 1023.716 -1023.7161111 542 8254.530 8532.009 -277.4785714 543 15101.560 14912.379 189.1814286 544 7861.300 7720.668 140.6322222 545 13953.020 13848.715 104.3047059 546 13104.850 13848.715 -743.8652941 547 5915.810 6143.407 -227.5966667 548 5504.230 5207.879 296.3509091 549 402.040 1023.716 -621.6761111 550 10692.690 10800.840 -108.1500000 551 6631.440 6446.439 185.0010000 552 9730.570 9796.893 -66.3233333 553 12431.050 12762.303 -331.2527083 554 8687.310 8532.009 155.3014286 555 1943.900 1023.716 920.1838889 556 10350.380 10800.840 -450.4600000 557 8117.730 8112.571 5.1590909 558 7404.660 7785.126 -380.4662500 > 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/47mj81337366499.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/5dr1i1337366499.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/6prou1337366499.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/7yh3l1337366499.tab") + } > > try(system("convert tmp/2ocyv1337366499.ps tmp/2ocyv1337366499.png",intern=TRUE)) character(0) > try(system("convert tmp/3mtn01337366499.ps tmp/3mtn01337366499.png",intern=TRUE)) character(0) > try(system("convert tmp/47mj81337366499.ps tmp/47mj81337366499.png",intern=TRUE)) character(0) > > > proc.time() user system elapsed 11.176 0.444 11.623