R 28 February 2014

Σχετικά έγγραφα
Ιωάννης Τσαούσης, Πανεπιστήμιο Κρήτης Τμήμα Ψυχολογίας

ΤΕΙ ΠΕΙΡΑΙΑ ΠΡΟΓΡΑΜΜΑ ΜΕΤΑΠΤΥΧΙΑΚΩΝ ΣΠΟΥΔΩΝ ΕΠΙΣΤΗΜΗ ΤΩΝ ΑΠΟΦΑΣΕΩΝ ΜΕ ΠΛΗΡΟΦΟΡΙΑΚΑ ΣΥΣΤΗΜΑΤΑ

ΑΝΑΛΥΣΗ ΔΕΔΟΜΕΝΩΝ. Δρ. Βασίλης Π. Αγγελίδης Τμήμα Μηχανικών Παραγωγής & Διοίκησης Δημοκρίτειο Πανεπιστήμιο Θράκης

ΠΑΡΑΓΟΝΤΙΚΗ ΑΝΑΛΥΣΗ FACTOR ANALYSIS

Οδηγός Ανάλυσης Αξιοπιστίας και Εγκυρότητας Ψυχομετρικών Κλιμάκων με το SPSS

Διερεύνηση της Αξιοπιστίας και της Εγκυρότητας Ψυχομετρικής Κλίμακας με το λογισμικό SPSS

Wan Nor Arifin under the Creative Commons Attribution-ShareAlike 4.0 International License. 1 Introduction 1

ΜΕΘΟ ΟΛΟΓΙΑ ΕΚΠΑΙ ΕΥΤΙΚΗΣ ΕΡΕΥΝΑΣ

Queensland University of Technology Transport Data Analysis and Modeling Methodologies

Παραγοντική ανάλυση και SPSS Πρόχειρες σημειώσεις

5.1 logistic regresssion Chris Parrish July 3, 2016

Statistics 104: Quantitative Methods for Economics Formula and Theorem Review

Οι νέοι και το περιβάλλον: Περιβαλλοντικές στάσεις και συµπεριφορά µαθητών Λυκείων και ΤΕΕ του Ν. Ροδόπης

Lampiran 1 Hasil Kuesioner NO CI1 CI2 CI3 CT1 CT2 CT3 CS1 CS2 CS3 CL1 CL2 CL


Lampiran 2 Hasil Kuesioner No. BA1 BA2 BA3 BA4 PQ1 PQ2 PQ3 PQ4 PQ

Wan Nor Arifin under the Creative Commons Attribution-ShareAlike 4.0 International License. 1 Introduction 1

FORMULAS FOR STATISTICS 1

Επιστηµονική Επιµέλεια ρ. Γεώργιος Μενεξές. Εργαστήριο Γεωργίας. Viola adorata

Generalized additive models in R

Repeated measures Επαναληπτικές μετρήσεις

2. ΧΡΗΣΗ ΣΤΑΤΙΣΤΙΚΩΝ ΠΑΚΕΤΩΝ ΣΤΗ ΓΡΑΜΜΙΚΗ ΠΑΛΙΝΔΡΟΜΗΣΗ

Λογαριθμικά Γραμμικά Μοντέλα Poisson Παλινδρόμηση Παράδειγμα στο SPSS

Άσκηση 10, σελ Για τη μεταβλητή x (άτυπος όγκος) έχουμε: x censored_x 1 F 3 F 3 F 4 F 10 F 13 F 13 F 16 F 16 F 24 F 26 F 27 F 28 F

Other Test Constructions: Likelihood Ratio & Bayes Tests

SOLUTIONS TO MATH38181 EXTREME VALUES AND FINANCIAL RISK EXAM

Supplementary Appendix

Λογιστική Παλινδρόµηση

ΑΝΑΛΥΣΗ ΔΕΔΟΜΕΝΩΝ. Δρ. Βασίλης Π. Αγγελίδης Τμήμα Μηχανικών Παραγωγής & Διοίκησης Δημοκρίτειο Πανεπιστήμιο Θράκης

