Phenotypic factor analysis: Small practical Big 5 dimensions N & E in males and females Script: fa2efa - Efa using R (factanal)

Slides:



Advertisements
Similar presentations
G Lecture 10 SEM methods revisited Multilevel models revisited
Advertisements

From PCA to Confirmatory FA (from using Stata to using Mx and other SEM software) References: Chapter 8 of Hamilton Chapter 10 of Lattin et al Data sets:
Topic 12: Multiple Linear Regression
ANOVA & sib analysis. basics of ANOVA - revision application to sib analysis intraclass correlation coefficient.
Phenotypic factor analysis
BIOL 582 Lecture Set 22 One-Way MANOVA, Part II Post-hoc exercises Discriminant Analysis.
Eight backpackers were asked their age (in years) and the number of days they backpacked on their last backpacking trip. Is there a linear relationship.
Factor Analysis and Principal Components Removing Redundancies and Finding Hidden Variables.
ANOVA and Linear Models. Data Data is from the University of York project on variation in British liquids. Data is from the University of York project.
Generalized Linear Models (GLM)
Economics 310 Lecture 6 Test for a Regression. Basic Hypothesis.
SPH 247 Statistical Analysis of Laboratory Data 1April 23, 2010SPH 247 Statistical Analysis of Laboratory Data.
Discrim Continued Psy 524 Andrew Ainsworth. Types of Discriminant Function Analysis They are the same as the types of multiple regression Direct Discrim.
Correlation Patterns. Correlation Coefficient A statistical measure of the covariation or association between two variables. Are dollar sales.
Nemours Biomedical Research Statistics April 2, 2009 Tim Bunnell, Ph.D. & Jobayer Hossain, Ph.D. Nemours Bioinformatics Core Facility.
Lecture 16 Psyc 300A. What a Factorial Design Tells You Main effect: The effect of an IV on the DV, ignoring all other factors in the study. (Compare.
Lecture 9: One Way ANOVA Between Subjects
CORRELATION COEFFICIENTS What Does a Correlation Coefficient Indicate? What is a Scatterplot? Correlation Coefficients What Could a Low r mean? What is.
Lecture 15 Psyc 300A. Example: Movie Preferences MenWomenMean Romantic364.5 Action745.5 Mean55.
Calculating AIA Alpha in Excel - M. Parent, Open the SPSS data set on which you want to run the alpha analysis.
Raw data analysis S. Purcell & M. C. Neale Twin Workshop, IBG Colorado, March 2002.
Phenotypic multivariate analysis. Last 2 days……. 1 P A A C C E E 1/.5 a cecae P.
Introduction to R: The Basics Rosales de Veliz L., David S.L., McElhiney D., Price E., & Brooks G. Contributions from Ragan. M., Terzi. F., & Smith. E.
Data enter key Comma r “correlation coefficient” ALPHA Activates “green” statistic functions ALPHA Activates “green” statistic functions Mean Standard.
Lecture 5 Correlation and Regression
Point Biserial Correlation Example
Karri Silventoinen University of Helsinki Osaka University.
Correlation and Covariance. Overview Continuous Categorical Histogram Scatter Boxplot Predictor Variable (X-Axis) Height Outcome, Dependent Variable (Y-Axis)
BIOL 582 Lecture Set 19 Matrices, Matrix calculations, Linear models using linear algebra.
Analysis of Covariance Harry R. Erwin, PhD School of Computing and Technology University of Sunderland.
Analysis of Variance (Two Factors). Two Factor Analysis of Variance Main effect The effect of a single factor when any other factor is ignored. Example.
Completing the ANOVA From the Summary Statistics.
Factorial Design One Between-Subject Variable One Within-Subject Variable SS Total SS between subjects SS within subjects Treatments by Groups Treatments.
Intervention models Something’s happened around t = 200.
Multivariate Descriptive Research In the previous lecture, we discussed ways to quantify the relationship between two variables when those variables are.
1 Exploratory & Confirmatory Factor Analysis Alan C. Acock OSU Summer Institute, 2009.
Practical SCRIPT: F:\meike\2010\Multi_prac\MultivariateTwinAnalysis_MatrixRaw.r DATA: DHBQ_bs.dat.
Week of April 6 1.ANCOVA: What it is 2.ANCOVA: What it’s good for 3.ANCOVA: How to do it 4.ANCOVA: An example.
Linear Regression Analysis Using MS Excel Tutorial for Assignment 2 Civ E 342.
Determining Factors of GPA Natalie Arndt Allison Mucha MA /6/07.
Mx modeling of methylation data: twin correlations [means, SD, correlation] ACE / ADE latent factor model regression [sex and age] genetic association.
SEM with Measured Genotypes NIDA Workshop VIPBG, October 2012 Maes, H. H., Neale, M. C., Chen, X., Chen, J., Prescott, C. A., & Kendler, K. S. (2011).
G Lecture 71 Revisiting Hierarchical Mixed Models A General Version of the Model Variance/Covariances of Two Kinds of Random Effects Parameter Estimation.
Continuous Outcome, Dependent Variable (Y-Axis) Child’s Height
Basics in R part 2. Variable types in R Common variable types: Numeric - numeric value: 3, 5.9, Logical - logical value: TRUE or FALSE (1 or 0)
Descriptive Statistics using R. Summary Commands An essential starting point with any set of data is to get an overview of what you are dealing with You.
Pearson’s Correlation The Pearson correlation coefficient is the most widely used for summarizing the relation ship between two variables that have a straight.
Education 793 Class Notes ANCOVA Presentation 11.
Correlations & Regression Modelling
Covariance/ Correlation
Dolan & Abdellaoui Boulder Workshop 2016
Univariate Twin Analysis
Fitting Univariate Models to Continuous and Categorical Data
Covariance/ Correlation
Covariance/ Correlation
Two Way ANOVAs Factorial Designs.
University of Massachusetts at Boston
Three-Group Discriminant Function Analysis
Solutions of Tutorial 10 SSE df RMS Cp Radjsq SSE1 F Xs c).
Soc 3306a: ANOVA and Regression Models
Analysing data from a questionnaire:
Soc 3306a Lecture 11: Multivariate 4
Determining Sex.
Covariance/ Correlation
Simplex Model Practical
Solutions of Tutorial 9 SSE df RMS Cp Radjsq SSE1 F Xs c).
Ch 4.1 & 4.2 Two dimensions concept
Confidence Intervals = Z intervals on your Calculator
Multitrait Scaling and IRT: Part I
Netherlands Twin Register (NTR)
Presentation transcript:

