Skip to content

Maintaining data order in factanal with missing data

2 messages · Justin Delahunty, PIKAL Petr

#
Hi Petr,

Thanks for the quick response. Unfortunately I cannot share the data I am
working with, however please find attached a suitable R workspace with
generated data. It has the appropriate variable names, only the data has
been changed.

The last function in the list (init.dfs()) I call to subset the overall data
set into the three waves, then conduct the factor analysis on each (1 factor
CFA); it's just in a function to ease re-typing in a new workspace.


Thanks,

Justin

-----Original Message-----
From: PIKAL Petr [mailto:petr.pikal at precheza.cz] 
Sent: Friday, 26 July 2013 7:35 PM
To: Justin Delahunty; r-help at r-project.org
Subject: RE: [R] Maintaining data order in factanal with missing data

Hi

You provided functions, so far so good. But without data it would be quite
difficult to understand what the functions do and where could be the issue.

I suspect combination of complete cases selection together with subset and
factor behaviour. But I can be completely out of target too.

Petr
#
Hi

Well, the function init.dfs does nothing as all data frames created inside it does not propagate to global environment and there is nothing what the function returns.

Tha last line (when used outside a function) gives warnings but there is no sign of error.

When
dmid   g5oab2      g53      g54      g55   g5ovb1
1    1 1.418932 1.805227 2.791152 3.624116 3.425586
2    2 2.293907 1.187830 1.611237 1.748526 3.816533
3    3 2.836536 2.679523 1.279639 2.674986 2.452395
4    4 1.872259 3.278359 1.785872 2.458315 1.146480
5    5 1.467195 1.180747 3.564127 3.007682 2.109506
6    6 3.098512 3.151974 3.969379 3.750571 1.497358
dmid   w2oab3      w22      w23      w24   w2ovb1
1    1 4.831362 5.522764 7.809366 6.969172 7.398385
2    2 6.706346 4.101742 1.434697 5.266775 5.357641
3    3 3.653806 2.666885 1.209326 5.125556 4.963374
4    4 7.221255 7.649152 6.540398 6.648506 2.576081
5    5 1.848023 5.044314 2.761881 3.307220 1.454234
6    6 7.606429 4.911766 2.034813 2.638573 2.818834
dmid   w3oab3   w3oab4   w3oab7   w3oab8   w3ovb1
1    1 5.835609 6.108220 6.587721 2.451461 2.785467
2    2 4.973198 1.196815 6.388056 1.110877 4.226463
3    3 3.800367 6.697287 5.235345 6.666829 6.319073
4    4 1.093141 1.477773 2.269252 3.194978 4.916342
5    5 1.975060 7.204516 4.825435 1.775874 3.484027
6    6 3.273361 2.243805 5.326547 5.720892 6.118723
List of 2
 $ rescaled.scores: Named num [1:154] 3.43 3.83 2.43 1.1 2.08 ...
  ..- attr(*, "names")= chr [1:154] "1" "2" "3" "4" ...
 $ factor.loadings: Named num [1:5] -0.0106 -0.0227 -0.1093 -0.0912 0.9975
  ..- attr(*, "names")= chr [1:5] "g5oab2" "g53" "g54" "g55" ...
List of 2
 $ rescaled.scores: Named num [1:154] 6.34 5.24 5.3 1.91 2.16 ...
  ..- attr(*, "names")= chr [1:154] "1" "2" "3" "4" ...
 $ factor.loadings: Named num [1:5] -0.2042 0.0063 -0.2287 -0.0119 0.7138
  ..- attr(*, "names")= chr [1:5] "w2oab3" "w22" "w23" "w24" ...
List of 2
 $ rescaled.scores: Named num [1:154] NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN ...
  ..- attr(*, "names")= chr [1:154] "1" "2" "3" "4" ...
 $ factor.loadings: Named num [1:5] -0.1172 0.0128 -0.0968 0.106 0.9975
  ..- attr(*, "names")= chr [1:5] "w3oab3" "w3oab4" "w3oab7" "w3oab8" ...

Anyway I have no idea what you consider wrong?

Regards
Petr