1
$\begingroup$

I am trying to do some data analyses based on target rotation in R using two different approaches. Here is a small simulation in r.

library(MASS)
library(dplyr)  
set.seed(23764)  
Sigma <- matrix(c(1,.7,.5,.7,1,.6,.5,.6,1),3,3) # set corelation matrix of three latent variables   
mydata<-data.frame(mvrnorm(n=500, rep(0, 3), Sigma))  # simulate one n=500      dataset for three predictors with zero MEAN
names(mydata) <- c("P1", "P2", "P3")
mydata<-mydata %>% mutate(      # create observed variables
  X1 = .8*P1+rnorm(500,0,sd=1),
  X2 = .8*P1+rnorm(500,0,sd=1),
  X3 = .8*P1+rnorm(500,0,sd=1),
  X4 = .8*P2+rnorm(500,0,sd=1),
  X5 = .8*P2+rnorm(500,0,sd=1),
  X6 = .8*P2+rnorm(500,0,sd=1),
  X7 = .8*P3+rnorm(500,0,sd=1),
  X8 = .8*P3+rnorm(500,0,sd=1),
  X9 = .8*P3+rnorm(500,0,sd=1)
)
library(semTools)
unrotated <- efaUnrotate(mydata, nf=3, varList=paste0("X", 1:9), estimator="mlr")
library(GPArotation)
target <- matrix(0, 9, 3)
target[1:3, 1] <- NA
target[4:6, 2] <- NA
target[7:9, 3] <- NA
colnames(target) <- c("factor1", "factor2", "factor3")
out.target <- funRotate(unrotated, fun="targetQ", Target=target) 
summary(out.target)

This is the output

Factor Correlation
           factor1    factor2    factor3
factor1  1.0000000  0.6600270 -0.4581606
factor2  0.6600270  1.0000000 -0.5787392
factor3 -0.4581606 -0.5787392  1.0000000

The other way

library(psych)
Key <- make.keys(9,list(f1=1:3,f2=4:6,f3=7:9))
Key <- scrub(Key,isvalue=1)  #fix the 0s, allow the NAs to be estimated 
Key <- list(Key)             # keep the same matrices
outputTarget <- fa(mydata[,4:12],3,rotate="TargetQ",Target=Key)
summary(outputTarget)
With factor correlations of 
      MR1  MR3  MR2
MR1 1.00 0.46 0.66
MR3 0.46 1.00 0.58
MR2 0.66 0.58 1.00

Also see https://stackoverflow.com/questions/29314478/why-the-results-are-so-different-based-on-two-target-rotation-approaches

$\endgroup$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.