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

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

From |
"Florian Christian Esser" <florian.esser@tu-dortmund.de> |

To |
statalist@hsphsun2.harvard.edu |

Subject |
Re: st: CR and AVE for factor analysis with 2 factors |

Date |
Tue, 29 Oct 2013 08:14:58 +0100 |

Hi Nick, thanks a lot for your advice. Unfortunately, all my communalities are positive. Does anyone have any ideas, what else could cause the issue? Is the general approach correct, to calculate CR and AVE for both factors at the same time, or would I have to do it individually. I.e. I do the factor analysis, identify, that the indicators load on two factors and then calculate CR and AVE for each factor individually? > Your missing value is presumably the result of taking the square root > of a negative number. Is at least one of your communalities reported > as negative? > > That aside you have segments like > > 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 > } > > You can simplify this. First, to hold constants, use locals or > scalars, not variables. Second, use -forval- to loop here: > > local nvar = e(df_m) > local sum_factors = 0 > forval i = 1/`nvar' { > local sum_factors = `sum_factors' + sqrt(communalities[`i',1] > } > > Third, use Mata instead. Here is a self-contained example: > > . matrix foo = (1,2,3,4) > > . mata : st_numscalar("sum_factors", sum(sqrt(st_matrix("foo")))) > > . scalar li > sum_factors = 6.1462644 > > However, none of these tricks can get round what appears to be your > problem. > > > Nick > njcoxstata@gmail.com > > > On 28 October 2013 14:11, Florian Christian Esser > <florian.esser@tu-dortmund.de> wrote: >> 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 real changes made) >> (534 real changes made, 534 to missing) >> (0 real changes made) >> (0 real changes made) >> (0 real changes made) >> [...] >> ___________________________ >> >> 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? >> >> Thanks a lot in advance. >> >> * >> * For searches and help try: >> * http://www.stata.com/help.cgi?search >> * http://www.stata.com/support/faqs/resources/statalist-faq/ >> * http://www.ats.ucla.edu/stat/stata/ > * > * For searches and help try: > * http://www.stata.com/help.cgi?search > * http://www.stata.com/support/faqs/resources/statalist-faq/ > * http://www.ats.ucla.edu/stat/stata/ > * * For searches and help try: * http://www.stata.com/help.cgi?search * http://www.stata.com/support/faqs/resources/statalist-faq/ * http://www.ats.ucla.edu/stat/stata/

**Follow-Ups**:**Re: st: CR and AVE for factor analysis with 2 factors***From:*Nick Cox <njcoxstata@gmail.com>

**References**:**st: CR and AVE for factor analysis with 2 factors***From:*"Florian Christian Esser" <florian.esser@tu-dortmund.de>

**Re: st: CR and AVE for factor analysis with 2 factors***From:*Nick Cox <njcoxstata@gmail.com>

- Prev by Date:
**Re: st: RE: Dividing data into quintiles** - Next by Date:
**st: R: Missing values - panel data** - Previous by thread:
**Re: st: CR and AVE for factor analysis with 2 factors** - Next by thread:
**Re: st: CR and AVE for factor analysis with 2 factors** - Index(es):