APPENDICES APPENDIX A. STATISTICAL TABLES AND CHARTS 651 APPENDIX B. BIBLIOGRAPHY 677 APPENDIX C. ANSWERS TO SELECTED EXERCISES 679

Reliability analysis Ανάλυση αξιοπιστίας

2. ΕΠΙΛΟΓΗ ΤΟΥ ΜΕΓΕΘΟΥΣ ΤΩΝ ΠΑΡΑΤΗΡΗΣΕΩΝ

Bayesian SEM: A more flexible representation of substantive theory Web tables

ΠΑΝΕΠΙΣΤΗΜΙΟ+ΠΑΤΡΩΝ+ Τμήμα+Διοίκησης+Επιχειρήσεων+

ΠΑΝΕΠΙΣΤΗΜΙΟ ΘΕΣΣΑΛΙΑΣ

Αν οι προϋποθέσεις αυτές δεν ισχύουν, τότε ανατρέχουµε σε µη παραµετρικό τεστ.

Appendix A3. Table A3.1. General linear model results for RMSE under the unconditional model. Source DF SS Mean Square

2. THEORY OF EQUATIONS. PREVIOUS EAMCET Bits.

ΠΑΡΑΓΟΝΤΙΚΗ ΑΝΑΛΥΣΗ ΣΕ ΔΕΔΟΜΕΝΑ ΑΠΟ ΕΡΕΥΝΑ ΑΓΟΡΑΣ

ΑΝΑΛΥΣΗ ΣΕ ΚΥΡΙΕΣ ΣΥΝΙΣΤΩΣΕΣ Α.Κ.Σ.

Οδηγίες χρήσης του R, μέρος 2 ο

w o = R 1 p. (1) R = p =. = 1

Aquinas College. Edexcel Mathematical formulae and statistics tables DO NOT WRITE ON THIS BOOKLET

Estimation for ARMA Processes with Stable Noise. Matt Calder & Richard A. Davis Colorado State University

Μενύχτα, Πιπερίγκου, Σαββάτης. ΒΙΟΣΤΑΤΙΣΤΙΚΗ Εργαστήριο 6 ο

Τομέας Βιομηχανικής Διοίκησης και Επιχειρησιακής Έρευνας

TABLES AND FORMULAS FOR MOORE Basic Practice of Statistics

Approximation of distance between locations on earth given by latitude and longitude

ΕΙΣΑΓΩΓΗ ΣΤΗ ΣΤΑΤΙΣΤΙΚΗ ΑΝΑΛΥΣΗ

6.3 Forecasting ARMA processes

[2] T.S.G. Peiris and R.O. Thattil, An Alternative Model to Estimate Solar Radiation

SCHOOL OF MATHEMATICAL SCIENCES G11LMA Linear Mathematics Examination Solutions

Biostatistics for Health Sciences Review Sheet

Solution Series 9. i=1 x i and i=1 x i.

519.22(07.07) 78 : ( ) /.. ; c (07.07) , , 2008

CHAPTER 48 APPLICATIONS OF MATRICES AND DETERMINANTS

PENGARUHKEPEMIMPINANINSTRUKSIONAL KEPALASEKOLAHDAN MOTIVASI BERPRESTASI GURU TERHADAP KINERJA MENGAJAR GURU SD NEGERI DI KOTA SUKABUMI


Homework for 1/27 Due 2/5

Optimizing Microwave-assisted Extraction Process for Paprika Red Pigments Using Response Surface Methodology

ΑΝΑΛΥΣΗ Ε ΟΜΕΝΩΝ. 7. Παλινδρόµηση

Section 8.3 Trigonometric Equations

Πρόβλημα 1: Αναζήτηση Ελάχιστης/Μέγιστης Τιμής

Bayesian statistics. DS GA 1002 Probability and Statistics for Data Science.

Phys460.nb Solution for the t-dependent Schrodinger s equation How did we find the solution? (not required)

Εργαστήριο στατιστικής Στατιστικό πακέτο S.P.S.S.

Lampiran 1 Output SPSS MODEL I

χ 2 test ανεξαρτησίας

Απλή Ευθύγραµµη Συµµεταβολή

Table A.1 Random numbers (section 1)

