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 = 'male' > par1 = '2' > par5 <- 'ATTLES all' > par4 <- 'all' > par3 <- 'bachelor' > par2 <- 'male' > 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.56 0.02 0.31 0.69 A2 0.02 0.38 0.14 0.86 A3 0.47 0.20 0.26 0.74 A4 0.05 0.47 0.23 0.77 A5 0.19 0.48 0.26 0.74 A6 0.56 0.34 0.42 0.58 A7 0.38 0.35 0.27 0.73 A8 0.44 0.46 0.41 0.59 A9 0.26 0.19 0.10 0.90 A10 0.55 0.10 0.31 0.69 A11 0.49 -0.44 0.44 0.56 A12 0.25 0.62 0.44 0.56 A13 -0.08 0.66 0.44 0.56 A14 0.42 0.39 0.32 0.68 A15 0.49 0.09 0.24 0.76 A16 0.62 -0.34 0.50 0.50 A17 0.38 0.15 0.17 0.83 A18 0.32 0.32 0.21 0.79 A19 0.19 0.52 0.31 0.69 A20 0.52 0.07 0.27 0.73 RC1 RC2 SS loadings 3.25 2.82 Proportion Var 0.16 0.14 Cumulative Var 0.16 0.30 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.67 The degrees of freedom for the model are 151 and the objective function was 1.21 The number of observations was 222 with Chi Square = 256.45 with prob < 1.9e-07 Fit based upon off diagonal values = 0.82> fs <- factor.scores(y,fit) > fs RC1 RC2 1 0.381642089 -2.04652672 2 0.980640131 -0.47625863 3 -0.139133650 0.44114767 4 -0.332690281 -0.58304456 5 -0.202603548 0.67901577 6 0.040302575 -0.59789666 7 -3.202212925 -1.62459337 8 0.050194770 -1.08214392 9 0.745662370 -0.37954365 10 0.323407322 -0.63168046 11 -0.986120211 -1.03803856 12 0.393882997 -1.07863197 13 -0.066260764 0.07530724 14 -0.293178283 -1.67283928 15 -2.201906609 -2.25773100 16 0.078723688 -0.86648251 17 1.397936338 -0.68544958 18 -0.658166833 0.29932533 19 -2.166282124 -2.43069478 20 -0.439982086 -0.15740715 21 -0.294485645 0.06480571 22 -0.116755878 -0.45677116 23 0.704101046 -0.26282936 24 -0.978867037 -2.19181709 25 0.541598085 -1.03051934 26 -0.161441181 -0.94507862 27 0.701920174 -1.38136084 28 -0.085930606 -1.87779472 29 -1.463639156 -1.42061983 30 -0.523411117 -1.58582608 31 -0.441567731 -0.26836401 32 0.359407497 -0.46830903 33 1.079670903 -0.18027535 34 0.526446992 -0.43700760 35 0.185476262 -0.04438666 36 0.163453214 -0.54987561 37 0.409855673 -0.81228732 38 0.092966355 -0.30286411 39 1.058671587 -0.75811687 40 0.341073389 -1.17995781 41 0.570541932 -1.28283263 42 0.020007756 -0.72977087 43 0.428072399 -0.37639599 44 0.370564364 0.17567481 45 0.173813006 -0.00205560 46 -1.995810694 -1.29483230 47 0.273617993 -0.38589296 48 0.617409842 0.25677496 49 1.033740771 -0.34580714 50 -0.088609452 0.33257740 51 0.320853366 -1.52633108 52 -1.024663614 -1.26998031 53 -0.837357382 0.06052148 54 -1.090211627 -0.05738718 55 1.006610404 -0.57235566 56 1.259090912 -0.45583517 57 -0.168536381 -0.64750569 58 0.610421361 -0.44572030 59 1.116952460 -0.69363310 60 -0.033956496 0.70892596 61 -1.109136161 -0.46226261 62 0.439960063 -0.46051420 63 0.002990902 -1.28585116 64 1.045480568 0.32107787 65 0.984577013 -0.03247008 66 0.541598085 -1.03051934 67 0.391325370 -0.56038779 68 1.388293725 -0.36901234 69 1.046746414 0.05955478 70 -0.244521414 -1.72271545 71 1.261968153 0.34408879 72 1.118248925 0.37393167 73 2.107219213 0.06874810 74 0.497455839 0.17372819 75 -0.548547875 -0.54883220 76 0.905779934 -0.95843908 77 1.246084520 0.49253025 78 -0.019635457 -2.18377594 79 -0.909665319 -0.99839116 80 0.502049239 -1.04788708 81 0.079981399 -1.06047168 82 0.081373967 -0.52441371 83 1.182788432 -0.40997940 84 1.014662921 -0.01575972 85 1.266971828 0.32362528 86 1.334585949 -0.19606455 87 0.814176295 -0.35348940 88 1.810613239 -0.12324072 89 1.010807865 -0.01008361 90 0.787613844 -1.29634286 91 0.207106007 0.05594983 92 0.531839904 -1.16330835 93 -0.093236407 -0.07828015 94 0.093827368 0.72313898 95 1.444111442 -0.14372342 96 1.421733526 -0.49650400 97 0.821259939 -0.56457135 98 0.791263393 0.34266714 99 1.605085158 0.29840912 100 0.140075961 -0.22426804 101 1.069386570 0.16073395 102 0.075392700 -0.35742330 103 1.792966685 -0.75146424 104 0.542879691 0.47675705 105 0.102987693 -1.80898959 106 0.921831518 0.79575797 107 -0.390501064 -0.24161546 108 2.518781968 -0.50495084 109 -0.323497197 -0.70349479 110 0.910366788 -0.37289115 111 0.898019798 -0.99840983 112 0.911331517 -0.15079108 113 0.995763515 0.25613792 114 1.315757831 -0.47826883 115 0.301266877 0.44171648 116 1.092107467 0.09832638 117 0.264453169 -0.55172623 118 1.431299912 -0.14997883 119 1.121167860 0.02239022 120 -1.040885030 -0.75461394 121 0.497098953 -1.11973030 122 -0.760697007 -0.71770070 123 -0.848585863 0.32674326 124 -0.707658846 0.82980394 125 -0.429207675 1.52949361 126 0.995094390 1.00111360 127 -0.032187546 0.07532839 128 -0.353219641 0.76173459 129 0.455368203 0.91737502 130 -1.360538167 0.26176137 131 -0.993027815 0.12500789 132 -1.096058553 0.51493847 133 -2.937503385 0.74883028 134 -1.054797966 2.32455837 135 0.162878883 1.15991974 136 -0.979640674 0.64484436 137 -0.215339182 0.24522880 138 0.232970911 0.66485905 139 -0.670128084 0.87482386 140 -1.085744436 1.16703412 141 -0.646327879 0.40053474 142 -1.654357473 0.46373880 143 0.290003997 0.95054598 144 0.459484937 1.20735145 145 -0.649595909 -0.79848348 146 0.228022743 1.00130384 147 1.126566982 -0.75065114 148 -0.101714019 2.20540257 149 1.241340032 0.51964504 150 -0.508875050 0.24038032 151 -1.819141980 -1.92062532 152 0.394432059 0.56885084 153 0.997268102 1.11457793 154 -0.880517760 1.60749501 155 0.230892860 -0.49986339 156 -0.148738014 0.68231788 157 -0.166652761 1.73734331 158 1.138331723 1.92917958 159 -0.965694642 0.55240592 160 2.348644080 0.49588391 161 -0.683781245 0.41458830 162 -0.351871163 -0.35454010 163 0.519782468 1.98433671 164 -1.372159039 2.26235379 165 -0.987253009 2.01425922 166 -0.051643535 0.06721210 167 -0.550204388 -0.18925769 168 1.081334971 0.05171526 169 -0.845578223 1.06284398 170 -0.003863092 1.21290310 171 0.096113773 0.37893155 172 -3.314109465 0.95253307 173 -0.358260589 0.77773723 174 -0.031664311 0.02668097 175 -0.349516496 0.97230714 176 -1.139863802 1.19896847 177 -2.705048214 -0.08907826 178 -0.852375865 1.13494697 179 -1.475946792 -2.07651177 180 -1.649838343 -0.44200206 181 0.510338894 0.69071393 182 -0.058658206 0.56702676 183 2.303847382 -0.66990883 184 0.118188823 1.01152488 185 -0.164056736 1.87755389 186 0.773489720 2.14236565 187 -0.169746291 0.66074515 188 0.672175683 1.13936355 189 -1.510586245 1.77866888 190 -0.967451871 1.14527931 191 -0.014078393 -1.15166700 192 -1.112086182 1.09513842 193 -1.783635036 0.46565582 194 -0.420185920 1.27062405 195 -0.369341876 2.00529399 196 -1.307810156 -0.03241867 197 0.170403907 -0.55111425 198 0.090209331 1.46942692 199 -0.865061340 -0.81188489 200 -0.116325707 0.92130469 201 -2.503394091 0.46207893 202 0.769697223 1.17389749 203 -0.140537542 0.32057657 204 -0.394487393 1.02945457 205 -0.008081865 0.78063311 206 -0.224135630 -0.34092430 207 0.605489614 2.08949735 208 -1.512989185 1.18552634 209 -1.593836571 0.68382135 210 -0.794868176 0.69348244 211 0.001027364 0.92760123 212 -0.094382777 1.92192475 213 -0.594191053 0.37482964 214 -0.080955777 -1.54388580 215 -1.783959279 0.77557667 216 0.456668692 0.48756575 217 -0.518044104 -0.12131890 218 -2.027724639 -3.29590395 219 -0.399122396 -0.46657723 220 1.359507039 1.71025866 221 -1.032894987 0.99567472 222 0.154142837 0.80048025 > postscript(file="/var/www/rcomp/tmp/1vj4m1335791667.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/2wgxd1335791667.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/3ht2c1335791668.tab") > > try(system("convert tmp/1vj4m1335791667.ps tmp/1vj4m1335791667.png",intern=TRUE)) character(0) > try(system("convert tmp/2wgxd1335791667.ps tmp/2wgxd1335791667.png",intern=TRUE)) character(0) > > > proc.time() user system elapsed 0.830 0.500 2.193