IFA_Mode_Jumper: Exploratory Item Factor Analysis for Ordinal Response Data

Description Usage Arguments Value Author(s) References Examples

View source: R/RcppExports.R

Description

Implement the Man and Culpepper (2020) mode-jumping algorithm to factor analyze ordinal response data. Missing values should be specified as a non-numeric value such as NA.

Usage

1
IFA_Mode_Jumper(Y, M, gamma, Ms, sdMH, burnin, chain_length = 10000L)

Arguments

Y

A N by J matrix of item responses.

M

The number of factors.

gamma

Mode-jumping tuning parameter. Man & Culpepper used 0.5.

Ms

A vector of the number of score categories. Note 2 = two parameter normal ogive, >2 ordinal normal ogive.

sdMH

A vector of tuning parameters of length J for implementing the Cowles (1996) Metropolis-Hastings threshold sampler.

burnin

Number of burn-in iterations to discard.

chain_length

The total number of iterations (burn-in + post-burn-in).

Value

A list that contains nsamples = chain_length - burnin array draws from the posterior distribution:

Author(s)

Albert X Man, Steven Andrew Culpepper

References

Cowles, M. K. (1996), Accelerating Monte Carlo Markov chain convergence for cumulative link generalized linear models," Statistics and Computing, 6, 101-111.

Man, A. & Culpepper, S. A. (2020). A mode-jumping algorithm for Bayesian factor analysis. Journal of the American Statistical Association, doi:10.1080/01621459.2020.1773833.

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
#Load the psych package to apply the algorithm with the bfi dataset
library(psych)
data(bfi)

#subtract 1 from all items so scores start at 0
ydat<-as.matrix(bfi[,1:25])-1
J<-ncol(ydat)
N<-nrow(ydat)

#compute the number of item categories
Ms<-apply(ydat,2,max)+1

#specify burn-in and chain length
#in full application set these to 10000 and 20000
burnin = 10 
chain_length=20

out5<-IFA_Mode_Jumper(ydat,M=5,gamma=.5,Ms,sdMH=rep(.025,J),burnin,chain_length)

#check the acceptance rates for the threshold tuning parameter fall between .2 and .5
mh_acceptance_rates<-t(out5$MHACCEPT)

#compute mean thresholds
mthresholds<-apply(out5$THRESHOLDS,c(1,2),mean)

#compute mean intercepts
mintercepts<-apply(out5$INTERCEPTS,1,mean)

#rotate loadings to PLT
my_lambda_sample = out5$LAMBDA
my_M<-5
for (j in 1:dim(my_lambda_sample)[3]) {
  my_rotate = proposal2(1:my_M,my_lambda_sample[,,j],matrix(0,nrow=N,ncol = my_M))
  my_lambda_sample[,,j] = my_rotate$lambda
}

#compute mean of PLT loadings
mLambda<-apply(my_lambda_sample,c(1,2),mean)

#find promax rotation of posterior mean
rotatedLambda<-promax(mLambda)$loadings[1:J,1:my_M]

#save promax rotation matrix
promaxrotation<-promax(mLambda)$rotmat

#compute the factor correlation matrix
phi<-solve(t(promaxrotation)%*%promaxrotation)

bayesefa documentation built on Feb. 10, 2021, 5:10 p.m.