R version 2.12.0 (2010-10-15) Copyright (C) 2010 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. > par5 = 'ATTLES all' > par4 = 'all' > par3 = 'bachelor' > par2 = 'female' > par1 = '2' > par5 <- 'ATTLES all' > par4 <- 'all' > par3 <- 'bachelor' > par2 <- 'female' > par1 <- '2' > #'GNU S' R Code compiled by R2WASP v. 1.2.291 () > #Author: root > #To cite this work: Wessa P., 2012, Factor Analysis for Information Management 2 (v1.0.7) in Free Statistics Software (v$_version), Office for Research Development and Education, URL http://www.wessa.net/rwasp_factor_analysis.wasp/ > #Source of accompanying publication: > # > library(psych) > x <- as.data.frame(read.table(file='http://www.wessa.net/download/utaut.csv',sep=',',header=T)) > x$U25 <- 6-x$U25 > if(par2 == 'female') x <- x[x$Gender==0,] > if(par2 == 'male') x <- x[x$Gender==1,] > if(par3 == 'prep') x <- x[x$Pop==1,] > if(par3 == 'bachelor') x <- x[x$Pop==0,] > if(par4 != 'all') { + x <- x[x$Year==as.numeric(par4),] + } > 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 (par5=='ATTLES connected') x <- cAc > if (par5=='ATTLES separate') x <- cAs > if (par5=='ATTLES all') x <- cA > if (par5=='COLLES actuals') x <- cCa > if (par5=='COLLES preferred') x <- cCp > if (par5=='COLLES all') x <- cC > if (par5=='CSUQ') x <- cU > if (par5=='Learning Activities') x <- cE > if (par5=='Exam Items') x <- cX > ncol <- length(x[1,]) > for (jjj in 1:ncol) { + x <- x[!is.na(x[,jjj]),] + } > par1 <- as.numeric(par1) > nrows <- length(x[,1]) > rownames(x) <- 1:nrows > y <- x > fit <- principal(y, nfactors=par1, rotate='varimax') > fit Principal Components Analysis Call: principal(r = y, nfactors = par1, rotate = "varimax") Standardized loadings based upon correlation matrix RC1 RC2 h2 u2 A1 0.48 -0.02 0.23 0.77 A2 -0.14 0.58 0.36 0.64 A3 0.56 0.01 0.32 0.68 A4 0.24 0.50 0.31 0.69 A5 0.31 0.24 0.15 0.85 A6 0.47 0.16 0.25 0.75 A7 0.05 0.45 0.20 0.80 A8 0.51 0.35 0.39 0.61 A9 0.03 0.54 0.29 0.71 A10 0.49 0.14 0.26 0.74 A11 0.46 -0.61 0.58 0.42 A12 0.20 0.47 0.26 0.74 A13 0.17 0.36 0.15 0.85 A14 0.32 0.47 0.33 0.67 A15 0.64 -0.22 0.46 0.54 A16 0.46 -0.43 0.40 0.60 A17 0.44 0.14 0.21 0.79 A18 0.52 -0.01 0.27 0.73 A19 0.59 0.15 0.36 0.64 A20 0.30 0.11 0.10 0.90 RC1 RC2 SS loadings 3.36 2.54 Proportion Var 0.17 0.13 Cumulative Var 0.17 0.29 Test of the hypothesis that 2 factors are sufficient. The degrees of freedom for the null model are 190 and the objective function was 3.66 The degrees of freedom for the model are 151 and the objective function was 1.41 The number of observations was 224 with Chi Square = 302.91 with prob < 3.1e-12 Fit based upon off diagonal values = 0.75> fs <- factor.scores(y,fit) > fs RC1 RC2 1 0.021093262 -0.07517972 2 0.312483408 -0.93950096 3 -1.476650947 -1.51418260 4 -3.189423567 -0.56900919 5 -0.016122703 -0.33570418 6 -1.039043122 -0.97242234 7 0.665452484 -0.24809900 8 -0.387521861 -0.71793734 9 1.548301157 -1.37757447 10 0.691679202 -0.27385950 11 0.233335778 -0.61542142 12 -0.810409068 -1.52371379 13 0.110953169 -1.23024659 14 0.243324613 -0.58388205 15 -0.309045552 -0.08500912 16 -0.549989400 0.61944676 17 -1.600697911 0.66805498 18 -1.415364483 -1.78393378 19 -0.760194719 -1.34362208 20 0.747823295 -0.25629183 21 -0.659062041 -0.23089645 22 -0.594279571 -0.81449651 23 -1.214057517 -0.90160262 24 0.778562307 -0.09089793 25 0.149838469 -0.83753011 26 0.250705873 0.08057723 27 1.131494889 -0.40180019 28 0.250480189 -0.53733052 29 0.624687300 -0.74554333 30 0.876335313 0.12391080 31 0.376174507 -0.12083543 32 -1.932837511 -0.99923565 33 2.401823144 0.08759770 34 -0.409413809 -0.51363616 35 0.225106883 -0.21989100 36 -0.010513934 -0.58081397 37 0.540859109 -0.33392206 38 -0.651729964 -0.64559304 39 0.326042394 -0.58040693 40 0.328311359 -1.05295179 41 0.266794533 -1.25072224 42 1.140097993 -0.34963242 43 1.208922100 -1.54302619 44 0.249140787 0.65068722 45 0.105780518 -0.56535599 46 0.362265017 -1.03813375 47 0.133596752 -0.73695996 48 0.639253707 -1.42999086 49 -1.781597876 -0.34997605 50 -0.908966441 -1.92917935 51 0.326407581 -0.74483248 52 0.236142119 -0.95949129 53 0.033117752 -0.81432220 54 -0.206196469 -0.33599139 55 -0.419667248 -0.21909415 56 0.954777226 -1.06076461 57 -4.084245024 -1.23108073 58 -1.115876855 -1.30616878 59 1.093666861 -1.64676758 60 0.778436672 0.47445170 61 -0.997920607 -0.55525640 62 0.142867757 -1.64534667 63 -1.041960738 -2.30201958 64 0.225349262 -0.56353726 65 0.263191383 -0.77599698 66 -2.468639674 -2.18416289 67 0.332038400 -0.81508085 68 0.591570315 -1.22605604 69 -0.545951106 -0.51345220 70 0.588598578 -0.69036549 71 -0.083152500 -1.25429103 72 0.447607797 -1.17726780 73 -0.353100697 -1.05995847 74 -1.047454623 -1.79477042 75 0.228652257 -0.98190048 76 0.609348673 -0.44563346 77 0.055754975 -0.98057185 78 0.297012749 -0.57184833 79 1.428014371 0.60691688 80 0.142505826 -0.98862939 81 1.699399375 -0.66985502 82 2.262466067 -0.98928253 83 0.789544621 -0.16971684 84 1.601421518 0.20621732 85 -0.046579769 -1.49897329 86 1.267209327 -0.56368272 87 0.002082937 -1.11104146 88 1.488111879 -0.37455623 89 2.740024098 -0.47097923 90 1.068230321 0.63589448 91 1.994600957 -1.11296345 92 0.701933884 -0.39704435 93 0.673659190 -0.41163249 94 0.848574921 -1.27392191 95 1.841414771 -1.33125909 96 0.818559156 -0.24354045 97 0.677843253 -1.07494842 98 0.820269153 -0.87777216 99 0.342435620 -0.97554610 100 0.677298070 -0.30323643 101 -0.191123630 -1.06368682 102 0.513377107 -0.10902198 103 -1.652220549 0.63651314 104 0.117859843 -0.78333186 105 1.085305471 -0.68586314 106 -0.337224824 -0.37484959 107 -1.134062588 0.86119840 108 -2.162620018 -0.38927430 109 0.062158640 -0.26594264 110 -0.276939505 0.27954988 111 2.636385734 1.84967075 112 0.522962743 -0.21833271 113 1.841609801 -1.19656148 114 0.970465859 -0.78141666 115 0.236222370 0.19751071 116 0.285609873 -0.64843141 117 -0.490777936 -0.42405882 118 0.865451520 -0.14444722 119 1.460225216 -0.83605273 120 1.187004651 -0.80838286 121 -1.750715743 -1.11525551 122 0.918132080 -0.27176068 123 1.034363336 -0.21824154 124 1.476342581 -0.32910887 125 1.469858101 1.28929978 126 -0.433045094 1.21585369 127 -0.872260254 0.67361613 128 -1.179087684 1.45739196 129 0.433051639 1.09459323 130 0.471785996 2.27089644 131 -0.737994898 1.38178994 132 1.074478359 0.33209583 133 0.141187016 0.89704180 134 -1.371372466 1.09589065 135 -0.519334966 0.13116465 136 0.089265647 0.75493413 137 0.855074847 0.24526603 138 -0.418735192 0.68479467 139 0.046572466 0.09784243 140 -0.898163861 -0.91087193 141 -0.677550450 0.12200940 142 -0.387844712 1.59797579 143 -0.400193787 1.31887280 144 0.416865807 0.56114182 145 0.632705025 1.00252450 146 0.254014761 0.69548267 147 -0.002442731 1.59839056 148 0.083025020 0.77321695 149 -0.771607895 0.52223538 150 1.013895805 0.31461471 151 -1.964809230 -0.10382996 152 -0.866491739 0.39487323 153 -0.137134790 0.24791748 154 0.523808410 -0.15792393 155 0.465375062 -0.10806554 156 -0.577688386 0.99673271 157 -0.549211310 1.26657050 158 -0.482878095 -0.16384450 159 -0.603576024 1.16428354 160 -0.154079160 0.70292395 161 0.501092889 1.80933196 162 -0.081811254 1.61749168 163 0.938523558 1.54772964 164 -0.328605560 -0.05848874 165 -0.518880436 1.24142215 166 0.623388529 1.79648603 167 -1.791769469 1.28398387 168 -1.003179913 -0.67102804 169 1.601744268 -0.09370890 170 0.307016293 1.20934954 171 -1.058717201 1.22561186 172 -1.017409715 1.54274613 173 -0.095758474 -0.19988440 174 0.419977224 1.08218208 175 -0.376354598 0.49673094 176 0.394989809 0.80414557 177 -1.240159090 0.28757637 178 0.277976859 1.40818623 179 -1.216765756 0.93086706 180 -0.273444416 1.60897581 181 0.039451747 0.66490349 182 -1.225407431 0.71913913 183 -0.769541688 0.79587729 184 -0.913154678 1.23112822 185 -0.647661940 0.63770774 186 -0.220467871 -0.30715466 187 -0.578504661 1.29872710 188 -1.630208803 1.31858632 189 0.632200107 0.79319385 190 -1.057768427 1.14620667 191 -0.587435013 0.91807603 192 -0.849862409 0.09970722 193 0.139436548 -1.34283470 194 0.915524693 1.86113445 195 0.878532690 1.44051522 196 -0.554999502 1.06084733 197 -0.129002454 -0.04878424 198 -0.627320324 1.43562356 199 -0.250716928 0.49132595 200 0.737652563 0.71108601 201 1.855010800 0.05572329 202 -0.492606634 0.85395218 203 1.140179172 1.04068050 204 -0.004063465 0.88456722 205 -0.305078208 1.51049282 206 1.069735383 1.50315994 207 0.044368847 -0.37545973 208 -0.780641417 -0.07266328 209 -0.164027507 1.11842840 210 -0.448680556 1.17698608 211 -1.552930873 1.31229824 212 0.531025080 2.81308192 213 0.587316913 1.73930745 214 0.297300993 1.42606159 215 -1.189889848 1.29919154 216 -0.420541870 0.98066494 217 -0.502284224 0.80405132 218 0.072160841 1.49332525 219 -1.618422052 0.63708422 220 0.936702024 1.70435159 221 -1.426135009 -1.12008029 222 -2.643377320 -2.21689287 223 -0.930481937 0.65498392 224 -0.503684036 0.15066783 > postscript(file="/var/www/rcomp/tmp/1yvhs1335693734.ps",horizontal=F,onefile=F,pagecentre=F,paper="special",width=8.3333333333333,height=5.5555555555556) > fa.diagram(fit) > dev.off() null device 1 > postscript(file="/var/www/rcomp/tmp/2uaty1335693734.ps",horizontal=F,onefile=F,pagecentre=F,paper="special",width=8.3333333333333,height=5.5555555555556) > plot(fs,pch=20) > text(fs,labels=rownames(y),pos=3) > dev.off() null device 1 > > #Note: the /var/www/rcomp/createtable file can be downloaded at http://www.wessa.net/cretab > load(file="/var/www/rcomp/createtable") > > a<-table.start() > a<-table.row.start(a) > a<-table.element(a,'Rotated Factor Loadings',par1+1,TRUE) > a<-table.row.end(a) > a<-table.row.start(a) > a<-table.element(a,'Variables',1,TRUE) > for (i in 1:par1) { + a<-table.element(a,paste('Factor',i,sep=''),1,TRUE) + } > a<-table.row.end(a) > for (j in 1:length(fit$loadings[,1])) { + a<-table.row.start(a) + a<-table.element(a,rownames(fit$loadings)[j],header=TRUE) + for (i in 1:par1) { + a<-table.element(a,round(fit$loadings[j,i],3)) + } + a<-table.row.end(a) + } > a<-table.end(a) > table.save(a,file="/var/www/rcomp/tmp/3c0az1335693734.tab") > > try(system("convert tmp/1yvhs1335693734.ps tmp/1yvhs1335693734.png",intern=TRUE)) character(0) > try(system("convert tmp/2uaty1335693734.ps tmp/2uaty1335693734.png",intern=TRUE)) character(0) > > > proc.time() user system elapsed 0.77 0.50 2.28