 Notice: On April 23, 2014, Statalist moved from an email list to a forum, based at statalist.org.

# st: CR and AVE for factor analysis with 2 factors

 From "Florian Christian Esser" To statalist@hsphsun2.harvard.edu Subject st: CR and AVE for factor analysis with 2 factors Date Mon, 28 Oct 2013 15:11:44 +0100

```Hi everyone,

I am trying to do factor analysis in order to measure two strategy
constructs. I have 6 indicators that load on these two constructs. Now I
want to calculate composite reliability (CR) and average variance
extracted(AVE).
I use the following code (here for CR):
___________________________________________________________________
factor zwmdiff_1 zwpdiff_1 zwpdiff_2 zwcost_1 zwcost_2 zwcost_3, pcf
matrix list e(Psi)
matrix list e(L)
matrix psi = e(Psi)'
matrix communalities = J(rowsof(psi),1,1)
matrix communalities = communalities - psi
matrix colnames communalities = communalities
matrix list communalities
gen nvar = e(df_m)
gen sum_factors=0
local i=1
while `i' <= nvar {
replace sum_factors = sum_factors + sqrt(communalities[`i',1])
local i=`i'+1
}
generate sum_psi=0
local i=1
while `i' <= nvar {
replace sum_psi = sum_psi + psi[`i',1]
local i=`i'+1
}
gen cr=(sum_factors*sum_factors)/((sum_factors*sum_factors)+sum_psi)
drop nvar
drop sum_factors
drop sum_psi
list cr in 1
_________________________________________________________________

The problem is that once the local macro starts running it tells me:
_____________________________
[...]
(534 real changes made, 534 to missing)
[...]
___________________________

and accordingly there is an empty result for CR.
If I add "factors(1)" in the command line above, I get a result, but I
since I have two factors, I think it is not correct to do this.

Does anyone know what to do here?