Phenotypic factor analysis: Small practical Big 5 dimensions N & E in males and females Script: fa2efa - Efa using R (factanal)

# read the data datf=read.table('rdataf') # read the female data datm=read.table('rdatam') # read the male data datb5=rbind(datf,datm) # into 1 data matrix datb5[,1]=datb5[,1]-1 # recode sex from 1->0(m) and 2->1(f) # assign variable names colnames(datb5)=c('sex', 'n1', 'n2', 'n3', 'n4', 'n5', 'n6', 'e1', 'e2', 'e3', 'e4', 'e5', 'e6', 'o1', 'o2', 'o3', 'o4', 'o5', 'o6', 'a1', 'a2', 'a3', 'a4', 'a5', 'a6', 'c1', 'c2', 'c3', 'c4', 'c5', 'c6') Mean = b0 + b1*sex Sex=0 -> mean=b0 Sex=1 -> mean=b0+b1 So b1=sex difference

# select the variables of interest isel=c(1:13) # selection of variables sex, n1-n6, e1-e6 datb2=datb5[,isel] sex=datb5[,1] # sex in a separate vector for convenience table(sex) sex

Ss0=cov(datb2[sex==0,2:13]) # calculate the covariance matrix in males Ss1=cov(datb2[sex==1,2:13])# calculate the covariance matrix in females Ms0=apply(datb2[sex==0,2:13],2,mean) # males means Ms1=apply(datb2[sex==1,2:13],2,mean)# females means # mi=min(Ms0,Ms1) ma=max(Ms0,Ms1) plot(1:12,Ms0,type='b',col=1,lwd=3,ylim=c(mi,ma)) lines(1:12,Ms1,type='b',col=2,lwd=3,ylim=c(mi,ma))