ΜΕΘΟΔΟΙ ΕΡΥΕΝΑΣ ΔΙΑΛΕΞΗ 5: ΠΑΡΑΓΟΝΤΙΚΗ ΑΝΑΛΥΣΗ

Correction Table for an Alcoholometer Calibrated at 20 o C

ΚΕΦΑΛΑΙΟ 1 ο ΒΑΣΙΚΕΣ ΤΕΧΝΙΚΕΣ ΔΕΙΓΜΑΤΟΛΗΨΙΑΣ ΚΑΙ ΑΝΑΛΥΣΗ ΕΡΩΤΗΜΑΤΟΛΟΓΙΩΝ ΜΕ ΧΡΗΣΗ ΕΛΕΓΧΩΝ (STUDENT S T).. 21

1 (forward modeling) 2 (data-driven modeling) e- Quest EnergyPlus DeST 1.1. {X t } ARMA. S.Sp. Pappas [4]

ΑΝΑΛΥΣΗ ΔΕΔΟΜΕΝΩΝ. Δρ. Βασίλης Π. Αγγελίδης Τμήμα Μηχανικών Παραγωγής & Διοίκησης Δημοκρίτειο Πανεπιστήμιο Θράκης

Exercises 10. Find a fundamental matrix of the given system of equations. Also find the fundamental matrix Φ(t) satisfying Φ(0) = I. 1.

ΚΟΙΝΩΝΙΟΒΙΟΛΟΓΙΑ, ΝΕΥΡΟΕΠΙΣΤΗΜΕΣ ΚΑΙ ΕΚΠΑΙΔΕΥΣΗ

DEMOCRITUS UNIVERISTY OF THRACE Dept. of Physical Education and Sport Sciences Doctoral Program of Study COURSE OUTLINE

Reminders: linear functions

ΣΤΑΤΙΣΤΙΚΗ ΕΠΙΧΕΙΡΗΣΕΩΝ ΕΙΔΙΚΑ ΘΕΜΑΤΑ. Κεφάλαιο 13. Συμπεράσματα για τη σύγκριση δύο πληθυσμών

Supplementary figures

