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. > par5 = 'Learning Activities' > par4 = 'all' > par3 = 'bachelor' > par2 = 'female' > par1 = '2' > par5 <- 'Learning Activities' > 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 BC 0.31 -0.08 0.11 0.894 NNZFG 0.36 -0.53 0.41 0.589 MRT 0.36 -0.24 0.18 0.816 AFL 0.93 0.11 0.87 0.126 LPM 0.94 0.13 0.91 0.094 LPC 0.91 0.01 0.83 0.165 W 0.04 0.70 0.49 0.512 WPA 0.12 0.85 0.73 0.270 RC1 RC2 SS loadings 2.96 1.57 Proportion Var 0.37 0.20 Cumulative Var 0.37 0.57 Test of the hypothesis that 2 factors are sufficient. The degrees of freedom for the null model are 28 and the objective function was 4.57 The degrees of freedom for the model are 13 and the objective function was 1.17 The number of observations was 133 with Chi Square = 148.93 with prob < 3.4e-25 Fit based upon off diagonal values = 0.86> fs <- factor.scores(y,fit) > fs RC1 RC2 1 -0.413506982 -1.231651e+00 2 -0.361180480 -1.016089e+00 3 2.219547316 3.488887e-01 4 -0.870183265 -1.395071e-01 5 1.290199854 -3.856162e-01 6 1.244835488 6.464067e-01 7 0.450672011 -1.461452e+00 8 0.912886808 -5.524230e-01 9 4.941032606 -5.617363e-01 10 -0.834080599 -5.214965e-01 11 4.850253061 4.145298e-01 12 0.201924936 -7.630965e-01 13 2.058177323 -1.516591e+00 14 -0.670583086 -9.722271e-01 15 -0.336053262 -1.100435e+00 16 -0.095674668 -1.938977e-01 17 -0.262419389 -2.489748e-01 18 1.390564022 -8.455702e-01 19 -0.942931955 -5.008794e-01 20 1.442621268 -1.324762e+00 21 -0.261260409 -7.975166e-01 22 -0.126293768 -4.480997e-01 23 -0.948623349 -1.038410e+00 24 0.350031235 -1.347513e+00 25 0.637245853 7.168770e-01 26 0.284223593 -3.114055e-01 27 0.121966635 -1.032254e+00 28 0.440706052 -4.385370e-01 29 0.134326719 -4.045065e-01 30 -0.001407691 -6.600032e-01 31 -0.230770067 -9.113058e-01 32 -0.958040101 -5.880902e-01 33 1.795685167 -9.559522e-01 34 0.028426503 3.965274e-01 35 -0.668987273 -6.169330e-01 36 -0.807648748 -8.735119e-01 37 0.886815658 -3.720798e-02 38 -0.135592097 -9.992192e-01 39 -0.618754998 -1.335732e+00 40 1.382673750 -6.197783e-01 41 -0.555027677 -1.339843e+00 42 -0.830328019 -5.224317e-01 43 0.248240995 -7.567958e-01 44 -0.352539237 -4.795059e-01 45 -0.390642586 7.330368e-01 46 -0.214267118 -1.301017e+00 47 -0.477618625 -4.385726e-01 48 -0.034609404 -9.848098e-01 49 0.058800806 3.395690e-01 50 -0.532915714 3.540610e-01 51 -0.730382830 -1.056183e+00 52 0.086081781 -1.019352e+00 53 0.284379641 -1.203305e+00 54 0.407975126 -1.283888e+00 55 2.444170611 4.952748e-01 56 -0.250124072 -9.522121e-01 57 2.501942237 5.540308e-01 58 -0.442562258 -8.640523e-01 59 0.010370321 6.310654e-01 60 1.613483926 -3.938760e-01 61 -0.419845418 3.030607e-01 62 0.821560732 -6.078708e-01 63 1.482313744 -6.755779e-01 64 -0.077018120 -7.188638e-01 65 -0.472538463 6.626014e-05 66 -0.557741533 -6.389401e-01 67 -0.007379346 4.005249e-02 68 0.349485119 4.996191e-01 69 -0.181603473 7.851361e-01 70 0.365007949 -7.781201e-01 71 -0.849298085 -8.237259e-01 72 0.244401884 -1.925099e-01 73 0.259754209 -4.690292e-01 74 -0.492402660 -1.222989e+00 75 0.165403299 -4.274948e-01 76 -0.552991744 -8.582417e-01 77 -0.007982681 -8.080662e-01 78 0.820837418 1.540887e+00 79 0.038768670 -8.989826e-01 80 0.913846956 -7.752286e-01 81 -0.302267819 -3.138167e-01 82 -0.158401938 5.375486e-01 83 -0.268639899 1.847286e+00 84 -0.248076160 -5.046450e-02 85 -0.611575296 2.169702e+00 86 -1.241146265 2.995764e-01 87 -0.230389405 1.112344e+00 88 -1.457344829 2.378471e-01 89 -0.909152327 4.650585e-01 90 -0.562108599 1.974352e+00 91 0.770578051 3.066588e-01 92 -0.192211550 4.649390e-01 93 -0.526753187 7.582100e-01 94 -0.855786313 1.275466e+00 95 0.078875268 4.919429e-01 96 -0.343810819 1.216721e+00 97 1.802370450 2.333286e+00 98 -0.122222160 4.945488e-01 99 -0.769910956 4.343246e-01 100 -0.024403822 1.946322e+00 101 -0.089397954 -2.289007e-01 102 -0.682232127 -2.043292e-01 103 -0.297099623 1.720376e-02 104 0.135243323 2.102326e-01 105 0.151928561 2.299656e+00 106 -0.923578783 -7.092991e-02 107 -0.241296254 6.551476e-01 108 -0.472758600 1.063029e+00 109 -1.340956244 -5.228864e-01 110 0.900050015 2.902071e+00 111 -0.752124020 -4.154889e-01 112 -0.348351034 -1.399971e-01 113 -0.118814637 1.452767e+00 114 -1.354850714 -1.493270e+00 115 -1.343615565 -5.006159e-01 116 -0.764896346 2.262205e+00 117 -1.022092863 1.146748e-01 118 -0.604732937 1.698915e+00 119 -0.855675812 1.328540e-01 120 -0.599353407 1.467832e+00 121 -0.912503163 -4.138433e-01 122 -1.368911402 4.227168e-01 123 0.555911969 2.762744e+00 124 -0.182636513 1.528614e+00 125 -0.083995752 -9.222323e-02 126 -0.756557189 2.705157e-01 127 0.168601328 1.926018e+00 128 0.044057021 1.436885e+00 129 -0.418230176 9.099703e-01 130 -0.496120395 9.327336e-01 131 -0.383276157 1.292017e+00 132 -1.059183124 1.056151e+00 133 -0.518003883 -2.895438e-01 > postscript(file="/var/wessaorg/rcomp/tmp/1ukwh1335174373.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/wessaorg/rcomp/tmp/2eu4p1335174373.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/wessaorg/rcomp/createtable file can be downloaded at http://www.wessa.net/cretab > load(file="/var/wessaorg/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/wessaorg/rcomp/tmp/3nq9e1335174373.tab") > > try(system("convert tmp/1ukwh1335174373.ps tmp/1ukwh1335174373.png",intern=TRUE)) character(0) > try(system("convert tmp/2eu4p1335174373.ps tmp/2eu4p1335174373.png",intern=TRUE)) character(0) > > > proc.time() user system elapsed 0.933 0.148 1.096