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 = 'CSUQ' > par4 = 'all' > par3 = 'prep' > par2 = 'all' > par1 = '2' > par5 <- 'CSUQ' > par4 <- 'all' > par3 <- 'prep' > par2 <- 'all' > 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 U1 0.67 0.48 0.68 0.32 U2 0.67 0.49 0.68 0.32 U3 0.67 0.40 0.61 0.39 U4 0.61 0.44 0.57 0.43 U5 0.57 0.44 0.51 0.49 U6 0.65 0.37 0.55 0.45 U7 0.58 0.50 0.59 0.41 U8 0.45 0.44 0.40 0.60 U9 0.42 0.53 0.46 0.54 U10 0.31 0.14 0.12 0.88 U11 0.36 0.36 0.26 0.74 U12 0.57 0.12 0.34 0.66 U13 0.58 0.26 0.41 0.59 U14 0.53 0.27 0.35 0.65 U15 0.57 0.35 0.45 0.55 U16 0.66 0.15 0.46 0.54 U17 0.62 0.18 0.42 0.58 U18 0.64 0.23 0.46 0.54 U19 0.52 0.29 0.35 0.65 U20 0.72 0.47 0.74 0.26 U21 0.17 0.78 0.64 0.36 U22 0.23 0.82 0.72 0.28 U23 0.20 0.79 0.66 0.34 U24 0.17 0.76 0.60 0.40 U25 -0.38 -0.53 0.42 0.58 U26 0.32 0.06 0.10 0.90 U27 0.39 0.31 0.25 0.75 U28 0.12 0.73 0.55 0.45 U29 0.24 0.79 0.68 0.32 U30 0.49 0.59 0.59 0.41 U31 0.53 0.51 0.55 0.45 U32 0.57 0.09 0.34 0.66 U33 0.41 0.03 0.17 0.83 RC1 RC2 SS loadings 8.32 7.35 Proportion Var 0.25 0.22 Cumulative Var 0.25 0.47 Test of the hypothesis that 2 factors are sufficient. The degrees of freedom for the null model are 528 and the objective function was 23.42 The degrees of freedom for the model are 463 and the objective function was 7.23 The number of observations was 246 with Chi Square = 1676.48 with prob < 7.3e-137 Fit based upon off diagonal values = 0.97> fs <- factor.scores(y,fit) > fs RC1 RC2 1 0.376441617 -0.07054488 2 1.506206183 1.02178512 3 1.882181008 0.13218158 4 0.564067950 0.98702128 5 0.388072871 1.69998304 6 -1.044580745 0.44099430 7 0.038423347 -0.68892727 8 -0.940526532 0.38983450 9 2.379397048 0.35667288 10 -0.784460904 -0.58043241 11 1.663406969 -0.24170510 12 -0.742470888 1.48097697 13 0.529239333 0.11112152 14 -0.046794921 0.60822001 15 -1.287861900 -0.52676877 16 0.462439775 -0.12299706 17 0.114987180 1.48476153 18 -0.555027281 1.91496363 19 0.674759903 0.36888870 20 0.247596643 1.24665046 21 0.240868947 0.10440199 22 0.205411951 0.02268910 23 0.016947263 0.31048742 24 0.101275876 0.67770607 25 0.775946939 -0.50685259 26 1.587914795 0.02977230 27 0.056646264 0.45696053 28 0.098749884 -0.12624362 29 0.326631000 0.98184911 30 -0.655858457 -0.98512321 31 0.793370447 0.19205022 32 0.898543594 -1.43023739 33 0.614046284 0.10845006 34 -0.677184390 0.02705491 35 -0.192463529 -0.25905012 36 -0.270089377 -0.22155904 37 -0.049509501 1.87704845 38 0.793370447 0.19205022 39 0.050522621 -0.88641953 40 -0.677355788 0.02401169 41 1.650163804 0.61741841 42 0.675948575 0.24684495 43 0.913850431 0.83480418 44 0.402698689 -0.54683844 45 -0.741158493 0.38246608 46 0.345986183 -0.55442952 47 -0.799183713 1.04053024 48 -0.693601456 0.92606484 49 0.572412316 0.86959922 50 -1.044087156 -0.67026069 51 -1.573030714 0.67194369 52 0.459302183 0.18750918 53 0.204708968 0.36253630 54 -0.277307217 1.42383764 55 0.566897069 -0.20259640 56 -0.441182156 -0.48561247 57 -0.756975164 -0.43979008 58 0.319908157 0.42728264 59 -0.108743029 1.41963980 60 -2.566007190 0.47938215 61 -0.096259799 0.06694279 62 -0.445038415 -0.95315351 63 0.192285367 0.71438991 64 1.408136927 0.39282225 65 -0.390429884 0.42127582 66 0.851733581 0.35935619 67 -0.435978951 -0.17302266 68 0.709787601 0.77594241 69 -0.223718691 -2.72817501 70 0.473404021 0.75762292 71 0.034560305 0.26961741 72 0.507391664 0.60483060 73 1.787576974 0.21018545 74 -2.020467940 -1.65265355 75 0.527074534 1.49508002 76 -0.345278128 1.26587185 77 -1.313302013 -0.22161912 78 0.667131085 -0.48849259 79 1.534744875 -0.03187738 80 0.030564226 -0.43954289 81 0.507134116 -0.79703871 82 0.332222997 -0.35919231 83 -1.043707242 -0.26686588 84 -3.561916635 1.11726103 85 0.703000585 -0.14563746 86 2.080680803 -0.12327747 87 1.429158683 0.92229662 88 1.056907841 0.16321929 89 -1.717491665 0.54558853 90 -2.516782246 -1.15035443 91 0.201607310 0.83526677 92 -0.956804662 -0.68989760 93 0.208204503 0.35485931 94 0.085752790 0.49039709 95 -0.195642995 -1.38797484 96 0.232649693 0.66677958 97 0.504735163 0.19977086 98 1.058570294 -0.22613553 99 1.042393536 1.27265512 100 0.494938293 0.77761241 101 0.075955728 -0.50984872 102 1.190462192 -0.21503356 103 2.260081364 0.51164437 104 -1.483787782 1.72114714 105 -1.700759584 -1.09686427 106 -1.312002916 0.37181545 107 0.197689879 -0.57580802 108 0.415335048 0.39193325 109 0.757284510 0.84301768 110 0.174678317 0.84756864 111 0.339338516 0.36173636 112 1.278188772 -0.49188590 113 -1.780121776 -0.31155533 114 -1.667801484 1.89650041 115 -0.414935366 0.36872148 116 1.331857272 -2.88726004 117 -1.240944469 0.13150395 118 -0.630810236 -1.05457474 119 -1.459027979 0.63388619 120 0.718302811 -0.28753229 121 -2.842158677 1.55243831 122 -0.384261149 1.59179665 123 0.875651201 -0.41138629 124 -1.569649703 0.26425711 125 0.568445429 -1.81784786 126 -0.428820547 0.77779349 127 0.715712924 -0.19384454 128 0.168944843 0.71389912 129 -0.784460904 -0.58043241 130 0.376611195 0.38026469 131 1.309330527 1.35334281 132 -0.363734670 0.68145092 133 0.079305278 -1.52840909 134 1.013189808 0.83390360 135 -0.438081265 -1.00176227 136 -0.833540290 1.28650733 137 -0.170508760 1.69091070 138 0.132095171 0.74728669 139 -0.004193266 0.44138792 140 1.568227877 -0.68592464 141 1.002166967 0.25815395 142 0.901454134 -0.65757143 143 -1.194252179 -0.95757442 144 0.714599445 0.05337193 145 0.049016212 0.60072434 146 0.238149787 -0.79810218 147 -0.259538330 1.35610715 148 -0.267745589 -1.94825745 149 2.440263783 0.18229860 150 0.372940158 -0.78814855 151 0.964830622 0.56798171 152 1.487351098 -1.81532507 153 0.583405713 1.08625027 154 -0.177681666 0.90944479 155 0.302350521 -3.00056297 156 0.093552899 0.37399228 157 -0.276927549 0.63122730 158 -0.355648540 -0.78168411 159 -2.312872699 -1.34545378 160 0.047310038 0.96426092 161 -0.847550473 1.19783512 162 -1.506580705 1.98216825 163 0.180967134 -1.13641774 164 1.758344805 -0.67038192 165 -0.903880809 -1.57790723 166 1.555148748 -0.72071774 167 -2.184321219 -0.43327474 168 0.835371384 0.13573203 169 0.995088632 1.12750582 170 0.487497926 0.13413052 171 1.285658968 0.98687224 172 1.699739277 -2.11927164 173 -1.514521923 1.00502091 174 0.099918296 0.23269560 175 -0.431919955 -2.05227956 176 0.038504896 0.16142661 177 -0.055184353 0.45868879 178 -1.244324469 -1.92198895 179 -0.631298534 -0.55627728 180 1.567545066 -0.42843770 181 0.313480558 0.59386387 182 1.241468506 -0.80768069 183 0.612967360 0.01489238 184 1.771319914 -1.00475151 185 0.254118436 -0.67517854 186 0.079307359 0.04859301 187 1.254926786 -1.98644063 188 -0.734734782 0.10792209 189 0.036572732 -0.30109725 190 -0.505841285 0.04929757 191 0.229596662 0.34722789 192 -0.272069637 -1.73951754 193 -0.609849581 -0.75902536 194 -0.727227459 -0.56133744 195 -1.161283474 0.80769448 196 0.232324996 -2.29768355 197 0.309291305 0.04313954 198 -0.729941889 -1.94130424 199 0.071979999 0.57199676 200 0.148349127 -1.75732860 201 -0.227220645 1.02246103 202 -0.306709683 -0.05183071 203 -0.966220580 -0.24593617 204 -0.309957624 2.12087348 205 -0.741020588 -0.24638354 206 -0.773602197 -3.16999289 207 -1.036864756 -1.90811543 208 -0.995170414 0.94707227 209 -1.292196478 -0.22116904 210 -1.219526102 -0.82911304 211 0.740595353 0.13628130 212 -0.486225255 -1.84764763 213 0.002684892 -1.58288307 214 -1.371235168 -1.98315444 215 -0.495789842 0.65075419 216 0.209504214 0.43042793 217 0.238536981 -0.33180401 218 0.224812194 0.82669490 219 1.126919655 0.03558520 220 -1.117003239 0.90032149 221 0.157124080 0.50930522 222 0.417868346 0.25875415 223 0.676511987 0.61759753 224 -0.509032681 0.24487347 225 0.085890114 -1.39960510 226 0.008815646 0.27671788 227 -0.236548806 0.75581488 228 -1.136043414 -1.48209406 229 0.049517608 0.80217865 230 -1.025577574 1.65071867 231 -1.690521387 -0.56372562 232 0.883060843 0.83921024 233 -1.113773277 -0.11857810 234 -0.009856961 0.97721588 235 1.914673967 -1.55562081 236 -1.382731425 -0.79056100 237 0.312202070 0.58990162 238 -0.654612507 -0.81439615 239 0.700540598 -0.39507067 240 -0.861227073 2.01118835 241 0.663270714 -1.36032435 242 -0.492474590 0.09812395 243 0.622104702 0.20644985 244 -3.165948939 -1.90138965 245 1.391154714 -0.81778768 246 -0.170878974 0.07758819 > postscript(file="/var/www/rcomp/tmp/1hav31337852902.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/2jf8t1337852902.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/3p07c1337852903.tab") > > try(system("convert tmp/1hav31337852902.ps tmp/1hav31337852902.png",intern=TRUE)) character(0) > try(system("convert tmp/2jf8t1337852902.ps tmp/2jf8t1337852902.png",intern=TRUE)) character(0) > > > proc.time() user system elapsed 0.850 0.340 2.547