# Degrees of Freedom in CFA using lavaan

I'm confused about my degrees of freedom (df) when comparing 2 CFA models using lavaan versus calculating them by hand.

    library(lavaan)
model1 <-'
oneFactor =~ item1 + item2 + item3 + item4 + item5 + item6 + item7 + item8
'
fit1 <- cfa(model1, data=data)
summary(fit1)


Lavaan states that the model has 20 dfs, which my calculation by hand also gives me. That is:

Pieces of information = $\frac{p(p-1)}{2}$; where p = number of items.

For 8 items: $\frac{8*(8+1)}{2}$ = 36

Free parameters:

7 loadings (i.e., one loading is fixed to 1 of the 8 observed items) + 8 variances (one for each observed items) + 1 variance (for the latent factor) = 16

36 – 16 = 20dfs

However, in the 2-factor model I get a mismatch:

    model2 <-'
oneFactor =~ item1 + item2 + item3 + item4
twoFactor =~ item5 + item6 + item7 + item8
'
fit2 <- cfa(model2, data=data)
summary(fit2)


lavaan now states the model has 19 dfs; but my hand calculation gives me 20.

Still 8 items:

$\frac{8*(8+1)}{2}$ = 36

6 loadings (i.e., 2 items (one for each latent factor) are set to 1) + 8 variances (one for each observed item) + 2 variances (one for each latent construct) = 16

36 - 16 = 20dfs whereas lavaan's cfa gives me 19 dfs.

I will be very grateful if someone can let me know how I am thinking wrong about this. Thanks!