255 (log-normal distribution) 83, 106, 239 (malus) 26 - (Belgian BMS, Markovian presentation) 32 (median premium calculation principle) 186 À / Á (goo

Α.Σ.ΠΑΙ.Τ.Ε. Π.Ε.ΣΥ.Π. ΜΕΘΟΔΟΛΟΓΙΑ ΕΡΕΥΝΑΣ ΓΙΑ ΤΟΥΣ ΣΚΟΠΟΥΣ ΣΥΕΠ ΣΤΑΤΙΣΤΙΚΗ ΑΝΑΛΥΣΗ ΜΕ ΤΟ SPSS

Οδηγίες χρήσης του R, μέρος 1 ο. Κατεβάζουμε το λογισμικό από την ιστοσελίδα

ΠΟΛΥΜΕΤΑΒΛΗΤΗ ΣΤΑΤΙΣΤΙΚΗ ΑΝΑΛΥΣΗ Ε ΟΜΕΝΩΝ EUROSTAT

( ) 2 and compare to M.

Εισαγωγή στα Μοντέλα Δομικών Εξισώσεων με τη χρήση του AMOS

Supplementary Information 1.


EE512: Error Control Coding

+ ε βελτιώνει ουσιαστικά το προηγούμενο (β 3 = 0;) 2. Εξετάστε ποιο από τα παρακάτω τρία μοντέλα:

Παράδειγμα: Γούργουλης Βασίλειος, Επίκουρος Καθηγητής Τ.Ε.Φ.Α.Α.-Δ.Π.Θ.

ΚΥΠΡΙΑΚΗ ΕΤΑΙΡΕΙΑ ΠΛΗΡΟΦΟΡΙΚΗΣ CYPRUS COMPUTER SOCIETY ΠΑΓΚΥΠΡΙΟΣ ΜΑΘΗΤΙΚΟΣ ΔΙΑΓΩΝΙΣΜΟΣ ΠΛΗΡΟΦΟΡΙΚΗΣ 24/3/2007

SOLUTIONS TO MATH38181 EXTREME VALUES AND FINANCIAL RISK EXAM

Galatia SIL Keyboard Information

Lecture 34 Bootstrap confidence intervals

Μαντζούνη, Πιπερίγκου, Χατζή. ΒΙΟΣΤΑΤΙΣΤΙΚΗ Εργαστήριο 5 ο

Μενύχτα, Πιπερίγκου, Σαββάτης. ΒΙΟΣΤΑΤΙΣΤΙΚΗ Εργαστήριο 5 ο

1. Ιστόγραμμα. Προκειμένου να αλλάξουμε το εύρος των bins κάνουμε διπλό κλικ οπουδήποτε στο ιστόγραμμα και μετά

Does anemia contribute to end-organ dysfunction in ICU patients Statistical Analysis

Transcript:

R (minato-nakazawa@umin.net) 28 February 2014 2011 http://minato.sip21c.org/swtips/factor-in-r.pdf 1 Timothy Bates *1 *2 2 *3 3 300 2:1 10:1 1.0 (1) *4 (2) *1 http://www.psy.ed.ac.uk/people/tbates/lectures/methodology/ *2 http://aoki2.si.gunma-u.ac.jp/lecture/pfa/pfa6.html http://aoki2.si.gunma-u.ac.jp/r/kmo.html http://aoki2.si.gunma-u.ac.jp/r/bartlett.sphericity.test.html KMO MSA Bartlett *3 *4

(Parallel Analysis) 0.7 4 300 10 X 1, X 2,..., X 10 10 F 1 F 2 X 1 = β 1 1 F 1 + β 2 1 F 2 + ϵ 1 X 2 = β 1 2 F 1 + β 2 2 F 2 + ϵ 2. X 10 = β 1 10 F 1 + β 2 10 F 2 + ϵ 10 β (Factor loadings) ϵ (uniqueness) *5 F 1 F 2 *6 F 1 F 2 n n [1, 300] i X i (n) F S 1 (n) F S 2 (n) β 0.3 0.4 0.5 10 F S 1 (n) = β 1 i X i (n) i=1 10 F S 2 (n) = β 2 i X i (n) i=1 5 100% *5 1 (communality) rela *6

1 1 1 6 50 (very poor) 100 (poor) 200 (fair) 300 (good) 500 (very good) 1,000 (excellent) (Comfrey and Lee, 1992, p.217) KMO MSA KMO Kaiser-Meyer-Olkin MSA Measures of Sampling Adequacy KMO 0.0 1.0 0.5 *7 MSA 0.5 KMO MSA kmo <- function(x) { x <- subset(x, complete.cases(x)) # Remove the cases with any missing value r <- cor(x) # Correlation matrix r2 <- r^2 # Squared correlation coefficients i <- solve(r) # Inverse matrix of correlation matrix d <- diag(i) # Diagonal elements of inverse matrix p2 <- (-i/sqrt(outer(d, d)))^2 # Squared partial correlation coefficients diag(r2) <- diag(p2) <- 0 # Delete diagonal elements KMO <- sum(r2)/(sum(r2)+sum(p2)) MSA <- colsums(r2)/(colsums(r2)+colsums(p2)) return(list(kmo=kmo, MSA=MSA)) } p *7 Kaiser (1974) 0.5 0.5 0.6 (miserable) 0.6 0.7 (mediocre) 0.7 0.8 (middling) 0.8 0.9 (meritorious) 0.9 (marvelous)

Bartlett.sphericity.test <- function(x) { method <- "Bartlett s test of sphericity" data.name <- deparse(substitute(x)) x <- subset(x, complete.cases(x)) # Remove the cases with any missing value n <- nrow(x) p <- ncol(x) chisq <- (1-n+(2*p+5)/6)*log(det(cor(x))) df <- p*(p-1)/2 p.value <- pchisq(chisq, df, lower.tail=false) names(chisq) <- "X-squared" names(df) <- "df" return(structure(list(statistic=chisq, parameter=df, p.value=p.value, method=method, data.name=data.name), class="htest")) } 7 R factanal paf rela rela eigencrit= 1 KMO MSA fa psych fm= "minres" "ml" "pa" nfactors= rotate= "none" "varimax" "quartimax" "bentlert" "geomint" "oblimin" "simplimax" "bentlerq" "geominq" "cluster" alpha psych α cortest.bartlett psych fa.parallel psych $nfact sem (confirmatory factor analysis; CFA) sem sem CFA

8 1 Tomothy Bates SPSS *8 p1-p40 Bates pdf *9 res$factor.loadings library(foreign) y <- read.spss("http://www.subjectpool.com/ed_teach/y3method/factorexdata05.sav") x <- as.data.frame(y) for (i in 1:length(x)) { x[,i] <- ifelse(x[,i]==999,na,x[,i]) } # // Comments // ========================================================== # The data \verb!x! consists of 538 cases with 102 variables. # it can be saved as "factorexdata05.txt" by the following line # write.table(x,"factorexdata05.txt",quote=false,sep="\t",row.names=false) # if so, the data can be read by: # x <- read.delim("factorexdata05.txt") # ========================================================================= Ps <- x[,4:43] # Extract variables p1-p40 Ps <- subset(ps, complete.cases(ps)) # Omit missings (511 cases remain) library(rela) res <- paf(as.matrix(ps)) summary(res) # Automatically calculate KMO with MSA, determine the number of factors, # calculate chi-square of Bartlett s sphericity test, communalities and # factor loadings. Communalities are 1 minus uniquenesses. barplot(res$eigenvalues[,1]) # First column of eigenvalues. resv <- varimax(res$factor.loadings) # Varimax rotation is possible later. print(resv) barplot(sort(colsums(loadings(resv)^2),decreasing=true)) # screeplot using rotated SS loadings. scores <- as.matrix(ps) %*% as.matrix(resv$loadings) # Get factor scores in a simple manner. library(psych) cortest.bartlett(ps) # Bartlett s sphericity test. res2 <- fa.parallel(ps) res3 <- fa(ps, fm="minres", nfactors=8, rotate="oblimin") print(res3) # Factor loadings as $loadings 9 2 (2014) factanal() 2 9.1 * 10 *8 http://www.subjectpool.com/ed_teach/y3method/factorexdata05.sav *9 http://www.subjectpool.com/ed_teach/y3method/factorex05.pdf http://www.subjectpool.com/ed_teach/y3method/fa.pdf *10 http://ishida-m.github.io/misaki/

install.packages("misaki", repos="http://rmecab.jp/r") library(misaki) demo(part2) # factanal() rotation="none" > # demo(part2) data(tests) > result <- factanal(, factors=2, scores="regression") > result$loadings Loadings: Factor1 Factor2 0.449 0.567 0.799 0.916 0.942 0.199 0.802 0.119 0.873 Factor1 Factor2 SS loadings 2.496 1.855 Proportion Var 0.416 0.309 Cumulative Var 0.416 0.725 > biplot(result$scores, result$loading, cex = 2) biplot()

rela paf 2 40 KMO 0.7 MSA 0.5 > library(rela) > summary(paf(as.matrix( ))) $KMO [1] 0.7157 $MSA MSA 0.87987 0.62913 0.58698 0.67863 0.84021 0.70709 $Bartlett [1] 134.01 $Communalities Initial Communalities Final Extraction 0.49330 0.54513 0.56582 0.67665 0.61918 0.79076 0.79924 0.91818 0.62605 0.67215 0.71366 0.74745 $Factor.Loadings [,1] [,2] 0.68824-0.26730 0.43847-0.69599 0.49364-0.73964 0.90487 0.31527 0.76242 0.30146 0.72851 0.46553 $RMS [1] 0.01485 psych > cortest.bartlett(cor( ), n=40)$p.value # [1] 3.474469e-21 > # cortest.bartlett( ) > # > res2 <- fa.parallel( ) Loading required package: parallel Loading required package: MASS Parallel analysis suggests that the number of factors = 2 and the number of components = 2

p 2 2 fa() > print(res3 <- fa(, nfactors=2, rotate="varimax", fm = "ml")) Factor Analysis using method = ml Call: fa(r =, nfactors = 2, rotate = "varimax", fm = "ml") Standardized loadings (pattern matrix) based upon correlation matrix ML1 ML2 h2 u2 com 0.45 0.57 0.52 0.477 1.9 0.01 0.80 0.64 0.362 1.0 0.05 0.92 0.84 0.158 1.0 0.94 0.20 0.93 0.074 1.1 0.80 0.12 0.66 0.343 1.0 0.87-0.04 0.76 0.237 1.0 ML1 ML2 SS loadings 2.50 1.85 Proportion Var 0.42 0.31 Cumulative Var 0.42 0.73 Proportion Explained 0.57 0.43 Cumulative Proportion 0.57 1.00 Mean item complexity = 1.2 Test of the hypothesis that 2 factors are sufficient. The degrees of freedom for the null model are 15 and the objective function was 3.71 with Chi Square of 134.01 The degrees of freedom for the model are 4 and the objective function was 0.06 The root mean square of the residuals (RMSR) is 0.02 The df corrected root mean square of the residuals is 0.05 The harmonic number of observations is 40 with the empirical chi square 0.44 with prob < 0.98 The total number of observations was 40 with MLE Chi Square = 2.16 with prob < 0.71 Tucker Lewis Index of factoring reliability = 1.061 RMSEA index = 0 and the 90 % confidence intervals are NA 0.178 BIC = -12.6 Fit based upon off diagonal values = 1 Measures of factor score adequacy ML1 ML2 Correlation of scores with factors 0.97 0.94 Multiple R square of scores with factors 0.94 0.88 Minimum correlation of possible factor scores 0.88 0.77 > biplot(res3$scores, res3$structure) factanal() 40

1 2 2 3 1 sem * 11 * 12 library(misaki); data(tests) # library(sem) # sem cor1 <- cor( ) # model1 <- specifymodel() # <-, a1 <-, a2 <-, a3 <-, b1 <-, b2 <-, b3 <-, b4 <->, e1, NA <->, e2, NA <->, e3, NA <->, e4, NA <->, e5, NA <->, e6, NA <->, NA, 1 <->, NA, 1 sem1 <- sem(model1, cor1, N=40) # sem summary(sem1, fit.indices=c("gfi", "AGFI", "RMSEA", "CFI", "AIC", "BIC")) *11 install.packages(sem, dep=true) sem *12 http://minato.sip21c.org/cfa-test.r

CFA * 13 AGFI 0.9 CFI RMSEA Model Chisquare = 8.509691 Df = 8 Pr(>Chisq) = 0.3853279 Goodness-of-fit index = 0.9381964 Adjusted goodness-of-fit index = 0.8377655 RMSEA index = 0.04041812 90% CI: (NA, 0.1949356) Bentler CFI = 0.9960645 AIC = 34.50969 BIC = -21.00134 Normalized Residuals Min. 1st Qu. Median Mean 3rd Qu. Max. -0.1188000 0.0000001 0.1023000 0.3528000 0.6272000 1.5080000 R-square for Endogenous Variables 0.5033 0.7145 0.7516 0.9157 0.6638 0.7240 Parameter Estimates Estimate Std Error z value Pr(> z ) a1 0.51486041 0.13399171 3.842480 1.217975e-04 <--- a2 0.84530493 0.15181150 5.568122 2.574997e-08 <--- a3 0.86695423 0.15136758 5.727476 1.019357e-08 <--- b1 0.44876380 0.12781506 3.511040 4.463569e-04 <--- b2 0.95691786 0.12322908 7.765358 8.141525e-15 <--- b3 0.81476524 0.13469909 6.048780 1.459463e-09 <--- b4 0.85091108 0.13199780 6.446403 1.145356e-10 <--- e1 0.46041583 0.11888891 3.872656 1.076558e-04 <--> e2 0.28545947 0.15148233 1.884441 5.950539e-02 <--> e3 0.24839031 0.15469287 1.605700 1.083399e-01 <--> e4 0.08430837 0.07118676 1.184326 2.362839e-01 <--> e5 0.33615766 0.09212222 3.649040 2.632223e-04 <--> e6 0.27595046 0.08360466 3.300659 9.645810e-04 <--> Iterations = 22 *13 model1 <- cfa(covs=null, reference.indicators=false) :,, :,,,