CFA with R - small sample size - also different outcomes at different times I have the following problem:
We have a model of 3 latent variables with 8 observed variables each.
Our sample size is 19, which can't be upped because it is a special subgroup of the population and this is a pretest to see if the factor structure is roughly as expected, so we can use the scale in an even smaller sample.
The syntax is as follows:
model <- "
    L = ~ LM_S + LM_W + LM_S + LM_Au + LM_Fae + LM_Fah + LM_E + LM_An
    A = ~ AM_Fr + AM_P + AM_T + AM_B + AM_G + AM_Fa + AM_PZ + AM_PU
    M = ~ MM_G + MM_R + MM_Fah + MM_Fae + MM_Vo + MM_E + MM_H + MM_Ve
    "
    
    fit <- cfa (model, data=trp_int_pretest)
    summary (fit, fit.measures=TRUE, standardized=TRUE)

When I first ran the script yesterday evening, it gave me an error message, but calculated the model, leaving out "M". When I calculated it this morning, it calculated the model just with "L" and now it doesn't calculate it a all.
This is the error message the first 2 times:
Error in lav_samplestats_icov(COV = cov[[g]], ridge = ridge.eps, x.idx = x.idx[[g]],  : 
lavaan ERROR: sample covariance matrix is not positive-definite
In addition: Warning message:
In lav_data_full(data = data, group = group, cluster = cluster,  :
lavaan WARNING: small number of observations (nobs < nvar)
nobs = 19 nvar = 24

Now I get the additional message:
Error in h(simpleError(msg, call)) : 
Fehler bei der Auswertung des Argumentes 'object' bei der Methodenauswahl für Funktion 'summary':
object 'fit' not found

(Also, this is a German error message. I am German but never saw a German error message before.)
So questions are as follows:

*

*How can the program react so differently over time? What might be going on?

*Why does it not find the object "fit"? It seems it does not compute it anymore - is this right? (See 1)

*Is there anything we can do to test the structure? I ran a factor analysis for every latent factor, but this is of course no solution. (Model-fit was not good)

(Tried fixing covariances of the latent factors, but no different outcome)

*

*I'm going to guess that the first time you ran it you ran the CFA command only. That gives the first error message (which comes from Lavaan). The second time you ran it, you ran the summary command, which said "I can't find 'fit', so I don't know what to do". This message came from base R so it is in German. If I try to run the second command only, I get the same error:

    summary (fit, fit.measures=TRUE, standardized=TRUE)
    Error in h(simpleError(msg, call)) : 
      error in evaluating the argument 'object' in selecting a method for function 'summary': object 'fit' not found



*Your sample is too small. You need to have more rows than columns in your data frame. The program can't estimate the CFA, so 'fit' does not exist.


*Your sample is too small. Even if fit could be calculated, 19 is not a large enough sample to run any sort of CFA, regardless of the number of variables. Your results will not be meaningful or useful.


*Yes. It doesn't find 'fit' because there was an error when it tried to generate fit so fit does not exist.


*No. Your sample is too small. Sorry to be the bearer of bad news.
