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 = 'ATTLES connected' > par4 = '3' > par3 = 'bachelor' > par2 = 'male' > par1 = '2' > par5 <- 'ATTLES connected' > par4 <- '3' > 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.15 0.43 0.210 0.79 A2 0.12 0.14 0.034 0.97 A3 0.68 0.11 0.481 0.52 A4 0.80 -0.21 0.677 0.32 A5 0.64 0.31 0.507 0.49 A6 0.63 0.45 0.601 0.40 A7 0.10 0.53 0.285 0.71 A8 0.28 0.53 0.359 0.64 A9 -0.31 0.58 0.431 0.57 A10 0.06 0.74 0.554 0.45 RC1 RC2 SS loadings 2.14 2.00 Proportion Var 0.21 0.20 Cumulative Var 0.21 0.41 Test of the hypothesis that 2 factors are sufficient. The degrees of freedom for the null model are 45 and the objective function was 1.85 The degrees of freedom for the model are 26 and the objective function was 0.85 The number of observations was 68 with Chi Square = 52.09 with prob < 0.0018 Fit based upon off diagonal values = 0.69> fs <- factor.scores(y,fit) > fs RC1 RC2 1 -0.05093094 -0.844545489 2 0.38661218 0.506698887 3 2.06577501 -1.098634013 4 0.70904431 -0.884129518 5 1.61283248 -0.564232760 6 -0.01342910 0.260588188 7 -1.37330222 -3.359905408 8 -1.06700631 0.281213225 9 -0.93105480 2.341619784 10 -0.12515646 -0.095039266 11 0.33968803 -1.156948554 12 0.73355252 0.118133963 13 1.06079005 -0.081592387 14 -3.53486799 0.546507603 15 -2.25468458 -1.268533133 16 0.32961269 0.128370907 17 -0.38910299 1.525557929 18 -0.22115496 0.619815954 19 -1.48914883 -2.401784622 20 0.36292786 0.460418148 21 -0.15249475 0.066780265 22 -0.47589465 0.265686305 23 0.60009850 0.906445228 24 -1.96185222 -1.100267747 25 -0.20045306 0.206141802 26 -0.07715687 -0.624352066 27 -0.46183974 0.368633185 28 -0.70626434 0.113272023 29 -0.14274107 -1.764042761 30 -1.05459095 -0.663454571 31 0.62841396 0.863803650 32 0.88810048 -0.378512545 33 -0.05577723 0.299076312 34 0.02894940 1.266184812 35 0.49691845 0.007169739 36 1.31396397 -1.123174497 37 0.31455639 0.646968500 38 -0.33560153 0.080564189 39 -0.70539690 0.770705773 40 0.30533547 0.353921356 41 0.28343213 -0.392576601 42 -0.47982795 0.034542470 43 0.22625818 0.178020002 44 0.43036059 0.286312498 45 -0.33818777 1.566915514 46 0.09919935 0.833541767 47 -2.36820821 -0.628810052 48 1.62203346 -0.110014604 49 0.70364096 1.520378642 50 0.44715052 0.124047172 51 1.30325586 0.533560800 52 0.17740331 -0.425601726 53 -0.89132407 -0.361348934 54 1.39491784 -1.313739981 55 0.82397437 -1.933080161 56 0.68467485 1.013706208 57 0.79139895 0.591746058 58 -1.23880182 0.820588273 59 -0.66257766 1.107905020 60 0.07043124 0.869178728 61 0.31669056 -0.008318919 62 1.28554024 -2.276927937 63 -0.07816295 0.403745149 64 -0.87362950 0.096610651 65 1.65250405 -0.068335694 66 0.33359098 0.403398393 67 -0.20045306 0.206141802 68 0.08744633 1.333287072 > postscript(file="/var/wessaorg/rcomp/tmp/10svp1335770675.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/27jjn1335770675.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/3lc3h1335770675.tab") > > try(system("convert tmp/10svp1335770675.ps tmp/10svp1335770675.png",intern=TRUE)) character(0) > try(system("convert tmp/27jjn1335770675.ps tmp/27jjn1335770675.png",intern=TRUE)) character(0) > > > proc.time() user system elapsed 0.819 0.190 1.005