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 = 'all' > par2 = 'female' > par1 = '2' > par5 <- 'CSUQ' > par4 <- 'all' > par3 <- 'all' > 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 U1 0.70 0.47 0.71 0.29 U2 0.66 0.49 0.67 0.33 U3 0.64 0.37 0.55 0.45 U4 0.51 0.52 0.52 0.48 U5 0.54 0.49 0.53 0.47 U6 0.56 0.47 0.53 0.47 U7 0.54 0.48 0.52 0.48 U8 0.35 0.41 0.29 0.71 U9 0.40 0.52 0.43 0.57 U10 0.41 -0.07 0.17 0.83 U11 0.30 0.25 0.15 0.85 U12 0.53 -0.08 0.29 0.71 U13 0.64 0.13 0.42 0.58 U14 0.46 0.22 0.26 0.74 U15 0.61 0.27 0.45 0.55 U16 0.64 0.16 0.43 0.57 U17 0.61 0.14 0.39 0.61 U18 0.56 0.25 0.37 0.63 U19 0.47 0.28 0.30 0.70 U20 0.68 0.45 0.66 0.34 U21 0.09 0.78 0.62 0.38 U22 0.09 0.79 0.63 0.37 U23 0.16 0.77 0.62 0.38 U24 0.24 0.72 0.58 0.42 U25 -0.43 -0.44 0.38 0.62 U26 0.28 0.19 0.11 0.89 U27 0.24 0.39 0.21 0.79 U28 0.03 0.73 0.54 0.46 U29 0.18 0.64 0.44 0.56 U30 0.51 0.45 0.46 0.54 U31 0.44 0.44 0.39 0.61 U32 0.39 0.13 0.17 0.83 U33 0.32 0.14 0.12 0.88 RC1 RC2 SS loadings 7.21 6.71 Proportion Var 0.22 0.20 Cumulative Var 0.22 0.42 Test of the hypothesis that 2 factors are sufficient. The degrees of freedom for the null model are 528 and the objective function was 20.57 The degrees of freedom for the model are 463 and the objective function was 7.53 The number of observations was 194 with Chi Square = 1353.31 with prob < 4.4e-88 Fit based upon off diagonal values = 0.96> fs <- factor.scores(y,fit) > fs RC1 RC2 1 1.936270967 0.660827525 2 0.399153402 2.213231784 3 0.061347128 -0.620022711 4 1.841203369 0.019545425 5 0.720859531 0.214208832 6 0.452406687 0.151144386 7 0.398968477 1.467083410 8 0.546186812 -0.001975954 9 1.952251058 0.055241982 10 0.388014321 0.356933949 11 0.148957354 0.004310728 12 0.951201533 -1.305300272 13 0.802938219 0.197146012 14 -0.851745358 0.310778918 15 -0.262823092 0.018023471 16 -0.062040943 -0.684531663 17 0.329399546 -0.246695807 18 0.921361453 0.882259788 19 0.484048116 0.348965539 20 0.030118024 1.502336203 21 0.817613525 -0.257199454 22 -0.229892603 -0.683915363 23 -0.499847580 -0.682607410 24 0.549396199 0.449689319 25 -2.541202665 0.223130887 26 -0.312412025 0.502771745 27 0.464366482 0.702097634 28 1.627400518 0.594544966 29 0.764038306 0.756876783 30 0.289844179 0.186442041 31 0.637807867 0.797733052 32 -1.886430478 -2.137534640 33 0.687692034 1.798768619 34 0.886428608 -0.506976638 35 1.740816438 0.187731452 36 0.172591494 -0.434042261 37 0.566325527 -0.694028620 38 0.205090412 0.002660877 39 -1.037816151 -0.327847972 40 2.377187865 0.110986548 41 1.254492236 0.350641006 42 -1.646739447 0.427519069 43 -1.006963898 -0.624029808 44 0.348590956 0.471043511 45 -0.261206490 -1.332689600 46 0.516103060 0.692273673 47 0.600619300 0.381659504 48 -1.728229409 -1.348958486 49 -1.124737353 0.123380392 50 0.574272658 0.513243227 51 0.184534950 1.101095483 52 0.508510698 0.465514304 53 1.287822058 -0.152992248 54 -2.021151943 -0.205685190 55 -0.460514240 0.623400364 56 1.174050857 -2.656435436 57 -1.284585525 0.213181365 58 0.853565486 -0.120048737 59 -0.525346965 2.044895290 60 0.833771225 -0.046226440 61 -0.134912560 -0.883754792 62 -0.254859422 -0.529353944 63 -0.252645468 -0.226017502 64 -2.090272577 0.194487636 65 -0.874865757 0.380912305 66 -1.337131990 -1.292303534 67 0.202526520 0.424891898 68 0.433719157 2.160458154 69 1.259854197 -0.923529501 70 0.485831262 0.190248349 71 -0.353312085 0.728356029 72 -1.262718828 1.387044448 73 -0.509419522 -1.678435015 74 -0.514943166 -0.607953109 75 -0.093498590 -0.368557617 76 -0.116655514 -0.143747045 77 0.415267602 -0.241043291 78 2.266723511 -0.166597330 79 -0.976371998 -0.206463396 80 0.456091109 -0.240802093 81 0.210604609 0.103137888 82 1.017412403 -0.635239245 83 0.306763380 0.022869193 84 -1.499151721 -2.037076156 85 0.193430636 0.125264062 86 -0.049550169 -1.171884842 87 -1.571536103 1.161961459 88 -0.697302570 -1.077461239 89 -0.396364043 -0.243801706 90 0.712862895 -0.416868968 91 -0.798744310 -2.250847543 92 0.795325943 -0.796547420 93 -0.903030296 1.064563994 94 0.608996735 -1.509556495 95 1.166858405 0.238773721 96 0.079644513 1.935606191 97 0.380874568 0.669276968 98 -0.146750371 -0.916055796 99 -0.675076113 0.584629918 100 0.654309729 -0.980545040 101 -0.730151256 0.133689448 102 1.710518563 -1.248266841 103 -2.009816579 1.850333817 104 0.909398330 1.482390976 105 -0.655627167 1.293362735 106 0.209528701 0.998902105 107 0.014769435 0.677524792 108 1.041524096 -0.009853633 109 0.532083561 -0.986090915 110 1.647807776 -1.757092706 111 -0.188468664 -0.994754482 112 -0.580312917 1.114934844 113 1.009444111 0.274411448 114 0.911382314 -0.067258619 115 0.119046509 0.319566053 116 -0.104659996 0.746705761 117 -0.383684400 -0.859942147 118 1.700891345 -0.212697013 119 1.454181705 -0.774426565 120 1.888588251 -0.813547586 121 0.221726865 -0.418622571 122 0.144054401 0.168797053 123 1.101979642 -1.650523699 124 -0.316425566 -1.804837849 125 0.355071534 -2.501852331 126 0.424075313 0.179202319 127 -0.079827734 -1.506813593 128 -0.051988156 -0.199372172 129 -0.306685500 2.574200765 130 -1.429172770 -0.066304859 131 -1.304503806 -0.950464205 132 -0.640688862 -1.851100179 133 0.170674021 -1.702985372 134 0.223911974 0.703587805 135 0.739361567 -0.702650905 136 0.509082396 0.865251884 137 0.188442359 -1.515247341 138 0.071297128 0.624385658 139 -1.119330907 -1.684618201 140 -1.073502664 1.948281187 141 -1.710284897 -0.721953611 142 -1.083532595 -0.168740509 143 -0.626564718 -0.872239462 144 0.838253310 -0.266923418 145 -0.517394590 0.294763658 146 0.835823073 0.276134234 147 -3.538281570 -2.051453637 148 -1.465054620 1.012024155 149 0.205726764 1.408792209 150 0.614093574 -0.785539290 151 0.507327657 0.486239039 152 -0.211246518 0.839717490 153 -1.108757970 1.772527691 154 -0.972171131 -0.594616247 155 -1.344337130 1.589478395 156 1.281880725 -0.970787569 157 -0.305106086 -0.496225407 158 0.476095573 0.523075647 159 -0.803036591 1.123249359 160 0.513275860 -0.274639098 161 -1.901904310 0.637935602 162 1.082987815 0.190233186 163 -0.062055203 -0.971865327 164 -1.612049045 -0.259722781 165 0.081795557 0.371166986 166 -1.204065191 0.916580422 167 -0.269304396 -0.636932616 168 0.402512571 0.491445974 169 0.861874124 -0.652015398 170 0.317493672 0.757353465 171 0.770630516 0.034087324 172 1.534445956 0.624887491 173 -0.252904666 0.685344019 174 -0.235991681 0.379010704 175 0.737471951 0.493438779 176 -0.569566137 -1.110380994 177 0.755831586 1.188862707 178 -0.527406235 0.528484150 179 -0.736748372 1.012640311 180 1.500111835 -0.015067966 181 -1.565178055 0.314593075 182 0.003735188 -2.439347463 183 -0.956634826 1.939652613 184 -0.587702166 0.519420769 185 0.105863422 0.066706640 186 -2.185633627 -2.193137410 187 -1.805145822 -0.468417072 188 0.035410182 0.918084218 189 0.234941880 -0.825390178 190 -1.516048841 1.364213750 191 0.422491949 0.391023076 192 -0.078598564 1.233306470 193 0.811211242 1.064776927 194 -2.184492148 0.768326109 > postscript(file="/var/www/rcomp/tmp/1grig1335699968.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/25lea1335699968.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/3aawh1335699968.tab") > > try(system("convert tmp/1grig1335699968.ps tmp/1grig1335699968.png",intern=TRUE)) character(0) > try(system("convert tmp/25lea1335699968.ps tmp/25lea1335699968.png",intern=TRUE)) character(0) > > > proc.time() user system elapsed 0.830 0.420 2.259