alpha=.05/12; Stest=matrix(0,1,12) for (j in 2:13) { tmp=lm(datb2[,(j)]~(sex)) pval=summary(tmp)$coefficients[2,4] Stest[1,j-1]=(pval<alpha)} colnames(Stest)=colnames(datb2)[2:13] print(Stest) n1 n2 n3 n4 n5 n6 e1 e2 e3 e4 e5 e

Loadings: Factor1 Factor2 n n n n n n e e e e e e Factor Correlations: Factor1 Factor2 Factor Factor Uniquenesses: n1 n2 n3 n4 n5 n6 e1 e2 e3 e4 e5 e  y =  t +  MALES

Loadings: Factor1 Factor2 n ~0 Uniquenesses: n MALES    2  +  2  =1.901^2 * ≈ 1

Loadings: Factor1 Factor2 n n n n n n e e e e e e Factor Correlations: Factor1 Factor2 Factor Factor Uniquenesses: n1 n2 n3 n4 n5 n6 e1 e2 e3 e4 e5 e  y =  t +  FEMALES    2  +  2  =1

 y =  t +  Ly=mxMatrix(type='Full',nrow=ny,ncol=ne,free= matrix(c( T,F, T,F, # T,T T,F, F,T, T,T, # F,T F,T, F,T),ny,ne,byrow=T), value=c(4,4,4,4,4,4,0,0,0,0,0,0, 0,0,0,0,0,0,4,4,4,4,4,4),name='Ly') # read colunm-wise labels=matrix(c( 'f11','f12', 'f21','f22', 'f31','f32', 'f41','f42', 'f51','f52', 'f61','f62', 'f71','f72', 'f81','f82', 'f91','f92', 'f101','f102', 'f111','f112', 'f121','f122'),ny,ne,byrow=T) Define factor loading matrix 

Te=mxMatrix(type='Diag',nrow=ny,ncol=ny,free=TRUE,value=10,name='Te')  y =  t +  Define covariance matrix of residuals 

## latent correlation matrix Ps0=mxMatrix(type='Symm',nrow=ne,ncol=ne, free=c(FALSE,TRUE,FALSE), labels=c('v1_0','r12_0', 'v2_0'),values=c(1,-.1,1),name='Ps0') Ps1=mxMatrix(type='Symm',nrow=ne,ncol=ne, free=c(FALSE,TRUE,FALSE), labels=c('v_1','r12_1', 'v2_1'),values=c(0,0,0),name='Ps1')  y =  t +   + sex*  Define covariance matrix of factors 

 + sex*      Sex = 0:  0 Sex =1:  0 +  1 Allows us to test whether the latent correlation is equal in males and females

n4n5n6e1e2e3 NE r e e e e e e e4e5e6 e e e n1n2n3 e e e Test whether the cross loadings are unequal zero Using a likelihood ratio test

Factor Correlations: Factor1 Factor2 Factor Factor Factor Correlations: Factor1 Factor2 Factor Factor Test whether the correlations are equal Using a likelihood ratio test

> mxCompare(CFM2_out,CFM1_out) base comparison ep minus2LL df AIC diffLL diffdf p 1 CFM NA NA NA 2 CFM1 CFM e-21 > mxCompare(CFM2_out,CFM3_out) base comparison ep minus2LL df AIC diffLL diffdf p 1 CFM NA NA NA 2 CFM1 CFM Factor loadings are significant (alpha=0.01) Sex difference in latent correlation is not significant (alpha=0.01)