On Thu, Nov 14, 2024 at 12:09 PM Riccardo (Jack) Lucchetti <p002...@staff.univpm.it> wrote: > > On 14/11/2024 16:48, Cottrell, Allin wrote: > >> > >> Of course, it'd be nice to make this procedure more readily available to > >> gretl users. I see four (not mutually exclusive) ways of doing so: > >> > >> 1) modify our existing "pca" command to handle missing values; > >> 2) modify our existing "princomp" function to handle missing values; > >> 3) create a small self-contained function package; > >> 4) integrate the code into the existing "staticfactor" function package. > >> > >> Which one do you think is best? > > > > Not sure about "best", but it seems it wouldn't be super-difficult to > > extend pca and princomp() to handle NAs in the manner of your hansl > > function. > > That'd be my preference too. That said, extending princomp() would be > rather easy. The "pca" command, on the other hand, also reports some > additional statistics (basically, the eigenvalues) that are not readily > available with the EM algorithm, so this would require some more thought. > > PS: in my previous message, I typed "this" instead of "think". I'm > getting worse with age, sorry.
I now have some libgretl C code that shadows your hansl function. But talking of typos... Is it possible there's a typo in the convergence criterion in the function you posted? In the EM iteration you have crit = min(abs(E)) conv = crit < tol where E is a matrix of residuals and tol = 1.0e-8. It would seem more intuitive to have "crit = max(abs(E))", giving "all of the residuals should be small enough in absolute value" rather than "at least one of them should be small enough". Allin _______________________________________________ Gretl-devel mailing list -- gretl-devel@gretlml.univpm.it To unsubscribe send an email to gretl-devel-le...@gretlml.univpm.it Website: https://gretlml.univpm.it/postorius/lists/gretl-devel.gretlml.univpm.it/