CFA with four factors: problem in covariance matrix (I think)

63 views
Skip to first unread message

Allison Ames

unread,
Mar 19, 2017, 7:00:43 PM3/19/17
to Stan users mailing list
Good evening,

I'm working on a 4-factor confirmatory item factor analysis with binary predictors. The model has simple structure, but all latent factors are correlated.  
Items 1-3 load onto factor 1; Items 4-6 load onto factor 2; Items 7-10 onto factor 3; Items 11-15 onto factor 4. 

The model compiles, but when I attempt to sample, Initialization between (-5,5) fails after 100 attempts. I changed the range of initial parameters to (-5,5) because it wasn't working in the default. 

My best guess is that the covariance matrix is misspecified, but I'm not quite sure. 

[593] "Rejecting initial value:"                                                                                                              
[594] "  Error evaluating the log probability at the initial value."                                                                          
[595] "Informational Message: The current Metropolis proposal is about to be rejected because of the following issue:"                        
[596] "Exception thrown at line 69: bernoulli_logit_log: Logit transformed probability parameter is nan, but must not be nan!"                
[597] "If this warning occurs sporadically, such as for highly constrained variable types like covariance matrices, then the sampler is fine,"
[598] "but if this warning occurs often then your model may be either severely ill-conditioned or misspecified."  

My model is attached, and the data file is also attached. Any insight into why this may be happening is much appreciated. Thank you, in advance. I apologize for my limited understanding. 

Best wishes,
Allison 
cat2.dat
catmodel5.stan

Stephen Martin

unread,
Mar 20, 2017, 12:54:02 AM3/20/17
to Stan users mailing list
With this type of parameterization, you need multi_normal_cholesky to use a cholesky factor of a covariance matrix, but you're feeding it a cholesky factor of a correlation matrix.
I think you need to transform the cholesky correlation matrix (L) to a cholesky covariance matrix, and you need to estimate the sigmas for each of the factors.

See page 328 of the manual.

Allison

unread,
Mar 20, 2017, 8:21:49 AM3/20/17
to Stan users mailing list
Dear Stephen,

Thank you very much for that information. I'm going to try to implement your suggestion today after some reading. 

Best wishes,
Allison 

Mike Lawrence

unread,
Mar 21, 2017, 11:13:03 AM3/21/17
to stan-...@googlegroups.com
Not sure if it's pertinent, since your code is taking a different approach to achieving identifiability than mine, but I have a demo of doing CFA in Stan here:



--
Mike Lawrence
Graduate Student
Department of Psychology & Neuroscience
Dalhousie University

~ Certainty is (possibly) folly ~

--
You received this message because you are subscribed to the Google Groups "Stan users mailing list" group.
To unsubscribe from this group and stop receiving emails from it, send an email to stan-users+unsubscribe@googlegroups.com.
To post to this group, send email to stan-...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply all
Reply to author
Forward
0 new messages